@convo-lang/convo-lang
Version:
The language of AI
31 lines (30 loc) • 1.74 kB
TypeScript
import { CodeParser, CodeParsingResult } from '@iyio/common';
import { ConvoImportMatch, ConvoMessage, ConvoParsingOptions, ConvoStatement, ConvoTrigger, InlineConvoParsingOptions, InlineConvoPrompt } from "./convo-types.js";
export declare const parseConvoCode: CodeParser<ConvoMessage[], ConvoParsingOptions>;
/**
* Parses a message trigger tag value to extract the trigger action and optional condition.
* Supports syntax like "replace condition" or "append" where the condition is optional.
*
* @param eventName - Name of the event the trigger will listen to
* @param fnName - The name of the function to be called by the trigger
* @param condition - string condition. Should start with a `=` character or the condition will be ignored
* @param role - The message role that will trigger this function
* @returns Parsed ConvoMessageTrigger object, or undefined if parsing fails
*/
export declare const parseConvoMessageTrigger: (eventName: string, fnName: string, condition: string, role?: string) => CodeParsingResult<ConvoTrigger>;
export declare const parseInlineConvoPrompt: (content: string | ConvoStatement, options?: InlineConvoParsingOptions) => CodeParsingResult<InlineConvoPrompt>;
export declare const doesConvoContentHaveMessage: (content: string) => boolean;
/**
* Parses a ConvoImportMatchThe match value can use wild cards are be a regular expression.
* Regular expressions start with a (!) followed by a space then the regular expression pattern.
*
* * @example // By path
* ./company-policies.md
*
* @example // wildcard
* *policies.md
*
* @example // regular expression
* ! policies\.(md|mdx)$
*/
export declare const parseConvoImportMatch: (value: string) => CodeParsingResult<ConvoImportMatch>;