@sema-agent/core
Version:
Stateless, task-oriented AI agent core
20 lines (19 loc) • 1.12 kB
TypeScript
/**
* The named-slot grammar of catalog text: `{{name}}`, a word between double braces. It is the one reading of
* "which slots does this text carry" and "fill them": the Cowork base renders its template through it, the engine's
* own texts are filled through it where the engine mints them, and the overlay door asks it whether a message may
* be an overlay's text.
*
* This module imports nothing, so the catalog modules and the Cowork template can both read it without a cycle.
*/
/** The slot names a text carries, in order of occurrence (a name used twice is listed twice). */
export declare function slotNames(text: string): string[];
/**
* Fill a text's slots in one pass: each `{{name}}` is replaced by `valueOf(name)`, read as written (a value is never
* scanned again, so a value carrying `{{x}}` or `$&` lands verbatim). A slot whose value is `undefined` stays as
* written and is reported in `missing`, in order of occurrence.
*/
export declare function fillSlots(text: string, valueOf: (name: string) => string | undefined): {
readonly text: string;
readonly missing: readonly string[];
};