@sema-agent/core
Version:
Stateless, task-oriented AI agent core
54 lines (53 loc) • 3.81 kB
TypeScript
/**
* The person's account of a role seat the engine stands in for (`config.entries_not_applied`, kind `model_word_unknown`; before
* 7.70.0 the code `model.role_defaulted`).
*
* A role seat that names a model word the deployment's catalog does not hold supplies no model: the roles family reads it as an unset
* seat (`seatRead`, `src/core/roles.ts` — the tier default and the fallback chain follow; a subagent seat falls to the parent's model),
* so the run goes on instead of refusing at every prepare. That is only honest when it is said: this prepare-time phase names each such
* seat once per conversation, from the SAME role maps (the merged deployment-and-task map, and the deployment's own map that a delegated child's
* seat reads) and the SAME catalog the reads use (`unheldRoleSeats`), whether or not a
* later read of this leg reaches the seat. `default` (the main model's seat) and `classifier` (its own stand-in and line,
* `classifier.role_defaulted`) are never named here.
*
* The word may be a TIER the deployment's tiers leave absent (nothing bound at that tier or below it, #2614): the same reading and the same
* chain, with `reason: "tier_unbound"` where a name the catalog does not hold says `"unknown_model_ref"` (the `summarize` line says "or the tier
* default for that role" only while that role's own tier default is bound, whatever the cause: with none declared or none bound there, the
* compaction pass is on the conversation's own model). A role whose own tier DEFAULT is absent while its seat names nothing is said nowhere — nothing was stated that went unmet; the
* walk goes on to the next role of its chain (`roleHop`, `src/core/roles.ts`).
*
* Root legs only: a delegated child inherits the deployment's maps and would repeat the parent's line once per spawn.
*/
import { type EngineNotice } from "../engine-notice.js";
import { type ModelRoles, type UnheldRoleSeat } from "../roles.js";
import type { Model } from "../types.js";
import { type AnnounceOnceLedger } from "./announce-once-ledger.js";
/** The notice for one unheld seat. `word` is bounded and quoted as every refusal of this family quotes it. The cause (`reason`) is the seat's
* own (`UnheldRoleSeat.cause`, told once in `src/core/roles.ts`): a name the catalog does not hold, or a tier the deployment's tiers leave
* absent — the same reading and the same fallback chain, said in the words of what is missing. */
export declare function roleDefaultedNotice(u: UnheldRoleSeat, ids: {
sessionId: string;
runId?: string;
}): EngineNotice;
export interface AnnounceRoleSeatsInput {
/** borrowed-readonly — the rebound spec's role map (the task's own seats). */
spec: {
roles?: ModelRoles;
};
/** borrowed-readonly — the deployment's maps and the catalog the reads ask, and the notice sink. */
deps: {
models?: Record<string, Model>;
roles?: ModelRoles;
onNotice?: (notice: EngineNotice) => void;
};
/** borrowed-readonly — the once-per-session ledger the notice's dedupe rides. */
onceLedger: Pick<AnnounceOnceLedger, "oncePerSession">;
/** borrowed-readonly — true for the root leg of a conversation; a delegated child names nothing (its parent already did). */
rootLeg: boolean;
sessionId: string;
runId: string | undefined;
}
/** The phase: one line per unheld seat per conversation (the dedupe key is the seat, the word and the cause, so a seat re-pointed at another
* unknown word is said again, and so is a word whose cause changed — a tier that was no tier of the deployment, then an absent one after a
* swap — the remedy its first line named no longer being the right one). */
export declare function announceRoleSeatsDefaulted(input: AnnounceRoleSeatsInput): void;