@promptbook/google
Version:
Promptbook: Turn your company's scattered knowledge into AI ready books
107 lines (106 loc) • 3.47 kB
TypeScript
import { string_javascript_name } from '../../_packages/types.index';
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
/**
* Memory record returned by runtime adapters.
*
* @private internal MEMORY commitment types
*/
export type MemoryToolRecord = {
id?: string;
content: string;
isGlobal: boolean;
createdAt?: string;
updatedAt?: string;
};
/**
* Runtime context for MEMORY tools resolved from hidden tool arguments.
*
* @private internal MEMORY commitment types
*/
export type MemoryToolRuntimeContext = {
readonly enabled: boolean;
readonly userId?: number;
readonly username?: string;
readonly agentId?: string;
readonly agentName?: string;
readonly isTeamConversation: boolean;
readonly isPrivateMode: boolean;
};
/**
* Runtime adapter interface used by MEMORY tools.
*
* @private internal MEMORY commitment types
*/
export type MemoryToolRuntimeAdapter = {
retrieveMemories(args: {
query?: string;
limit?: number;
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord[]>;
storeMemory(args: {
content: string;
isGlobal: boolean;
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord>;
updateMemory(args: {
memoryId: string;
content: string;
isGlobal?: boolean;
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord>;
deleteMemory(args: {
memoryId: string;
}, runtimeContext: MemoryToolRuntimeContext): Promise<{
id?: string;
}>;
};
/**
* Sets runtime adapter used by MEMORY commitment tools.
*
* @private internal runtime wiring for MEMORY commitment
*/
export declare function setMemoryToolRuntimeAdapter(adapter: MemoryToolRuntimeAdapter | null): void;
/**
* MEMORY commitment definition
*
* The MEMORY commitment is similar to KNOWLEDGE but has a focus on remembering past
* interactions and user preferences. It helps the agent maintain context about the
* user's history, preferences, and previous conversations.
*
* Example usage in agent source:
*
* ```book
* MEMORY User prefers detailed technical explanations
* MEMORY Previously worked on React projects
* MEMORY Timezone: UTC-5 (Eastern Time)
* ```
*
* @private [🪔] Maybe export the commitments through some package
*/
export declare class MemoryCommitmentDefinition extends BaseCommitmentDefinition<'MEMORY' | 'MEMORIES'> {
constructor(type?: 'MEMORY' | 'MEMORIES');
get requiresContent(): boolean;
/**
* Short one-line description of MEMORY.
*/
get description(): string;
/**
* Icon for this commitment.
*/
get icon(): string;
/**
* Markdown documentation for MEMORY commitment.
*/
get documentation(): string;
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
/**
* Gets human-readable titles for MEMORY tool functions.
*/
getToolTitles(): Record<string_javascript_name, string>;
/**
* Gets MEMORY tool function implementations.
*/
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
}
/**
* Note: [💞] Ignore a discrepancy between file name and entity name
*/