import type { ChatSchedule, ChatScheduleMode, ChatScheduleRule, ChatScheduleRun, ChatScheduleSkipReason, ChatScheduleStatePayload, ChatScheduleStatus, ChatScheduleStoppedBy, ChatScheduleUpdatedEvent, ChatScheduleWatchDecision, CreateChatScheduleInput, UpdateChatScheduleInput } from '@xopcai/gateway-contract'; import type { AgentSourceContext } from '../agent/source-context/types.js'; import type { WatcherEvaluationResult } from './watcher-runner.js'; export type { ChatSchedule, ChatScheduleMode, ChatScheduleRule, ChatScheduleRun, ChatScheduleSkipReason, ChatScheduleStatePayload, ChatScheduleStatus, ChatScheduleStoppedBy, ChatScheduleUpdatedEvent, ChatScheduleWatchDecision, CreateChatScheduleInput, UpdateChatScheduleInput, WatcherEvaluationResult, }; export type ChatScheduleErrorCode = 'BAD_REQUEST' | 'NOT_FOUND' | 'CONFLICT' | 'SESSION_BUSY' | 'INVALID_SCHEDULE'; export declare class ChatScheduleError extends Error { readonly code: ChatScheduleErrorCode; readonly details?: Record | undefined; constructor(code: ChatScheduleErrorCode, message: string, details?: Record | undefined); } export interface ChatScheduleSessionSnapshot { conversationId: string; transcriptId: string; } export type ChatScheduleSubmitIfIdleResult = { ok: true; sessionInputId: string; agentRunId?: string; } | { ok: false; skipReason: ChatScheduleSkipReason; }; export interface ChatScheduleServiceDeps { getSession: (conversationId: string) => ChatScheduleSessionSnapshot | null; getBusySkipReason?: (conversationId: string) => ChatScheduleSkipReason | null; runWatcherCheck?: (input: { schedule: ChatSchedule; roundNumber: number; }) => Promise; submitScheduledInputIfIdle: (input: { conversationId: string; expectedTranscriptId: string; clientMessageId: string; content: string; sourceContexts: AgentSourceContext[]; }) => Promise; onScheduleUpdated?: (event: ChatScheduleUpdatedEvent) => void; now?: () => number; }