Skip to main content

@svatah/yam-recorder

Grounding, record session and report

Exports

ExportKindSignature
assertRecordablefunctionexport function assertRecordable(options:Throws unless recording here is allowed. Called once per session, and here.
capturefunctionexport async function capture(options: CaptureOptions): Promise<CaptureOutcome>Run a capture on an open session until the signal aborts or the session closes.
CaptureOptionsinterfaceexport interface CaptureOptions
CaptureOutcomeinterfaceexport interface CaptureOutcome
DEFAULT_MAX_SNAPSHOT_TOKENSvariableDEFAULT_MAX_SNAPSHOT_TOKENS = 8_000
DEFAULT_MIN_CONFIDENCEvariableDEFAULT_MIN_CONFIDENCE = 0.5
entryForfunctionexport async function entryFor(A binding entry for an element a person chose (T5.7, REQ-ADE-4).
EnvironmentRefusedclassexport class EnvironmentRefused extends ErrorRecording against production is refused (REQ-AUTO-7, LLD §11).
groundfunctionexport async function ground(
GROUNDING_THRESHOLDvariableGROUNDING_THRESHOLD = 0.95
GroundingAnswertypealiasexport type GroundingAnswer = z.infer<typeof groundingAnswerSchema>;
groundingAnswerSchemavariablegroundingAnswerSchema = zThe answer shape. ref is a reference from the snapshot, or null.
GroundingCaseinterfaceexport interface GroundingCase
GroundingDecisioninterfaceexport interface GroundingDecisionEverything one grounding decision produced, for the record report (REQ-REC-8).
GroundingEvalOptionsinterfaceexport interface GroundingEvalOptions
GroundingEvalOutcometypealiasexport type GroundingEvalOutcome
GroundingEvalReportinterfaceexport interface GroundingEvalReport
GroundingEvalResultinterfaceexport interface GroundingEvalResult
GroundingProposalinterfaceexport interface GroundingProposalWhat a reviewer is shown for one target (REQ-ADE-4).
GroundingQuestionPartsinterfaceexport interface GroundingQuestionParts
GroundingResultinterfaceexport interface GroundingResult
GroundingTargetinterfaceexport interface GroundingTarget
GroundOptionsinterfaceexport interface GroundOptions
groundSiteToolfunctionexport async function groundSiteTool(The binding for a target the page declares as a site tool.
inputNameForfunctionexport function inputNameFor(phrase: string): stringAn input name for a phrase: the password fieldpassword.
pathOffunctionexport function pathOf(url: string): stringThe path a person would write: http://host/login?x=1/login.
phraseForfunctionexport function phraseFor(description: ElementDescription): stringThe target phrase for an element, as a person would say it.
phraseFromIdfunctionexport function phraseFromId(id: string): stringlogin.username-field → "the username field".
PluginOptionsinterfaceexport interface PluginOptions extends Omit<GroundOptions, "gateway" | "snapshot">Everything both plugins need. The caller supplies the gateway and the config.
PROMPT_VERSIONvariablePROMPT_VERSION = "g-1"Bumped whenever SYSTEM changes. Recorded in every binding's provenance.
prunefunctionexport function prune(snapshot: Snapshot, options: PruneOptions): PrunedSnapshotPrune a snapshot to a token budget.
PrunedSnapshotinterfaceexport interface PrunedSnapshot
PruneOptionsinterfaceexport interface PruneOptions
questionfunctionexport function question(parts: GroundingQuestionParts): stringThe volatile half: this step, this page.
recordfunctionexport async function record(options: RecordSessionOptions): Promise<RecordReport>
RecordedStepinterfaceexport interface RecordedStepOne step of the session, as the report records it (REQ-REC-8).
recorderBindGrounderfunctionexport function recorderBindGrounder(options: PluginOptions):bind()'s record mode (LLD §6.5).
recorderRegrounderfunctionexport function recorderRegrounder(options: PluginOptions):The healer's Regrounder (LLD §10, REQ-HEAL-1's model half).
RecordReportinterfaceexport interface RecordReport
RecordSessionOptionsinterfaceexport interface RecordSessionOptions
renderCapturedFlowfunctionexport function renderCapturedFlow(outcome: Pick<CaptureOutcome, "story" | "steps" | "inputs">, about: { readonly baseUrl?: string; readonly at?: Date }): strinThe flow file for a captured story.
renderGroundingEvalMarkdownfunctionexport function renderGroundingEvalMarkdown(report: GroundingEvalReport): string
renderGroundingEvalSummaryfunctionexport function renderGroundingEvalSummary(report: GroundingEvalReport): stringWhat yam eval grounding prints.
renderReportfunctionexport function renderReport(report: RecordReport): stringWhat yam record prints when it finishes.
reportJsonfunctionexport function reportJson(report: RecordReport): stringThe file written beside the bindings (REQ-REC-9).
ReviewDecisiontypealiasexport type ReviewDecision What the reviewer said (REQ-ADE-4).
runGroundingEvalfunctionexport async function runGroundingEval(
segmentOffunctionexport function segmentOf(url: string | undefined): stringThe page segment of an element id, from where the element was: /loginlogin, /home.
storyOrderfunctionexport function storyOrder(plan: Plan, options: RecordSessionOptions): string[]The order the run blocks give, narrowed by --flow and --story.
STRUCTURAL_ROLESvariableSTRUCTURAL_ROLES: ReadonlySet<string> = new Set([Roles that give an element its address rather than being the answer.
SYSTEMvariableSYSTEM = You are grounding a plain-language target phrase to one element of a user interface.`The instruction block. Stable, cached, and versioned.