@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
34 lines • 2.17 kB
TypeScript
import type { FileEntry, SessionEntry } from "./session-manager.ts";
type MessageEntry = Extract<FileEntry, {
type: "message";
}>;
/**
* The out-of-band call keys of one session file (RULING-126/127, senpi#5374). The file holds `runtimeItemKey` on each
* toolCall part and `runtimeItemKey` or `callUnknown: true` on a toolResult entry; memory never does, so every legacy
* and flag-off reader keeps its bytes. Loading strips them into this table, keyed by entry id, and every write of an
* entry (append, rewrite, migration, branch, export) puts them back. An old session's parts have no key, and nothing
* mints one at load: no reader rebuilds a call from a loaded part, so a key that is not persisted would have no reader.
*/
export declare class SessionFileCallKeys {
private readonly byEntry;
clear(): void;
adopt(entries: readonly FileEntry[]): void;
/** An entry read again from the file (an evicted string's recovery): the table already holds its keys. */
strip<T extends FileEntry>(entry: T): T;
/**
* A new assistant entry: each toolCall part keyed by its block (`owner` is the message's recovery id), or by the
* key its bridge-started call carried (`bridged`, by content index).
*/
recordAssistant(entry: MessageEntry, owner: string | undefined, bridged?: ReadonlyMap<number, string>): void;
/**
* A new toolResult entry (RULING-126 (2)) appended under `leafId`: keyed only when its id names exactly one toolCall
* part of the latest assistant entry on the branch that no result after it closed, and whose key is persisted. Every
* other result (a same-message reused id, a closed call, a call with no keyed part) is `callUnknown`: the entry says
* it cannot vouch for a call, never names an order-picked one, and never carries neither field.
*/
recordResult(entry: MessageEntry, leafId: string | null, entryOf: (id: string) => SessionEntry | undefined): void;
/** The entry as the file holds it: its persisted keys back in place, after every other field. */
decorate(entry: FileEntry): FileEntry;
}
export {};
//# sourceMappingURL=session-file-call-keys.d.ts.map