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.

51 lines (50 loc) 1.79 kB
import { z } from "zod"; import { BaseHCS6QueryTool } from "./standards-agent-kit.es27.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"; this.schema = QueryDynamicRegistrySchema; } async _call(params) { try { const registry = await this.hcs6Builder.getRegistry(params.topicId, { limit: params.limit, order: params.order, skip: params.skip }); return { status: "success", data: { topicId: registry.topicId, registryType: "NON_INDEXED", ttl: registry.ttl, 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, totalEntries: registry.entries.length } }; } catch (error) { return { status: "error", message: error instanceof Error ? error.message : "Unknown error" }; } } } export { QueryDynamicRegistryTool }; //# sourceMappingURL=standards-agent-kit.es31.js.map