@convo-lang/convo-lang
Version:
The language of AI
35 lines (34 loc) • 1.57 kB
TypeScript
import { CodeParsingResult } from "@iyio/common";
import { ConvoMessage } from "./convo-types.js";
/**
* Parses Convo-Lang code with caching, returning both the parsing result and cache key.
* Uses a hash-based cache to avoid re-parsing identical code strings.
*
* @param code - The Convo-Lang source code to parse
* @returns Object containing the parsing result and the cache key used
*/
export declare const parseConvoCachedKeyed: (code: string) => {
result: CodeParsingResult<ConvoMessage[]>;
key: string;
};
/**
* Parses Convo-Lang code with caching, returning only the parsing result.
* This is a convenience wrapper around parseConvoCachedKeyed for when only the result is needed.
*
* @param code - The Convo-Lang source code to parse
* @returns The parsing result containing parsed ConvoMessage array or errors
*/
export declare const parseConvoCached: (code: string) => CodeParsingResult<ConvoMessage[]>;
/**
* Parses Convo-Lang code with caching and throws an error if the code fails to parse
*/
export declare const requireParseConvoCached: (code: string) => ConvoMessage[];
/**
* Parses and caches a specific type definition from Convo-Lang code.
* Executes the parsed code to extract a named type definition and caches the result.
*
* @param typeName - The name of the type to extract from the parsed code
* @param convo - The Convo-Lang source code containing the type definition
* @returns The parsed type definition, or undefined if not found
*/
export declare const parseConvoType: (typeName: string, convo: string) => any;