import type { Config } from '../config/schema.js'; import type { ProjectService } from '../projects/project-service.js'; import type { SessionIndex } from '../session/manager.js'; import type { UnderstandingSourceItem } from '../user-context/sources/types.js'; import type { DeepUnderstandingConfirmationInput, DeepUnderstandingRun, WorkDiscoveryCandidate, WorkDiscoveryOnboardingState, WorkDiscoveryRecognitionDecision, WorkDiscoveryRun, WorkDiscoverySource } from './types.js'; export type ModelProcessingPolicy = 'local_only' | 'remote_allowed'; /** Sanitize and round-robin local sources so one verbose source cannot starve the rest. */ export declare function normalizeUnderstandingSourceItems(rawItems: unknown[]): UnderstandingSourceItem[]; export interface WorkDiscoveryServiceOptions { projects: ProjectService; sessions: SessionIndex; getConfig: () => Config; emit: (type: string, payload: unknown) => void; } export declare class WorkDiscoveryService { private readonly options; private readonly abortControllers; private readonly deepUnderstandingRuns; private readonly deepUnderstandingAborts; private readonly backgroundRunProjects; private readonly executions; private stopped; private readonly candidateContexts; private readonly runLocales; private readonly activity; constructor(options: WorkDiscoveryServiceOptions); startProjectUnderstanding(projectId: string): WorkDiscoveryRun; private queueProjectUnderstanding; resumeProjectUnderstanding(): void; dispatchProjectUnderstanding(): void; stop(): Promise; private trackExecution; private scheduleProjectUnderstanding; private runProjectUnderstanding; isEnabled(): boolean; getOnboardingState(): WorkDiscoveryOnboardingState; dismissOnboarding(): WorkDiscoveryOnboardingState; getRun(id: string): WorkDiscoveryRun | null; getInvestigation(runId: string): { investigation: import("./types.js").WorkUnderstandingInvestigation; evidence: import("./types.js").WorkUnderstandingEvidenceItem[]; } | null; discoverCandidates(signal?: AbortSignal): Promise; discoverRecentFiles(signal?: AbortSignal): Promise; listDirectorySources(): import("./types.js").WorkDiscoveryDirectorySource[]; getModelProcessingTarget(): { provider: string; remoteModel: boolean; }; grantDirectorySource(rootPath: string, processingPolicy: ModelProcessingPolicy): Promise; previewLocalUnderstandingSources(customNoteDirectories?: string[]): Promise; getDeepUnderstandingRun(id: string): DeepUnderstandingRun | null; getLatestDeepUnderstandingRun(): DeepUnderstandingRun | null; cancelDeepUnderstandingRun(id: string): DeepUnderstandingRun | null; startDeepUnderstandingRun(input: { selectedTier1Sources?: string[]; customNoteDirectories?: string[]; excludeIds?: string[]; precollectedItems?: unknown[]; sourceCheckpoints?: Record; processingPolicy: ModelProcessingPolicy; locale?: string; }): DeepUnderstandingRun; confirmDeepUnderstandingRun(runId: string, input: DeepUnderstandingConfirmationInput): { ok: boolean; confirmedAssertionIds: string[]; createdRuleIds: string[]; }; importUnderstandingSources(rawItems: unknown[], processingPolicy: ModelProcessingPolicy, signal?: AbortSignal, runId?: string, rawCheckpoints?: Record, refresh?: { grantId: string; }, locale?: string, options?: { ignoreUnchangedSkip?: boolean; onPhase?: (phase: 'analyzing_writing' | 'synthesizing') => void; }): Promise<{ profileCandidates: { domain: "values" | "capabilities" | "environment" | "health" | "identity" | "goals" | "life_history" | "emotion" | "personality" | "cognition" | "motivation" | "behavior" | "preferences" | "relationships" | "resources_constraints" | "digital_life"; independentSourceCount: number; status: "pending" | "rejected"; assertionId: string; id: string; category: "role" | "responsibility" | "capability" | "preference" | "routine" | "communication" | "boundary" | "relationship"; factKey: string; statement: string; confidence: "high" | "medium" | "low"; evidence: string[]; evidenceRefs?: string[]; sourceIds?: string[]; }[]; writingPreferences: { status: "pending" | "rejected"; assertionId: string; id: string; ruleId?: string; dimension: import("./types.js").WritingStyleDimension; factKey: string; statement: string; confidence: "high" | "medium" | "low"; evidence: string[]; evidenceRefs: string[]; sourceIds: string[]; }[]; workThreads: { firstObservedAt: number; lastObservedAt: number; createdAt: number; updatedAt: number; recommendedFirstStep?: string | undefined; sourceIds?: string[] | undefined; id: string; canonicalKey: string; title: string; summary: string; status: import("./types.js").WorkUnderstandingThreadStatus; horizon: import("./types.js").WorkUnderstandingThreadHorizon; focusScore: number; confidence: number; userStatus: "unreviewed"; projectIds: string[]; evidenceIds: string[]; }[]; calibrationQuestions: import("./types.js").CalibrationQuestion[]; knowledgeCandidates: import("../knowledge-memory/domain.js").KnowledgeItem[]; sourceStatuses: import("./analyzer.js").UnderstandingSourceAnalysisStatus[]; } | { profileCandidates: never[]; writingPreferences: never[]; workThreads: never[]; calibrationQuestions: never[]; knowledgeCandidates: never[]; sourceStatuses: { sourceId: string; status: "completed"; }[]; }>; rescanDirectorySource(input: { id: string; idempotencyKey: string; }): Promise; startRun(input: { rootPath: string; source: WorkDiscoverySource; idempotencyKey: string; candidateContext?: WorkDiscoveryCandidate[]; locale?: string; }): Promise; private publish; private execute; private persistProfileCandidates; cancelRun(id: string): WorkDiscoveryRun | null; abortDeletedProjectRuns(projectId: string, runIds: readonly string[]): void; retryRun(id: string): WorkDiscoveryRun | null; submitRecognitionFeedback(input: { runId: string; decision: WorkDiscoveryRecognitionDecision; correctedIntent?: string; }): Promise; selectSuggestion(runId: string, suggestionId: string): WorkDiscoveryRun | null; }