@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
20 lines (18 loc) • 621 B
text/typescript
import { z } from 'zod';
/**
* Validates content reference format
*/
export const contentRefSchema = z
.string()
.regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format "content-ref:[alphanumeric-id]"')
.describe('Content reference in format "content-ref:[id]"');
/**
* Validates content reference or returns error for dumber models
*/
export function validateContentRef(input: string): string {
try {
return contentRefSchema.parse(input);
} catch (error) {
throw new Error(`Invalid content reference format. Expected "content-ref:[alphanumeric-id]" but got "${input}"`);
}
}