import type { AutomationEventEnvelope } from '../automations/domain/types.js'; import type { Config } from '../config/schema.js'; import { type Gate1AdmissionResult } from './repository.js'; import type { CoalescedSignal, ProactiveExecutedActionReceipt, ProactiveItem, ProactiveItemResolutionInput } from './types.js'; export interface ScoutReadOnlyContext { ref: string; kind: 'knowledge_memory' | 'attention_thread' | 'authorized_excerpt'; excerpt: string; } export interface ProactiveHubDeps { ownerId?: string; getConfig: () => Config; isConversationAvailable: (conversationId: string) => boolean; onPublishEvent?: (type: string, payload: unknown) => void; onConversationEscalated?: (conversationId: string, itemId: string, item: ProactiveItem) => void; executeApprovedAction?: (item: ProactiveItem, resolution: ProactiveItemResolutionInput) => Promise | ProactiveExecutedActionReceipt | undefined; onItemResolved?: (item: ProactiveItem) => void | Promise; readAuthorizedContext?: (signal: CoalescedSignal) => Promise | ScoutReadOnlyContext[]; callModel?: (operation: 'proactive.fast_triage' | 'proactive.readonly_scout', prompt: string, abortSignal: AbortSignal) => Promise; now?: () => number; } export declare class ProactiveHubService { private readonly deps; private draining; private stopped; private activeAbort?; constructor(deps: ProactiveHubDeps); private ownerId; private now; start(): void; stop(): void; /** Gate 1 synchronous SQL admission. Zero LLM tokens consumed here. */ ingestEvent(event: AutomationEventEnvelope): Gate1AdmissionResult; retireCoveredTaskWait(taskId: string, waitId?: string, now?: number): number; tick(): void; drain(): Promise; resolveItem(itemId: string, resolution: ProactiveItemResolutionInput, ownerId?: string): Promise; flushDigest(windowLabel?: string): ProactiveItem | null; private invokeModel; private collectReadOnlyKnowledge; private computeDisruptionPenalty; private routeTier; private processSignal; /** * Publishes ready Tier-S items into the Personal conversation only when the foreground * conversation is idle and outside quiet hours, keeping Inbox and Chat state unified. */ private deliverPendingChatEscalations; }