nestjs-a2a
Version:
NestJS module for creating Google Agent to Agent Server
30 lines (29 loc) • 1.07 kB
TypeScript
import { Message, Task } from './a2a.types';
export interface TaskAndHistory {
task: Task;
history: Message[];
}
/**
* Simplified interface for task storage providers.
* Stores and retrieves both the task and its full message history together.
*/
export interface TaskStore {
/**
* Saves a task and its associated message history.
* Overwrites existing data if the task ID exists.
* @param data An object containing the task and its history.
* @returns A promise resolving when the save operation is complete.
*/
save(data: TaskAndHistory): Promise<void>;
/**
* Loads a task and its history by task ID.
* @param taskId The ID of the task to load.
* @returns A promise resolving to an object containing the Task and its history, or null if not found.
*/
load(taskId: string): Promise<TaskAndHistory | null>;
}
export declare class InMemoryTaskStore implements TaskStore {
private store;
load(taskId: string): Promise<TaskAndHistory | null>;
save(data: TaskAndHistory): Promise<void>;
}