@hashgraphonline/standards-agent-kit
Version:
A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.
41 lines (40 loc) • 1.74 kB
JavaScript
import { z } from "zod";
import { BaseHCS10TransactionTool } from "./standards-agent-kit.es7.js";
const InitiateConnectionZodSchema = z.object({
targetAccountId: z.string().describe(
"The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with."
),
disableMonitor: z.boolean().optional().describe(
"If true, does not wait for connection confirmation. Returns immediately after sending the request."
),
memo: z.string().optional().describe(
'Optional memo to include with the connection request (e.g., "Hello from Alice"). If not provided, defaults to "true" or "false" based on monitoring preference.'
)
});
class InitiateConnectionTool extends BaseHCS10TransactionTool {
constructor(params) {
super(params);
this.name = "initiate_connection";
this.description = "ONLY use this to START a BRAND NEW connection to an agent you have NEVER connected to before. If you already have an active connection to this agent, use send_message_to_connection instead. This creates a new connection request and waits for acceptance.";
this.specificInputSchema = InitiateConnectionZodSchema;
this.neverScheduleThisTool = true;
this.requiresMultipleTransactions = true;
}
async callBuilderMethod(builder, specificArgs) {
const hcs10Builder = builder;
const params = {
targetAccountId: specificArgs.targetAccountId
};
if (specificArgs.disableMonitor !== void 0) {
params.disableMonitor = specificArgs.disableMonitor;
}
if (specificArgs.memo !== void 0) {
params.memo = specificArgs.memo;
}
await hcs10Builder.initiateConnection(params);
}
}
export {
InitiateConnectionTool
};
//# sourceMappingURL=standards-agent-kit.es10.js.map