@agnt-id/frameworks 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/crewai.d.ts +46 -0
- package/dist/crewai.js +77 -0
- package/dist/eliza.d.ts +44 -0
- package/dist/eliza.js +97 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/langchain.d.ts +81 -0
- package/dist/langchain.js +117 -0
- package/dist/shared.d.ts +42 -0
- package/dist/shared.js +32 -0
- package/package.json +53 -0
package/dist/crewai.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrewAI-compatible tools for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* CrewAI tools follow a simple pattern: a class with `name`, `description`,
|
|
5
|
+
* and a `_run(input)` method. These tools can be passed directly to a
|
|
6
|
+
* CrewAI Agent's `tools` array.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* import { AgntResolveTool, AgntDiscoverTool } from "@agnt-id/frameworks/crewai";
|
|
11
|
+
* const tools = [new AgntResolveTool(), new AgntDiscoverTool()];
|
|
12
|
+
*/
|
|
13
|
+
export type AgntToolOptions = {
|
|
14
|
+
gateway?: string;
|
|
15
|
+
chainId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* CrewAI tool: resolve a .agnt name to its full record set.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AgntResolveTool {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
private clientP;
|
|
24
|
+
constructor(options?: AgntToolOptions);
|
|
25
|
+
_run(input: string): Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* CrewAI tool: reverse-resolve an address to a .agnt name.
|
|
29
|
+
*/
|
|
30
|
+
export declare class AgntReverseTool {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
private clientP;
|
|
34
|
+
constructor(options?: AgntToolOptions);
|
|
35
|
+
_run(input: string): Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* CrewAI tool: discover agents by keyword, skill, or domain.
|
|
39
|
+
*/
|
|
40
|
+
export declare class AgntDiscoverTool {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
private clientP;
|
|
44
|
+
constructor(options?: AgntToolOptions);
|
|
45
|
+
_run(input: string): Promise<string>;
|
|
46
|
+
}
|
package/dist/crewai.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrewAI-compatible tools for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* CrewAI tools follow a simple pattern: a class with `name`, `description`,
|
|
5
|
+
* and a `_run(input)` method. These tools can be passed directly to a
|
|
6
|
+
* CrewAI Agent's `tools` array.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* import { AgntResolveTool, AgntDiscoverTool } from "@agnt-id/frameworks/crewai";
|
|
11
|
+
* const tools = [new AgntResolveTool(), new AgntDiscoverTool()];
|
|
12
|
+
*/
|
|
13
|
+
import { createClient, formatResolved } from "./shared.js";
|
|
14
|
+
/**
|
|
15
|
+
* CrewAI tool: resolve a .agnt name to its full record set.
|
|
16
|
+
*/
|
|
17
|
+
export class AgntResolveTool {
|
|
18
|
+
name = "agnt_resolve";
|
|
19
|
+
description = "Resolve a .agnt name to wallet addresses, A2A/MCP endpoints, identity, and metadata. Input: a .agnt name like alice.agnt";
|
|
20
|
+
clientP;
|
|
21
|
+
constructor(options = {}) {
|
|
22
|
+
this.clientP = createClient(options);
|
|
23
|
+
}
|
|
24
|
+
async _run(input) {
|
|
25
|
+
const name = input.trim();
|
|
26
|
+
if (!name)
|
|
27
|
+
return "Error: provide a .agnt name to resolve.";
|
|
28
|
+
const client = await this.clientP;
|
|
29
|
+
const result = await client.resolve(name);
|
|
30
|
+
if (!result)
|
|
31
|
+
return `No .agnt name found for "${name}".`;
|
|
32
|
+
return formatResolved(result);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* CrewAI tool: reverse-resolve an address to a .agnt name.
|
|
37
|
+
*/
|
|
38
|
+
export class AgntReverseTool {
|
|
39
|
+
name = "agnt_reverse";
|
|
40
|
+
description = "Reverse-resolve an EVM wallet address to its primary .agnt name. Input: an address like 0x1234...";
|
|
41
|
+
clientP;
|
|
42
|
+
constructor(options = {}) {
|
|
43
|
+
this.clientP = createClient(options);
|
|
44
|
+
}
|
|
45
|
+
async _run(input) {
|
|
46
|
+
const address = input.trim();
|
|
47
|
+
if (!address)
|
|
48
|
+
return "Error: provide a wallet address.";
|
|
49
|
+
const client = await this.clientP;
|
|
50
|
+
const result = await client.reverse(address, { verify: true });
|
|
51
|
+
if (!result)
|
|
52
|
+
return `No .agnt name found for address ${address}.`;
|
|
53
|
+
const verified = result.verified ? " (verified)" : "";
|
|
54
|
+
return `${result.name}${verified}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* CrewAI tool: discover agents by keyword, skill, or domain.
|
|
59
|
+
*/
|
|
60
|
+
export class AgntDiscoverTool {
|
|
61
|
+
name = "agnt_discover";
|
|
62
|
+
description = "Search the .agnt agent directory by keyword, skill, or domain. Input: a search query.";
|
|
63
|
+
clientP;
|
|
64
|
+
constructor(options = {}) {
|
|
65
|
+
this.clientP = createClient(options);
|
|
66
|
+
}
|
|
67
|
+
async _run(input) {
|
|
68
|
+
const query = input.trim();
|
|
69
|
+
if (!query)
|
|
70
|
+
return "Error: provide a search query.";
|
|
71
|
+
const client = await this.clientP;
|
|
72
|
+
const result = await client.discover({ q: query, limit: 10 });
|
|
73
|
+
if (result.results.length === 0)
|
|
74
|
+
return `No agents found for "${query}".`;
|
|
75
|
+
return result.results.map((r) => r.name).join("\n");
|
|
76
|
+
}
|
|
77
|
+
}
|
package/dist/eliza.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElizaOS plugin for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* ElizaOS plugins expose actions, providers, and evaluators.
|
|
5
|
+
* This plugin adds a "resolve_agnt" action that lets ElizaOS agents
|
|
6
|
+
* resolve .agnt names during conversations.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* import { agntPlugin } from "@agnt-id/frameworks/eliza";
|
|
11
|
+
* // Register with your ElizaOS agent config
|
|
12
|
+
*/
|
|
13
|
+
export type AgntPluginOptions = {
|
|
14
|
+
gateway?: string;
|
|
15
|
+
chainId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* An ElizaOS action definition for resolving .agnt names.
|
|
19
|
+
*/
|
|
20
|
+
export type ElizaAction = {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
parameters: Record<string, {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
handler: (params: Record<string, string>) => Promise<string>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* An ElizaOS plugin definition.
|
|
32
|
+
*/
|
|
33
|
+
export type ElizaPlugin = {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
actions: ElizaAction[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create the .agnt ElizaOS plugin.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Gateway and chain configuration
|
|
42
|
+
* @returns An ElizaOS-compatible plugin with resolve, reverse, and discover actions
|
|
43
|
+
*/
|
|
44
|
+
export declare function agntPlugin(options?: AgntPluginOptions): ElizaPlugin;
|
package/dist/eliza.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElizaOS plugin for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* ElizaOS plugins expose actions, providers, and evaluators.
|
|
5
|
+
* This plugin adds a "resolve_agnt" action that lets ElizaOS agents
|
|
6
|
+
* resolve .agnt names during conversations.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* import { agntPlugin } from "@agnt-id/frameworks/eliza";
|
|
11
|
+
* // Register with your ElizaOS agent config
|
|
12
|
+
*/
|
|
13
|
+
import { createClient, formatResolved } from "./shared.js";
|
|
14
|
+
/**
|
|
15
|
+
* Create the .agnt ElizaOS plugin.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Gateway and chain configuration
|
|
18
|
+
* @returns An ElizaOS-compatible plugin with resolve, reverse, and discover actions
|
|
19
|
+
*/
|
|
20
|
+
export function agntPlugin(options = {}) {
|
|
21
|
+
let clientP = null;
|
|
22
|
+
const getClient = () => {
|
|
23
|
+
if (!clientP)
|
|
24
|
+
clientP = createClient(options);
|
|
25
|
+
return clientP;
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
name: "agnt",
|
|
29
|
+
description: "Resolve .agnt names to wallets, agent endpoints, and identity records",
|
|
30
|
+
actions: [
|
|
31
|
+
{
|
|
32
|
+
name: "resolve_agnt",
|
|
33
|
+
description: "Resolve a .agnt name to its wallet, A2A/MCP endpoints, identity, and metadata",
|
|
34
|
+
parameters: {
|
|
35
|
+
name: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "The .agnt name to resolve (e.g. alice.agnt)",
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
handler: async (params) => {
|
|
42
|
+
const name = params.name?.trim();
|
|
43
|
+
if (!name)
|
|
44
|
+
return "Error: provide a .agnt name to resolve.";
|
|
45
|
+
const client = await getClient();
|
|
46
|
+
const result = await client.resolve(name);
|
|
47
|
+
if (!result)
|
|
48
|
+
return `No .agnt name found for "${name}".`;
|
|
49
|
+
return formatResolved(result);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "reverse_agnt",
|
|
54
|
+
description: "Reverse-resolve an EVM wallet address to its primary .agnt name",
|
|
55
|
+
parameters: {
|
|
56
|
+
address: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "EVM wallet address (0x...)",
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
handler: async (params) => {
|
|
63
|
+
const address = params.address?.trim();
|
|
64
|
+
if (!address)
|
|
65
|
+
return "Error: provide a wallet address.";
|
|
66
|
+
const client = await getClient();
|
|
67
|
+
const result = await client.reverse(address, { verify: true });
|
|
68
|
+
if (!result)
|
|
69
|
+
return `No .agnt name found for address ${address}.`;
|
|
70
|
+
const verified = result.verified ? " (verified)" : "";
|
|
71
|
+
return `${result.name}${verified}`;
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "discover_agnt",
|
|
76
|
+
description: "Search the .agnt directory for agents by keyword, skill, or domain",
|
|
77
|
+
parameters: {
|
|
78
|
+
query: {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "Search query — keyword, skill slug, or domain slug",
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
handler: async (params) => {
|
|
85
|
+
const query = params.query?.trim();
|
|
86
|
+
if (!query)
|
|
87
|
+
return "Error: provide a search query.";
|
|
88
|
+
const client = await getClient();
|
|
89
|
+
const result = await client.discover({ q: query, limit: 10 });
|
|
90
|
+
if (result.results.length === 0)
|
|
91
|
+
return `No agents found for "${query}".`;
|
|
92
|
+
return result.results.map((r) => r.name).join("\n");
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agnt-id/frameworks — Agent framework plugins for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* Import from the sub-path for your framework:
|
|
5
|
+
*
|
|
6
|
+
* import { AgntResolveTool } from "@agnt-id/frameworks/langchain";
|
|
7
|
+
* import { AgntResolveTool } from "@agnt-id/frameworks/crewai";
|
|
8
|
+
* import { agntPlugin } from "@agnt-id/frameworks/eliza";
|
|
9
|
+
*
|
|
10
|
+
* Or import everything from the root:
|
|
11
|
+
*
|
|
12
|
+
* import * as agntFrameworks from "@agnt-id/frameworks";
|
|
13
|
+
*/
|
|
14
|
+
export { AgntDiscoverTool as CrewAIDiscoverTool, AgntResolveTool as CrewAIResolveTool, AgntReverseTool as CrewAIReverseTool, } from "./crewai.js";
|
|
15
|
+
export { agntPlugin } from "./eliza.js";
|
|
16
|
+
export { AgntDiscoverTool as LangChainDiscoverTool, AgntResolveTool as LangChainResolveTool, AgntReverseTool as LangChainReverseTool, } from "./langchain.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agnt-id/frameworks — Agent framework plugins for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* Import from the sub-path for your framework:
|
|
5
|
+
*
|
|
6
|
+
* import { AgntResolveTool } from "@agnt-id/frameworks/langchain";
|
|
7
|
+
* import { AgntResolveTool } from "@agnt-id/frameworks/crewai";
|
|
8
|
+
* import { agntPlugin } from "@agnt-id/frameworks/eliza";
|
|
9
|
+
*
|
|
10
|
+
* Or import everything from the root:
|
|
11
|
+
*
|
|
12
|
+
* import * as agntFrameworks from "@agnt-id/frameworks";
|
|
13
|
+
*/
|
|
14
|
+
export { AgntDiscoverTool as CrewAIDiscoverTool, AgntResolveTool as CrewAIResolveTool, AgntReverseTool as CrewAIReverseTool, } from "./crewai.js";
|
|
15
|
+
export { agntPlugin } from "./eliza.js";
|
|
16
|
+
export { AgntDiscoverTool as LangChainDiscoverTool, AgntResolveTool as LangChainResolveTool, AgntReverseTool as LangChainReverseTool, } from "./langchain.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain-compatible tools for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* Usage (LangChain JS/TS):
|
|
5
|
+
*
|
|
6
|
+
* import { AgntResolveTool, AgntDiscoverTool } from "@agnt-id/frameworks/langchain";
|
|
7
|
+
* const tools = [new AgntResolveTool(), new AgntDiscoverTool()];
|
|
8
|
+
*
|
|
9
|
+
* These tools follow the LangChain StructuredTool pattern — they expose
|
|
10
|
+
* `name`, `description`, and `_call()` so any LangChain agent can use them.
|
|
11
|
+
*/
|
|
12
|
+
/** Options accepted by all LangChain .agnt tools. */
|
|
13
|
+
export type AgntToolOptions = {
|
|
14
|
+
gateway?: string;
|
|
15
|
+
chainId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* LangChain tool: resolve a .agnt name to its records.
|
|
19
|
+
*
|
|
20
|
+
* Compatible with LangChain's StructuredTool interface.
|
|
21
|
+
* Can be used directly or wrapped in a DynamicStructuredTool.
|
|
22
|
+
*/
|
|
23
|
+
export declare class AgntResolveTool {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
private clientP;
|
|
27
|
+
constructor(options?: AgntToolOptions);
|
|
28
|
+
/** LangChain calls this with the raw input string. */
|
|
29
|
+
_call(input: string): Promise<string>;
|
|
30
|
+
/** Schema hint for LangChain agents. */
|
|
31
|
+
schema: {
|
|
32
|
+
type: "object";
|
|
33
|
+
properties: {
|
|
34
|
+
input: {
|
|
35
|
+
type: "string";
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
required: readonly ["input"];
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* LangChain tool: reverse-resolve an address to a .agnt name.
|
|
44
|
+
*/
|
|
45
|
+
export declare class AgntReverseTool {
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
private clientP;
|
|
49
|
+
constructor(options?: AgntToolOptions);
|
|
50
|
+
_call(input: string): Promise<string>;
|
|
51
|
+
schema: {
|
|
52
|
+
type: "object";
|
|
53
|
+
properties: {
|
|
54
|
+
input: {
|
|
55
|
+
type: "string";
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
required: readonly ["input"];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* LangChain tool: discover agents by keyword, skill, or domain.
|
|
64
|
+
*/
|
|
65
|
+
export declare class AgntDiscoverTool {
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
private clientP;
|
|
69
|
+
constructor(options?: AgntToolOptions);
|
|
70
|
+
_call(input: string): Promise<string>;
|
|
71
|
+
schema: {
|
|
72
|
+
type: "object";
|
|
73
|
+
properties: {
|
|
74
|
+
input: {
|
|
75
|
+
type: "string";
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
required: readonly ["input"];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain-compatible tools for .agnt name resolution.
|
|
3
|
+
*
|
|
4
|
+
* Usage (LangChain JS/TS):
|
|
5
|
+
*
|
|
6
|
+
* import { AgntResolveTool, AgntDiscoverTool } from "@agnt-id/frameworks/langchain";
|
|
7
|
+
* const tools = [new AgntResolveTool(), new AgntDiscoverTool()];
|
|
8
|
+
*
|
|
9
|
+
* These tools follow the LangChain StructuredTool pattern — they expose
|
|
10
|
+
* `name`, `description`, and `_call()` so any LangChain agent can use them.
|
|
11
|
+
*/
|
|
12
|
+
import { createClient, formatResolved } from "./shared.js";
|
|
13
|
+
/**
|
|
14
|
+
* LangChain tool: resolve a .agnt name to its records.
|
|
15
|
+
*
|
|
16
|
+
* Compatible with LangChain's StructuredTool interface.
|
|
17
|
+
* Can be used directly or wrapped in a DynamicStructuredTool.
|
|
18
|
+
*/
|
|
19
|
+
export class AgntResolveTool {
|
|
20
|
+
name = "agnt_resolve";
|
|
21
|
+
description = "Resolve a .agnt name (e.g. alice.agnt) to wallet addresses, A2A/MCP endpoints, identity, skills, and other records.";
|
|
22
|
+
clientP;
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.clientP = createClient(options);
|
|
25
|
+
}
|
|
26
|
+
/** LangChain calls this with the raw input string. */
|
|
27
|
+
async _call(input) {
|
|
28
|
+
const name = input.trim();
|
|
29
|
+
if (!name)
|
|
30
|
+
return "Error: provide a .agnt name to resolve.";
|
|
31
|
+
const client = await this.clientP;
|
|
32
|
+
const result = await client.resolve(name);
|
|
33
|
+
if (!result)
|
|
34
|
+
return `No .agnt name found for "${name}".`;
|
|
35
|
+
return formatResolved(result);
|
|
36
|
+
}
|
|
37
|
+
/** Schema hint for LangChain agents. */
|
|
38
|
+
schema = {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
input: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "The .agnt name to resolve (e.g. alice.agnt)",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: ["input"],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* LangChain tool: reverse-resolve an address to a .agnt name.
|
|
51
|
+
*/
|
|
52
|
+
export class AgntReverseTool {
|
|
53
|
+
name = "agnt_reverse";
|
|
54
|
+
description = "Reverse-resolve an EVM wallet address (0x...) to its primary .agnt name.";
|
|
55
|
+
clientP;
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this.clientP = createClient(options);
|
|
58
|
+
}
|
|
59
|
+
async _call(input) {
|
|
60
|
+
const address = input.trim();
|
|
61
|
+
if (!address)
|
|
62
|
+
return "Error: provide a wallet address.";
|
|
63
|
+
const client = await this.clientP;
|
|
64
|
+
const result = await client.reverse(address, { verify: true });
|
|
65
|
+
if (!result)
|
|
66
|
+
return `No .agnt name found for address ${address}.`;
|
|
67
|
+
const verified = result.verified ? " (verified)" : "";
|
|
68
|
+
return `${result.name}${verified}`;
|
|
69
|
+
}
|
|
70
|
+
schema = {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
input: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "EVM wallet address (0x...)",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: ["input"],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* LangChain tool: discover agents by keyword, skill, or domain.
|
|
83
|
+
*/
|
|
84
|
+
export class AgntDiscoverTool {
|
|
85
|
+
name = "agnt_discover";
|
|
86
|
+
description = "Search the .agnt directory for agents by keyword, skill slug, or domain slug. Returns a list of matching agent names and their capabilities.";
|
|
87
|
+
clientP;
|
|
88
|
+
constructor(options = {}) {
|
|
89
|
+
this.clientP = createClient(options);
|
|
90
|
+
}
|
|
91
|
+
async _call(input) {
|
|
92
|
+
const query = input.trim();
|
|
93
|
+
if (!query)
|
|
94
|
+
return "Error: provide a search query.";
|
|
95
|
+
const client = await this.clientP;
|
|
96
|
+
const result = await client.discover({ q: query, limit: 10 });
|
|
97
|
+
if (result.results.length === 0)
|
|
98
|
+
return `No agents found for "${query}".`;
|
|
99
|
+
return result.results
|
|
100
|
+
.map((r) => {
|
|
101
|
+
const rec = r.records;
|
|
102
|
+
const skills = rec.skills ?? [];
|
|
103
|
+
return `${r.name}${skills.length ? ` [${skills.join(", ")}]` : ""}`;
|
|
104
|
+
})
|
|
105
|
+
.join("\n");
|
|
106
|
+
}
|
|
107
|
+
schema = {
|
|
108
|
+
type: "object",
|
|
109
|
+
properties: {
|
|
110
|
+
input: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "Search query — keyword, skill slug, or domain slug",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: ["input"],
|
|
116
|
+
};
|
|
117
|
+
}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers used by all framework integrations.
|
|
3
|
+
* These keep the per-framework modules thin by centralising
|
|
4
|
+
* .agnt resolution into reusable functions.
|
|
5
|
+
*/
|
|
6
|
+
/** Minimal AgntClient shape — avoids hard import at module level. */
|
|
7
|
+
export type AgntClientLike = {
|
|
8
|
+
resolve(name: string): Promise<ResolvedLike | null>;
|
|
9
|
+
reverse(address: string, options?: {
|
|
10
|
+
chainId?: string;
|
|
11
|
+
verify?: boolean;
|
|
12
|
+
}): Promise<ReversedLike | null>;
|
|
13
|
+
discover(options?: DiscoverOptsLike): Promise<DiscoverResultLike>;
|
|
14
|
+
};
|
|
15
|
+
export type ResolvedLike = {
|
|
16
|
+
name: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
records: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export type ReversedLike = {
|
|
21
|
+
name: string;
|
|
22
|
+
verified?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type DiscoverOptsLike = {
|
|
25
|
+
q?: string;
|
|
26
|
+
skill?: string;
|
|
27
|
+
domain?: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
};
|
|
30
|
+
export type DiscoverResultLike = {
|
|
31
|
+
results: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
records: Record<string, unknown>;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
/** Create an AgntClient from @agnt-id/resolve (dynamic import). */
|
|
37
|
+
export declare function createClient(options?: {
|
|
38
|
+
gateway?: string;
|
|
39
|
+
chainId?: string;
|
|
40
|
+
}): Promise<AgntClientLike>;
|
|
41
|
+
/** Format a resolve result into a concise text summary. */
|
|
42
|
+
export declare function formatResolved(data: ResolvedLike): string;
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers used by all framework integrations.
|
|
3
|
+
* These keep the per-framework modules thin by centralising
|
|
4
|
+
* .agnt resolution into reusable functions.
|
|
5
|
+
*/
|
|
6
|
+
/** Create an AgntClient from @agnt-id/resolve (dynamic import). */
|
|
7
|
+
export async function createClient(options) {
|
|
8
|
+
const { AgntClient } = await import("@agnt-id/resolve");
|
|
9
|
+
return new AgntClient(options);
|
|
10
|
+
}
|
|
11
|
+
/** Format a resolve result into a concise text summary. */
|
|
12
|
+
export function formatResolved(data) {
|
|
13
|
+
const rec = data.records;
|
|
14
|
+
const lines = [`Name: ${data.name}`, `Owner: ${data.owner}`];
|
|
15
|
+
if (rec.wallet)
|
|
16
|
+
lines.push(`Wallet: ${String(rec.wallet)}`);
|
|
17
|
+
if (rec.a2a)
|
|
18
|
+
lines.push(`A2A: ${String(rec.a2a)}`);
|
|
19
|
+
if (rec.mcp)
|
|
20
|
+
lines.push(`MCP: ${String(rec.mcp)}`);
|
|
21
|
+
if (rec.identity)
|
|
22
|
+
lines.push(`Identity: ${String(rec.identity)}`);
|
|
23
|
+
if (rec.agentId)
|
|
24
|
+
lines.push(`Agent ID: ${String(rec.agentId)}`);
|
|
25
|
+
const skills = rec.skills;
|
|
26
|
+
if (skills?.length)
|
|
27
|
+
lines.push(`Skills: ${skills.join(", ")}`);
|
|
28
|
+
const domains = rec.domains;
|
|
29
|
+
if (domains?.length)
|
|
30
|
+
lines.push(`Domains: ${domains.join(", ")}`);
|
|
31
|
+
return lines.join("\n");
|
|
32
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agnt-id/frameworks",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent framework plugins for .agnt name resolution — LangChain, CrewAI, ElizaOS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./langchain": {
|
|
14
|
+
"import": "./dist/langchain.js",
|
|
15
|
+
"types": "./dist/langchain.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./crewai": {
|
|
18
|
+
"import": "./dist/crewai.js",
|
|
19
|
+
"types": "./dist/crewai.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./eliza": {
|
|
22
|
+
"import": "./dist/eliza.js",
|
|
23
|
+
"types": "./dist/eliza.d.ts"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"prepublishOnly": "tsc"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"agnt",
|
|
36
|
+
"langchain",
|
|
37
|
+
"crewai",
|
|
38
|
+
"elizaos",
|
|
39
|
+
"eliza",
|
|
40
|
+
"agent",
|
|
41
|
+
"naming",
|
|
42
|
+
"resolve",
|
|
43
|
+
"framework",
|
|
44
|
+
"plugin"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@agnt-id/resolve": ">=0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"typescript": "^5.9.3"
|
|
52
|
+
}
|
|
53
|
+
}
|