@promptbook/google
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
74 lines (73 loc) • 2.69 kB
TypeScript
import type { string_agent_url } from '../../types/string_agent_url';
import type { string_book } from './string_book';
import type { AgentReferenceResolver } from './AgentReferenceResolver';
/**
* Shared options for resolving one agent source with inheritance and imports applied.
*
* @private internal utility of agent source resolution
*/
export type ResolveInheritedAgentSourceOptions = {
/** Current recursion depth, forwarded to the source importer. */
readonly recursionLevel?: number;
/**
* The URL of the Adam agent to use as the default ancestor
*
* @default 'https://core.ptbk.io/agents/adam'
*/
readonly adamAgentUrl?: string_agent_url;
/**
* Custom resolver used to expand compact agent references.
*/
readonly agentReferenceResolver?: AgentReferenceResolver;
/**
* Canonical URL of the currently resolved agent.
*/
readonly currentAgentUrl?: string_agent_url;
/**
* Additional equivalent URLs that should be treated as the current agent while detecting cycles.
*/
readonly currentAgentAliases?: ReadonlyArray<string_agent_url>;
/**
* Already visited agent URLs in the current resolution stack.
*/
readonly inheritancePath?: ReadonlyArray<string_agent_url>;
/**
* Source importer supplied by the host application.
*/
readonly agentSourceImporter: AgentSourceImporter;
};
/**
* Context passed to a custom agent source importer.
*
* @private internal utility of agent source resolution
*/
export type AgentSourceImporterContext = {
/**
* Commitment that requested the imported source.
*/
readonly commitmentType: 'FROM' | 'IMPORT';
/**
* Import options propagated from the current resolution pass.
*/
readonly importAgentOptions: {
readonly recursionLevel?: number;
readonly inheritancePath?: ReadonlyArray<string_agent_url>;
};
};
/**
* Loads and recursively resolves one referenced agent using the caller's transport.
*
* @private internal utility of agent source resolution
*/
export type AgentSourceImporter = (agentUrl: string_agent_url, context: AgentSourceImporterContext) => Promise<string_book>;
/**
* Resolves agent source with inheritance (FROM commitment)
*
* It recursively fetches the parent agent source and merges it with the current source.
*
* @param agentSource The initial agent source
* @returns The resolved agent source with inheritance applied
*
* @private internal utility of agent source resolution
*/
export declare function resolveInheritedAgentSource(agentSource: string_book, options: ResolveInheritedAgentSourceOptions): Promise<string_book>;