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.

46 lines (45 loc) 1.61 kB
import { z } from "zod"; import { BaseHCS2QueryTool } from "./standards-agent-kit.es20.js"; const queryRegistrySchema = z.object({ topicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The HCS-2 registry topic ID to query"), limit: z.number().int().positive().optional().describe("Maximum number of entries to return"), order: z.enum(["asc", "desc"]).optional().describe("Order of results (ascending or descending)"), skip: z.number().int().min(0).optional().describe("Number of entries to skip") }); class QueryRegistryTool extends BaseHCS2QueryTool { constructor() { super(...arguments); this.name = "queryHCS2Registry"; this.description = "Query entries from an HCS-2 registry"; } get specificInputSchema() { return queryRegistrySchema; } async executeQuery(params, _runManager) { const registry = await this.hcs2Builder.getRegistry(params.topicId, { limit: params.limit, order: params.order, skip: params.skip }); return { topicId: registry.topicId, registryType: registry.registryType === 0 ? "indexed" : "non-indexed", ttl: registry.ttl, totalEntries: registry.entries.length, entries: registry.entries.map((entry) => ({ sequence: entry.sequence, timestamp: entry.timestamp, payer: entry.payer, operation: entry.message.op, targetTopicId: entry.message.t_id, uid: entry.message.uid, metadata: entry.message.metadata, memo: entry.message.m })) }; } } export { QueryRegistryTool }; //# sourceMappingURL=standards-agent-kit.es26.js.map