@sema-agent/core
Version:
Stateless, task-oriented AI agent core
20 lines (19 loc) • 1.6 kB
TypeScript
import { ENGINE_MESSAGES } from "./catalog/engine.js";
import { ENVIRONMENT_MESSAGES } from "./catalog/environment.js";
import { EVENT_MESSAGES } from "./catalog/events.js";
import { type PromptLocale } from "./catalog/schema.js";
export type EngineTextId = (typeof ENVIRONMENT_MESSAGES)[number]["id"] | (typeof ENGINE_MESSAGES)[number]["id"] | (typeof EVENT_MESSAGES)[number]["id"];
export type EngineTextSlots = Readonly<Record<string, string>>;
/** The reading: a message's text with exactly the slots it carries filled from `slots`. */
export type EngineText = (id: EngineTextId, slots?: EngineTextSlots) => string;
/** A run's event templates as its overlays left them — event message id → the replacing text. The assembly writes it
* (at prepare, and again when a compaction boundary adopts another center layer); the run's reading reads it per call. */
export interface ReplacedTemplates {
readonly current: ReadonlyMap<string, string>;
}
/** The reading of the catalog in `locale` (absent ⇒ `canonical`): one function per locale, every call. With `replaced`,
* the run's own reading: the locale's, with the event templates the run's overlays replaced. */
export declare function engineTextFor(locale?: PromptLocale | undefined, replaced?: ReplacedTemplates): EngineText;
/** Every reading the catalog ships (canonical, then each rendered locale's): a frame recognized in a transcript may have
* been worded by any of them (a session resumed under another locale); a locked frame's words have no other reading. */
export declare function shippedReadings(): readonly EngineText[];