UNPKG

@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.54 kB
import { HCS10Client } from '../hcs10/HCS10Client'; import { StructuredTool, ToolParams } from '@langchain/core/tools'; import { z } from 'zod'; import { Logger } from '@hashgraphonline/standards-sdk'; import { IStateManager } from '../state/state-types'; export interface ConnectionToolParams extends ToolParams { client: HCS10Client; stateManager: IStateManager; } /** * ConnectionTool monitors the *current* agent's inbound topic for connection requests * and automatically handles them using the HCS-10 standard SDK flow. * Use this ONLY to passively LISTEN for other agents trying to connect TO YOU. * This tool takes NO arguments and does NOT start outgoing connections. */ export declare class ConnectionTool extends StructuredTool { name: string; description: string; client: HCS10Client; logger: Logger; private stateManager; private isMonitoring; private monitoringTopic; schema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>; /** * @param client - Instance of HCS10Client. * @param stateManager - Instance of StateManager for shared state management. */ constructor({ client, stateManager, ...rest }: ConnectionToolParams); /** * Initiates the connection request monitoring process in the background. * Gets the inbound topic ID from the configured client. */ _call(_input: z.infer<typeof this.schema>): Promise<string>; /** * The core monitoring loop. */ private monitorIncomingRequests; stopMonitoring(): void; }