UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

43 lines (42 loc) • 2.46 kB
import type { LegModBus } from "./mods/stations.js"; /** The named sections whose entries the host may dispose of — a closed set (the event's `name`). */ export declare const DISPOSABLE_PROMPT_SECTIONS: readonly ["core/discovery.mcp-instructions"]; export type DisposablePromptSection = (typeof DISPOSABLE_PROMPT_SECTIONS)[number]; /** One entry of a named section, as the engine computed it, before it reaches the model. */ export interface PromptSectionEntry { readonly section: DisposablePromptSection; /** The entry's key within the section: the MCP server's declared name. */ readonly server: string; /** The text the engine would place: the server's `instructions`, already neutralized. */ readonly text: string; /** The tools this leg mounted from that server, by their namespaced names. */ readonly mountedTools: readonly string[]; } /** Who wrote the text an entry carries into the model's view. */ export type PromptSectionAuthor = "server" | "host"; /** One server's entry of the MCP instructions section as the run carries it, after the host's disposition. */ export interface McpInstructionsEntry { readonly server: string; readonly text: string; readonly author: PromptSectionAuthor; } /** What one disposition leaves in the run: the entry's text and author, absent when dropped, plus the defect * sentence when an answer could not be taken. */ export interface DisposedSectionEntry { readonly kept?: { readonly text: string; readonly author: PromptSectionAuthor; }; readonly defect?: string; } /** The disposition the dial reads: one entry in, its disposition out. */ export type PromptSectionDisposer = (entry: PromptSectionEntry) => Promise<DisposedSectionEntry>; /** * The disposer over the leg's bus, or undefined when no handler hangs on `prompt.section` (the dial then keeps * every entry as computed, with nothing raised). */ export declare function sectionDisposerOf(bus: LegModBus | undefined, signal?: AbortSignal): PromptSectionDisposer | undefined; /** One entry's disposition at its dial: the leg's disposer when one is wired, else the entry as the engine computed it. */ export declare function disposeSectionEntry(disposer: PromptSectionDisposer | undefined, entry: PromptSectionEntry): Promise<DisposedSectionEntry>; /** The operator warning for an answer the station could not take. */ export declare function sectionAnswerWarning(defect: string): Error;