@hashgraphonline/conversational-agent
Version:
Hashgraph Online conversational AI agent implementing HCS-10 communication, HCS-2 registries, and content inscription on Hedera
83 lines (82 loc) • 2.29 kB
JavaScript
import { BasePlugin } from "hedera-agent-kit";
import { InscriberBuilder, InscribeFromUrlTool, InscribeFromFileTool, InscribeFromBufferTool, InscribeHashinalTool, RetrieveInscriptionTool } from "@hashgraphonline/standards-agent-kit";
class InscribePlugin extends BasePlugin {
constructor() {
super(...arguments);
this.id = "inscribe";
this.name = "Inscribe Plugin";
this.description = "Content inscription tools for storing data on Hedera Consensus Service";
this.version = "1.0.0";
this.author = "Hashgraph Online";
this.namespace = "inscribe";
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. Inscription tools will not be available."
);
return;
}
try {
this.initializeTools();
this.context.logger.info(
"Inscribe Plugin initialized successfully"
);
} catch (error) {
this.context.logger.error(
"Failed to initialize Inscribe plugin:",
error
);
}
}
initializeTools() {
const hederaKit = this.context.config.hederaKit;
if (!hederaKit) {
throw new Error("HederaKit not found in context config");
}
const inscriberBuilder = new InscriberBuilder(hederaKit);
this.tools = [
new InscribeFromUrlTool({
hederaKit,
inscriberBuilder,
logger: this.context.logger
}),
new InscribeFromFileTool({
hederaKit,
inscriberBuilder,
logger: this.context.logger
}),
new InscribeFromBufferTool({
hederaKit,
inscriberBuilder,
logger: this.context.logger
}),
new InscribeHashinalTool({
hederaKit,
inscriberBuilder,
logger: this.context.logger
}),
new RetrieveInscriptionTool({
hederaKit,
inscriberBuilder,
logger: this.context.logger
})
];
}
getTools() {
return this.tools;
}
async cleanup() {
this.tools = [];
if (this.context?.logger) {
this.context.logger.info("Inscribe Plugin cleaned up");
}
}
}
export {
InscribePlugin
};
//# sourceMappingURL=index4.js.map