import type { AutomationEventEnvelope } from '../automations/domain/types.js'; import type { Config } from '../config/schema.js'; import { type FollowUpMatter } from './matters.js'; import { type WebWatchSignalProducer } from './web-watch.js'; export interface MatterEvidenceItem { ref: string; kind: 'matter' | 'task_state' | 'project_state' | 'web_page' | 'web_error' | 'web_search' | 'proactive_signal' | 'knowledge_memory'; excerpt: string; untrusted?: boolean; } export interface MatterInvestigatorDeps { ownerId?: string; getConfig: () => Config; isConversationAvailable: (conversationId: string) => boolean; webWatchProducer?: Pick; runWebSearch?: (query: string, signal: AbortSignal) => Promise; callModel?: (operation: 'proactive.matter_investigate', prompt: string, signal: AbortSignal) => Promise; onMatterUpdated?: (matter: FollowUpMatter) => void; onPublishEvent?: (type: string, payload: unknown) => void; onChatMessageDelivered?: (conversationId: string, outreachId: string, matter: FollowUpMatter) => void; now?: () => number; } /** * Bounded, strictly read-only autonomous investigator for FollowUpMatter. * Combines live workspace/task/project snapshots, public URL checks, bounded web searches, * and recent authorized external signals into living timeline updates and actionable outreach. */ export declare class MatterInvestigatorService { private readonly deps; private scanning; private stopped; private activeAbort?; constructor(deps: MatterInvestigatorDeps); private ownerId; private now; start(): void; stop(): void; /** * When a bound external event (web change, connector signal, or task/project change) arrives, * accelerates the owning matter's nextCheckAt so it investigates promptly on the next drain. */ wakeByEvent(event: AutomationEventEnvelope): number; scanDue(limit?: number): Promise; checkNow(matterId: string, ownerId?: string): Promise; private invokeModel; private executeBoundedSearch; private collectEvidence; private deliverPersonalChatMessage; investigate(matterId: string, options?: { ownerId?: string; triggerReason?: string; force?: boolean; }): Promise; }