UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

32 lines (31 loc) • 1.7 kB
/** * The request-body sugar: the one place the task's role-layer prompt inputs are read and turned into overlays of * the `task` source class. Three inputs, one expression each: * * - the role base — `TaskSpec.systemPrompt ?? resolvedRole.systemPrompt ?? internals.defaultSystemPrompt` (the * task's own text, else the role preset the task named, else the persona a core spawner hands its child) — a * `replace` of `core/role.base`, applied after the selector chose the role base's variant; * - the appended block — `TaskSpec.appendSystemPrompt` — an `add` to the `task-append` band (entry * `core/role.append`); * * and nothing else reads them for assembly (`gate:sugar-single-site`). The sugar is applied first within its class, * the task-seat mods after it. Its one possible violation is locked text: a role-layer input carrying, verbatim, * the canonical text of a `constitution` entry is an already-assembled prompt, and the task is refused by name * (`prompt.assembled_role_refused`) — never passed through, never silently dropped. */ import { type SourcedOverlay } from "./overlay.js"; /** The task's role-layer prompt inputs, as prepare holds them. */ export interface SugarInputs { readonly spec: { readonly systemPrompt?: string; readonly appendSystemPrompt?: string; }; readonly resolvedRole: { readonly systemPrompt?: string; }; readonly internals?: { readonly defaultSystemPrompt?: string; }; } /** The task-class overlays the request body carries, in application order (role base, then the appended block). */ export declare function sugarOverlays(inputs: SugarInputs): readonly SourcedOverlay[];