@sema-agent/core
Version:
Stateless, task-oriented AI agent core
29 lines (28 loc) • 2.35 kB
TypeScript
/**
* What a session has been told through the throat's fact keys (`deliverEngineNotice`'s `told`): `has` — was the fact already told;
* `add` — it was told now; `release` — its fact ended, so a later notice of it is told again. Keys are `EngineNotice.factKey` values,
* and a key is a path (above). Releasing a subject releases every fact under it ({@link factUnder}); releasing one fact releases that
* fact alone. The run's implementation is the session's announced record (`announce-once-ledger.ts`); a caller with no session record
* uses an in-memory one of the same type.
*/
export interface NoticeTold {
has(key: string): boolean;
add(key: string): void;
release(key: string): void;
}
/** Whether the told entry `entry` is the fact `key` or lies under it as a subject's variant: what `release(key)` takes out of a record. */
export declare function factUnder(entry: string, key: string): boolean;
/** Stable digest of one announcement: `sha256(lane \n text)` as hex — the one form of every digest a session's announced record
* holds (the record's own once-arms, and the throat's fact keys). Opaque on the wire; only ever compared for equality. */
export declare function announceDigest(lane: string, text: string): string;
/** The fact key of a notice of `code` over a `detail` as it leaves the throat: the digest of its {@link NOTICE_FACT_KEY} row's subject
* members' values, and, for a row with variant members, `.` and the digest of theirs — a path, so ending a subject takes every
* fact under it ({@link factUnder}). `undefined` for a code with no row. */
export declare function factKeyOver(code: string, passed: Record<string, unknown> | undefined): string | undefined;
/**
* THE ONE verb for the end of a fact, called by the station that judges it when a pass finds the fact no longer holding: every fact
* of `code` under this subject (its row's subject members, minted but not yet passed — the same text pass the throat applies) is
* released from `told`, so the next time it holds the throat tells it again. A fact that keeps holding is never released, so it is
* told once; one that holds, ends and holds again is told twice. A code with no row has no fact to end.
*/
export declare function endNoticeFact(told: NoticeTold, code: string, subject: Readonly<Record<string, string>>): void;