import type { BackgroundTask, LaunchInput, BackgroundTaskConfig } from './types'; export declare class BackgroundManager { private readonly client; private readonly tasks; private readonly queues; private readonly processing; private readonly pollingTimers; private readonly lastPollResult; private readonly concurrencyManager; private readonly taskTTL; private readonly staleTimeout; private readonly minStabilityTime; /** * Initialize background manager with client and configuration * 使用客户端和配置初始化后台管理器 */ constructor(client: unknown, config?: BackgroundTaskConfig); /** * Launch a new background task * 启动新的后台任务 */ launch(input: LaunchInput): BackgroundTask; /** * Get a background task by ID * 通过 ID 获取后台任务 */ getTask(taskId: string): BackgroundTask | undefined; /** * Cancel a specific background task * 取消特定的后台任务 */ cancelTask(taskId: string): boolean; /** * Cancel all background tasks (optionally filtered by parent session) * 取消所有后台任务(可选择按父会话过滤) */ cancelAll(parentSessionID?: string): number; /** * Get all background tasks for a parent session * 获取父会话的所有后台任务 */ getTasksByParent(parentSessionID: string): BackgroundTask[]; /** * Process the next item in a concurrency queue * 处理并发队列中的下一个项目 */ private processKey; /** * Start executing a background task * 开始执行后台任务 */ private startTask; /** * Poll a background task for completion or timeout * 轮询后台任务以检查完成或超时 */ private pollTask; /** * Generate a concurrency key based on agent and model information * 根据代理和模型信息生成并发键 */ private getConcurrencyKey; /** * Generate a unique task ID * 生成唯一的任务 ID */ private generateId; }