UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

47 lines (46 loc) • 2.79 kB
/** * Is a repeat under an already-used steer `inputId` the same instruction? ONE answer for both seats that hold a * steer under its key — the parked queue (`appendPendingSteer`) and the live verb's accepted-input domain — and that * one answer feeds the replay decision, the refusal's machine-readable `detail.differs` and its sentence. * * Both seats compare the record the CALLER sent (text, trusted, tier, actor) — never the delivered bytes: the live * delivery folds `trusted` (the framing) and the actor (the speaker label) into its payload, so comparing payloads * would report one changed facet as two. */ import type { ActorAssertion } from "../internal/llm.js"; import { type SystemInjectionPriority } from "./task-notification.js"; /** The facets a steer's replay identity is made of, in the order a refusal lists them. Closed. */ export declare const STEER_REPLAY_FACETS: readonly ["text", "trusted", "priority", "actor"]; export type SteerReplayFacet = (typeof STEER_REPLAY_FACETS)[number]; /** What a seat remembers a steer by: the caller's own statement, as validated. The parked entry and the live park * record both are this shape. An absent `priority` reads as `"next"` ({@link steerPriorityOf}). */ export interface SteerReplayRecord { readonly text: string; readonly trusted: boolean; readonly priority?: SystemInjectionPriority; readonly actor?: ActorAssertion; } /** The facets `repeat` differs from `held` in, in {@link STEER_REPLAY_FACETS} order. Empty = the idempotent replay. */ export declare function steerReplayDiffers(held: SteerReplayRecord, repeat: SteerReplayRecord): SteerReplayFacet[]; /** `steering.duplicate_input_id`'s machine-readable half: the facets, by name only (never the values). Always * present on that code, never empty. */ export interface SteerReplayRefusalDetail { readonly differs: readonly SteerReplayFacet[]; } /** Which seat refuses: the parked queue names the key it holds; the live verb answers about the caller's own key. */ export type SteerReplaySeat = { readonly seat: "parked"; readonly inputId: string; } | { readonly seat: "accepted"; }; /** * The refusal for a repeat that is not a replay, or `undefined` for one that is. When `text` differs the repeat is * another instruction and the caller is told to take a fresh key. When only the tier / trust / attribution differ it * is the SAME instruction, already accepted, whose standing receipt those facets do not change — a fresh key would * queue it a second time, so the sentence says so instead of advising one. */ export declare function steerReplayRefusal(held: SteerReplayRecord, repeat: SteerReplayRecord, where: SteerReplaySeat): { message: string; detail: SteerReplayRefusalDetail; } | undefined;