UNPKG

@artinet/sdk

Version:

A TypeScript SDK for building collaborative AI agents.

60 lines (59 loc) 1.97 kB
/** * Copyright 2025 The Artinet Project * SPDX-License-Identifier: Apache-2.0 */ import { A2A } from "../types/index.js"; import { Tasks } from "../services/a2a/managers.js"; /** * File-based implementation of the TaskStore interface. * Stores tasks and their history as JSON files on disk. */ export declare class Files extends Tasks { private baseDir; /** * Creates a new FileStore. * @param baseDir The base directory to store task files in. */ constructor(baseDir: string); /** * Constructs the file path for a task. * @param taskId The task ID * @returns The full file path for the task JSON file */ private getTaskFilePath; /** * Ensures the base directory exists. * @returns A promise that resolves when the directory exists. */ private ensureBaseDir; /** * Writes data to a JSON file. * @param filePath The path to write to * @param data The data to write * @returns A promise that resolves when the write is complete */ private writeJsonFile; /** * Reads data from a JSON file. * @param filePath The path to read from * @returns A promise resolving to the parsed data, or null if the file doesn't exist */ private readJsonFile; /** * Loads a task and its history by task ID. * @param taskId The ID of the task to load. * @returns A promise resolving to the task and history, or null if not found. */ get(taskId: string): Promise<A2A.Task | undefined>; /** * Saves a task and its history. * @param data The task and history to save. * @returns A promise that resolves when the save is complete. */ set(taskId: string, task?: A2A.Task): Promise<void>; delete(taskId: string): Promise<void>; has(taskId: string): Promise<boolean>; list(): Promise<A2A.Task[]>; } export declare const FileStore: typeof Files; export type FileStore = typeof FileStore;