UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

34 lines (33 loc) • 2.49 kB
import type { FileEditedHook, TaskResult } from "../types.js"; /** The ceiling on DISTINCT FILES in a run's edited-file ledger (`TaskResult.editedFiles`). A result * seat must be bounded by something other than how long the model keeps going; a single host-side * user message that touches a thousand distinct files is already past what that observation is for. * Far above the delegated-child projection's own cap, which bounds a NOTIFICATION preview rather * than a per-message ledger — different job, different ceiling. The field's contract states this * number and the saturation behaviour, so a consumer can tell a full list from a clipped one. */ export declare const RUN_EDITED_FILES_CAP = 1000; /** A run's OWN edited-file ledger — the observation behind `TaskResult.editedFiles`. */ export interface EditedFilesLedger { /** The hands band's post-write seat feeds this (the other end of the same mutation lane the * first-touch hook sits at). */ note: FileEditedHook; /** The read face: the ledger as `TaskResult.editedFiles`, or `undefined` when this run's hands * landed nothing (the key is ABSENT then, never an empty array). A LIVE reader, read at result * assembly — so the throw-path backstop terminal sees the same ledger the ordinary assembly does. */ snapshot: () => TaskResult["editedFiles"]; } /** * Build the ledger. Built UNCONDITIONALLY by prepare — unlike the first-touch history hook, which * exists only when a history store is wired, this answers "what did this run change", a fact about * the run and not about the store. Insertion order = order of first edit; the cap keeps a result seat * bounded by something other than the model's persistence (past it, listed paths keep counting and * new ones are dropped — see the field's own contract). * * Identity is the CANONICAL key, display is the model's own spelling. The two differ, and both halves * matter: the band resolves a relative argument against the LIVE cwd, so one spelling can name two * different files across a `cd` (keying on the spelling would merge them and drop a real file from * the ledger), and two spellings can name one file (keying on the spelling would split one file into * two rows). The first spelling that reached a given file is what the row shows — the coordinate the * transcript used, which is the seat's stated path form. */ export declare function createEditedFilesLedger(cap?: number): EditedFilesLedger;