import type { ChatKitStore, StoreContext } from '../chatkit/store'; import type { RunContextRetriever, RunExecutionBackend } from '../runs/RunExecutionBackend'; import { type RunStore } from '../runs/store'; import { type WorkspaceRef } from '../workspace/types'; import { type MaterializedTaskRun } from './TaskMaterializer'; import { type TaskTriggerKindType } from './schema'; import type { TaskAuthBindingSnapshot } from './TaskAuthBinding'; import { type TaskRecordData, type TaskStore } from './store'; import type { AiConnectionsInvocationKeyIssuer } from '../ai-gateway/auth/AiConnectionsInvocationKeyIssuer'; export interface CreateTaskInput { title?: string; prompt: string; workspace: WorkspaceRef; runner?: string; triggerKind?: TaskTriggerKindType; cron?: string; intervalSeconds?: number; eventName?: string; startAt?: number; authBinding: TaskAuthBindingSnapshot; metadata?: Record; } export interface CreateTaskResult { task: TaskRecordData; run?: MaterializedTaskRun['run']; } export interface TaskServiceOptions { store: ChatKitStore & RunStore & TaskStore; executionBackend?: RunExecutionBackend; executeRuns?: boolean; contextRetriever?: RunContextRetriever; aiConnectionInvocationKeyIssuer?: Pick; requireAiConnectionsInvocationKeyIssuer?: boolean; } export declare class TaskService { private readonly store; private readonly materializer; constructor(options: TaskServiceOptions); createTask(input: CreateTaskInput, context: TContext): Promise; loadTask(taskId: string, context: TContext): Promise; listTasks(context: TContext): Promise; materializeDueTasks(context: TContext, options?: { now?: number; limit?: number; }): Promise; materializeEventTasks(input: { eventName: string; payload?: Record; context: TContext; }): Promise; private createTaskThread; private validateTrigger; private normalizeAuthBinding; private initialNextRunAt; private parseRunnerMetadata; private resolveThreadResource; private resolvePodBaseUrl; private resolveWebId; }