@sema-agent/core
Version:
Stateless, task-oriented AI agent core
23 lines (22 loc) • 1.58 kB
TypeScript
import type { MemoryBackend, MemoryEntry } from "./types.js";
/** One read of the face: the shadow text (absent when there is none), or the fault with the error the face threw. */
export type CommittedShadowRead = {
readonly fault: false;
readonly content?: string;
} | {
readonly fault: true;
readonly error: Error;
};
/** The committed shadow of `id` bound in one of `scopes`, read through the backend's own face (never a path re-derived by
* the caller). A backend without the face answers no shadow. */
export declare function committedShadowOrFault(backend: MemoryBackend, id: string, scopes: readonly string[] | null): CommittedShadowRead;
/** The committed content of `id` held in one of `scopes`: `face`'s answer (`undefined` where the plane is the store — the
* shadow is then the committed copy), else the shadow. An entry `face` answers outside `scopes` is no copy (the shadow is
* not asked). `fault: true` = a read threw and no shadow answered. */
export declare function committedCopyOrFault(backend: MemoryBackend, id: string, scopes: readonly string[], face: Pick<MemoryBackend, "getByIds"> | undefined): Promise<{
content?: string;
fault: boolean;
}>;
/** The committed frontmatter of `id` wherever the store holds it, read like {@link committedCopyOrFault}; a faulted
* `face` falls to the shadow, a faulted shadow throws (the original error). */
export declare function committedFrontmatterOf(backend: MemoryBackend, id: string, face: Pick<MemoryBackend, "getByIds"> | undefined): Promise<MemoryEntry["frontmatter"] | undefined>;