import type { Database as DatabaseType } from 'better-sqlite3'; import type { TeepeeConfig, UserRole } from './config.js'; import type { StreamEvent } from './stream-parsers.js'; import { type JobInputRequestPayload } from './user-input/index.js'; export interface OrchestratorCallbacks { onJobStarted(topicId: number, jobId: number, agentName: string): void; onJobStream(topicId: number, jobId: number, chunk: string): void; onJobRetrying(topicId: number, jobId: number, agentName: string, attempt: number, error: string): void; onJobRoundStarted(topicId: number, jobId: number, agentName: string, round: number, phase: string): void; onJobActivity(topicId: number, jobId: number, agentName: string, event: StreamEvent): void; onJobWaitingInput(topicId: number, jobId: number, agentName: string, request: JobInputRequestPayload): void; onJobResumed(topicId: number, jobId: number, agentName: string, requestId: number, answeredByUserId: string): void; onJobCompleted(topicId: number, jobId: number, agentName: string, messageId: number): void; onJobFailed(topicId: number, jobId: number, agentName: string, error: string, options?: { timedOut?: boolean; }): void; onSystemMessage(topicId: number, messageId: number, text: string): void; onRuntimeChanged?(topicId: number): void; } export declare class Orchestrator { private db; private config; private basePath; private callbacks; private knownAgents; private sandboxRunner; private sandboxAvailable; private sandboxBackend; private schedulerDrainPromise; private schedulerNeedsRerun; private activeWriterChainRootId; private runningJobs; private readonly outputNamespace; constructor(db: DatabaseType, config: TeepeeConfig, basePath: string, callbacks: OrchestratorCallbacks); /** * Handle a new message posted by a user (inserts + orchestrates). */ handleMessage(topicId: number, userEmail: string, authorName: string, body: string): Promise; /** * Orchestrate agent jobs for an already-inserted message. */ handlePostedMessage(topicId: number, messageId: number, userEmail: string, _authorName: string, body: string): Promise; private enqueueBatch; private waitForChainToPauseOrFinish; private resolveUserRole; private getJobOutputRoot; private getJobOutputDir; private drainScheduler; private runSchedulerLoop; private startSchedulableJobs; private startJobsForScope; private startQueuedJob; private listPendingJobs; private findRunningWriterJob; private hasPendingJobsForChain; private runJob; private completeProviderJob; private runAgentWithArtifactOps; private completeJobFromResult; private commitSuccessfulJob; private failJob; private insertSystemMessage; private pauseJobForUserInput; resumeJobFromUserInput(requestId: number, responderUserId: string, responsePayload: unknown): Promise<{ topicId: number; jobId: number; agentName: string; requestId: number; answeredByUserId: string; }>; cancelJobFromUserInput(requestId: number, actorUserId: string, actorRole: UserRole): Promise<{ topicId: number; jobId: number; }>; private runResumedJob; private maybeExecuteChains; } //# sourceMappingURL=orchestrator.d.ts.map