@hashgraphonline/conversational-agent
Version:
Hashgraph Online conversational AI agent implementing HCS-10 communication, HCS-2 registries, and content inscription on Hedera. https://hol.org
88 lines (87 loc) • 2.31 kB
JavaScript
import { BasePlugin } from "hedera-agent-kit";
import { HCS2Builder, CreateRegistryTool, RegisterEntryTool, UpdateEntryTool, DeleteEntryTool, MigrateRegistryTool, QueryRegistryTool } from "@hashgraphonline/standards-agent-kit";
class HCS2Plugin extends BasePlugin {
constructor() {
super(...arguments);
this.id = "hcs-2";
this.name = "HCS-2 Plugin";
this.description = "HCS-2 registry management tools for decentralized registries on Hedera";
this.version = "1.0.0";
this.author = "Hashgraph Online";
this.namespace = "hcs2";
this.tools = [];
}
async initialize(context) {
await super.initialize(context);
const hederaKit = context.config.hederaKit;
if (!hederaKit) {
this.context.logger.warn(
"HederaKit not found in context. HCS-2 tools will not be available."
);
return;
}
try {
this.initializeTools();
this.context.logger.info(
"HCS-2 Plugin initialized successfully"
);
} catch (error) {
this.context.logger.error(
"Failed to initialize HCS-2 plugin:",
error
);
}
}
initializeTools() {
const hederaKit = this.context.config.hederaKit;
if (!hederaKit) {
throw new Error("HederaKit not found in context config");
}
const hcs2Builder = new HCS2Builder(hederaKit);
this.tools = [
new CreateRegistryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
}),
new RegisterEntryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
}),
new UpdateEntryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
}),
new DeleteEntryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
}),
new MigrateRegistryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
}),
new QueryRegistryTool({
hederaKit,
hcs2Builder,
logger: this.context.logger
})
];
}
getTools() {
return this.tools;
}
async cleanup() {
this.tools = [];
if (this.context?.logger) {
this.context.logger.info("HCS-2 Plugin cleaned up");
}
}
}
export {
HCS2Plugin
};
//# sourceMappingURL=index3.js.map