@promptbook/google
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
63 lines (62 loc) • 2.6 kB
TypeScript
import type { string_book } from './string_book';
/**
* One explicit `FROM` commitment written in a book.
*
* @private utility of Agents Server inheritance resolution
*/
export type ExplicitFromCommitment = {
/**
* Zero-based index of the line the commitment was found on, within the scanned lines.
*/
readonly lineIndex: number;
/**
* Trimmed commitment content, empty string for a blank `FROM`.
*/
readonly content: string;
};
/**
* Collects every explicit single-line `FROM` commitment of one book.
*
* This lightweight parser is intentionally limited to the subset needed by inheritance
* resolution so it stays safe to bundle into the Next.js proxy path.
*
* @param sourceLines - Book source already split into lines.
* @returns Found `FROM` commitments in source order, empty when the book declares no parent.
*
* @private utility of Agents Server inheritance resolution
*/
export declare function collectExplicitFromCommitments(sourceLines: ReadonlyArray<string>): ReadonlyArray<ExplicitFromCommitment>;
/**
* Returns the effective explicit `FROM` commitment of one book.
*
* A book may repeat `FROM`, in which case the last one wins and overrides every earlier one.
*
* @param agentSource - Raw book source.
* @returns The last explicit `FROM` commitment, or `undefined` when the book declares no parent.
*
* @private utility of Agents Server inheritance resolution
*/
export declare function getEffectiveExplicitFromCommitment(agentSource: string_book): ExplicitFromCommitment | undefined;
/**
* Returns the effective explicit `FROM` commitment content of one book.
*
* A book may repeat `FROM`, in which case the last one wins and overrides every earlier one.
*
* @param agentSource - Raw book source.
* @returns Trimmed commitment content, empty string for a blank explicit `FROM`, or `undefined` when `FROM` is absent.
*
* @private utility of Agents Server inheritance resolution
*/
export declare function getExplicitFromCommitmentContent(agentSource: string_book): string | undefined;
/**
* Returns true when one book declares no parent at all and therefore implicitly inherits from `@Adam`.
*
* Writing no `FROM` commitment is equivalent to writing `FROM @Adam`, so only an explicit
* `FROM @Null` / `FROM {Void}` turns the inheritance off.
*
* @param agentSource - Raw book source.
* @returns True when the implicit `@Adam` ancestor applies to this book.
*
* @private utility of Agents Server inheritance resolution
*/
export declare function isImplicitAdamInheritance(agentSource: string_book): boolean;