@sema-agent/core
Version:
Stateless, task-oriented AI agent core
42 lines (41 loc) • 3.09 kB
TypeScript
/**
* The listing frames read back from a transcript — the last rung of the announced-listing seed (under the checkpoint's
* group and the announced-listing entry): which agent types and skills, and which model catalog, the model was last told.
*
* A session's frames may have been worded by more than one reading: the run's own (its locale, the event templates its
* overlays replaced), and — for frames announced before a locale change or before a replacement reached the session — the
* canonical text or another shipped locale's. The replay recognizes a frame under each of those readings. A template
* replaced and then replaced again is not among them: a frame worded by the earlier replacement is not recognized (an
* initial frame not recognized leaves the listing to re-announce in full; a removal not recognized leaves its names
* counted as announced).
*/
import { type EngineText } from "../../prompt-assembly/engine-text.js";
/** A listing's three headers, one per reading a session's frames may have been worded by (each list deduplicated, the
* run's own reading first). */
export interface ListingReplayHeaders {
readonly initial: readonly string[];
readonly delta: readonly string[];
readonly removed: readonly string[];
}
/** A listing's headers under every replay reading, from the one-reading header function its renderer reads. */
export declare function listingReplayHeaders(headersOf: (say: EngineText) => {
readonly initial: string;
readonly delta: string;
readonly removed: string;
}, say: EngineText): ListingReplayHeaders;
/**
* [session-dedup] Rebuild the EXACT announced name-set by replaying every listing
* frame in a transcript, in order: an initial frame RESETS the set to its names, a delta frame ADDS,
* a removal frame DELETES. Header-presence alone is NOT a safe seed (it proves "announced once", not
* WHAT was announced — seeding the current entries would swallow the A→A+B delta and removal-to-zero
* on ordinary session continuations). The headers are the renderers' own, so a frame-shape change
* cannot desync the parser. A frame starts a line with its header (the reminder body opens on its own line), so a header
* text inside a line — an entry quoting it — is no frame; where headers start the same line, the longest is the frame's (a
* replaced delta header may begin with the initial one). Frames are read in text order. Returns undefined when NO frame
* exists (fresh session — announce fully).
*/
export declare function replayAnnouncedListing(texts: readonly string[], headers: ListingReplayHeaders): Set<string> | undefined;
/** Replay the ANNOUNCED model catalog from stamped transcript texts — the last carried models line wins, under any replay
* reading (the line is re-carried in full on every drift). Undefined = the catalog was never carried (unknowable — the
* drift compare stays silent, same conservative arm as an old checkpoint). */
export declare function replayAnnouncedModels(texts: readonly string[], say?: EngineText): readonly string[] | undefined;