@hashgraphonline/conversational-agent
Version:
Hashgraph Online conversational AI agent implementing HCS-10 communication, HCS-2 registries, and content inscription on Hedera. https://hol.org
147 lines (146 loc) • 4.02 kB
JavaScript
import { BasePlugin } from "hedera-agent-kit";
import { Bee } from "@ethersphere/bee-js";
import { ListPostageStampsTool } from "./index48.js";
import { UploadDataTool } from "./index49.js";
import { DownloadDataTool } from "./index50.js";
import { CreatePostageStampTool } from "./index51.js";
import { ExtendPostageStampTool } from "./index52.js";
import { QueryUploadProgressTool } from "./index53.js";
import { DownloadFilesTool } from "./index54.js";
import { GetPostageStampTool } from "./index55.js";
import { ReadFeedTool } from "./index56.js";
import { UpdateFeedTool } from "./index57.js";
import { UploadFileTool } from "./index58.js";
import { UploadFolderTool } from "./index59.js";
class SwarmPlugin extends BasePlugin {
constructor(config) {
super();
this.id = "swarm";
this.name = "Swarm Plugin";
this.description = "Swarm operations: tools for interacting with the Swarm decentralized storage.";
this.version = "1.0.0";
this.author = "Solar Punk";
this.namespace = "swarm";
this.tools = [];
this.config = config || null;
}
async initialize(context) {
await super.initialize(context);
const hederaKit = context.config.hederaKit;
if (!hederaKit) {
this.context.logger.warn(
"SwarmPlugin skipped because HederaAgentKit was not present in plugin context."
);
this.tools = [];
return;
}
if (!this.config) {
this.context.logger.warn(
"SwarmPlugin skipped because Swarm config was not present."
);
this.tools = [];
return;
}
const beeURL = this.config.beeApiUrl;
const bee = new Bee(beeURL);
const createPostageStampTool = new CreatePostageStampTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const downloadDataTool = new DownloadDataTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const downloadFilesTool = new DownloadFilesTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const extendPostageStampTool = new ExtendPostageStampTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const getPostageStampsTool = new GetPostageStampTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const listPostageStampsTool = new ListPostageStampsTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const queryUploadProgressTool = new QueryUploadProgressTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const readFeedTool = new ReadFeedTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const updateFeedTool = new UpdateFeedTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const uploadDataTool = new UploadDataTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const uploadFileTool = new UploadFileTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
const uploadFolderTool = new UploadFolderTool({
hederaKit,
bee,
config: this.config,
logger: this.context.logger
});
this.tools = [
createPostageStampTool,
downloadDataTool,
downloadFilesTool,
extendPostageStampTool,
getPostageStampsTool,
listPostageStampsTool,
queryUploadProgressTool,
readFeedTool,
updateFeedTool,
uploadDataTool,
uploadFileTool,
uploadFolderTool
];
this.context.logger.info(
"Swarm Plugin initialized."
);
}
getTools() {
return this.tools;
}
async cleanup() {
this.tools = [];
}
}
export {
SwarmPlugin
};
//# sourceMappingURL=index6.js.map