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. https://hol.org

49 lines (46 loc) 1.8 kB
import { z } from "zod"; import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js"; const QueryDynamicRegistrySchema = z.object({ topicId: z.string().describe("The registry topic ID to query"), limit: z.number().optional().default(100).describe("Maximum number of entries to retrieve"), order: z.enum(["asc", "desc"]).optional().default("desc").describe("Order of entries (desc shows latest first)"), skip: z.number().optional().describe("Number of entries to skip") }); class QueryDynamicRegistryTool extends BaseHCS6QueryTool { constructor(params) { super(params); this.name = "queryDynamicRegistry"; this.description = "Query a dynamic registry to get the current state of a dynamic hashinal"; } get specificInputSchema() { return QueryDynamicRegistrySchema; } async executeQuery(params, _runManager) { const registry = await this.hcs6Builder.getRegistry(params.topicId, { limit: params.limit, order: params.order, skip: params.skip }); const latestEntry = registry.latestEntry ? { topicId: registry.latestEntry.message.t_id, timestamp: registry.latestEntry.timestamp, memo: registry.latestEntry.message.m, sequence: registry.latestEntry.sequence, payer: registry.latestEntry.payer } : null; return `Successfully queried dynamic registry! Registry Topic: ${registry.topicId} Registry Type: NON_INDEXED TTL: ${registry.ttl} seconds Total Entries: ${registry.entries.length}${latestEntry ? ` Latest Entry: - Topic ID: ${latestEntry.topicId} - Timestamp: ${latestEntry.timestamp} - Memo: ${latestEntry.memo || "N/A"} - Sequence: ${latestEntry.sequence}` : "\n\nNo entries found in registry."}`; } } export { QueryDynamicRegistryTool }; //# sourceMappingURL=standards-agent-kit.es34.js.map