@sema-agent/core
Version:
Stateless, task-oriented AI agent core
43 lines (42 loc) • 2.89 kB
TypeScript
/**
* Event prompt registry (stage S5; protocol §5.3) — the typed catalog of every runtime
* message-injection kind: its carrier, trust, dedupe semantics, byte budget and DEFAULT policy.
* Mechanism/copy separation: the registry owns the MECHANISM row (who fires, how it dedupes,
* where it rides); the render functions stay where they live (turn-attachments.ts / runtask.ts,
* next to their attribution comments — the S1 indexing posture). Behavior-zero slice: the rows
* below DESCRIBE the shipped behavior byte-for-byte; the default-policy matrix is consumed live
* by the run loop (single source for the M12 attachment-default carve-out).
*/
import type { PromptCarrier, PromptTrust } from "./types.js";
/** Dedupe/replay semantics of one event kind (protocol §5.3). */
export type EventDedupe = "once-per-epoch" | "once-per-run" | "replace-by-key" | "repeat";
/** Default mount policy (plan M12): `on` = fires unless explicitly disabled (the [c209-C] Q2
* carve-out pair — the listing frames are the ONLY roster/skills carrier); `off` = fires only
* when the task opts in (the 133 attachment-family constitution: new injection surfaces never
* disturb existing deployments by default); `always` = not policy-gated (mechanism lanes). */
export type EventDefaultPolicy = "on" | "off" | "always";
export interface CompiledEventPrompt {
/** Event kind — attachment kinds reuse the AttachmentSource wordlist verbatim. */
kind: string;
carrier: PromptCarrier;
trust: PromptTrust;
dedupe: EventDedupe;
/** Byte budget note: attachment kinds share the 8KB boundary cap (evidence-strength ordered);
* a per-kind number here is the kind's OWN clamp where one exists. */
maxBytes?: number;
defaultPolicy: EventDefaultPolicy;
/** Where the renderer lives (index, not a copy — attribution comments stay at the source). */
rendererRef: string;
}
/** The shipped registry. Rows mirror the live behavior exactly (S5 is formalization, not change):
* - carrier: every boundary attachment + first-frame listing rides the user turn wrapped in a
* single-point `<system-reminder>` shell (`message.user-prefix` on the first frame, user-turn
* steer afterwards — both are the user-prefix carrier class);
* - trust: bodies are engine-rendered (operator) except where the content embeds external text
* (mcp instructions — fenced/sanitized by the renderer, marked external);
* - defaultPolicy: the M12 matrix (runtask.ts attachment-config derivation, single-sourced here).
*/
export declare const EVENT_PROMPT_REGISTRY: ReadonlyMap<string, CompiledEventPrompt>;
/** The M12 default matrix, single-sourced: is this attachment kind on when the task supplies no
* `attachments` config? (Live consumer: the run loop's attachment-config derivation.) */
export declare function eventDefaultOn(kind: string): boolean;