import { EnrichmentGraphDatabase, PremiseProvenance } from "../shared/interfaces/database.interface.js"; import { Scraper } from "../shared/interfaces/scraper.interface.js"; import type { ProfileEnricher } from "../shared/interfaces/enrichment.interface.js"; import type { QuestionerEnqueueFn } from "../capabilities/questions.enqueue.facade.js"; import type { DebugMetaAgent } from "../capabilities/participant-agents.debug.facade.js"; /** * Compiled premise graph interface. Matches the invoke signature of a compiled LangGraph. * Accepted as an optional dependency so write-mode input can be decomposed into premises. */ export interface CompiledPremiseGraph { invoke(input: { userId: string; assertionText: string; tier: 'assertive' | 'contextual'; operationMode: 'create'; /** Volatile premises auto-retract once their validity window lapses. */ volatile?: boolean; /** ISO timestamp after which a contextual premise is no longer valid. */ validUntil?: string; provenanceSource?: PremiseProvenance['source']; provenanceSourceId?: string; }): Promise<{ premise?: { id: string; } | undefined; /** Set when the create was skipped because a near-duplicate already exists. */ duplicateOf?: { premiseId: string; assertionText: string; similarity: number; } | undefined; error?: string | undefined; }>; } /** * Factory class to build and compile the Profile Generation Graph. * * Flow: * 1. check_state - Detect whether profile needs generation * 2. Conditional routing based on operation mode and missing components: * - Query mode: Return immediately (fast path) * - Write mode: Generate only what's needed * 3. Profile generation (if needed) * 4. Save profile to DB * * Key Features: * - Read/Write separation (query vs write) * - Conditional generation (skip generation if profile already exists) */ export declare class EnrichmentGraphFactory { private database; private scraper; private enricher?; private questionerEnqueue?; private premiseGraph?; constructor(database: EnrichmentGraphDatabase, scraper: Scraper, enricher?: ProfileEnricher | undefined, questionerEnqueue?: QuestionerEnqueueFn | undefined, premiseGraph?: CompiledPremiseGraph | undefined); createGraph(): import("@langchain/langgraph").CompiledStateGraph<{ userId: string; operationMode: "query" | "write" | "generate"; forceUpdate: boolean; objective: string | undefined; input: string | undefined; activeSocialIds: string[]; profile: { identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined; needsProfileGeneration: boolean; needsUserInfo: boolean; missingUserInfo: string[]; error: string | undefined; operationsPerformed: { scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }; agentTimings: DebugMetaAgent[]; readResult: { hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined; }, { userId?: string | undefined; operationMode?: "query" | "write" | "generate" | import("@langchain/langgraph").OverwriteValue<"query" | "write" | "generate"> | undefined; forceUpdate?: boolean | import("@langchain/langgraph").OverwriteValue | undefined; objective?: string | import("@langchain/langgraph").OverwriteValue | undefined; input?: string | import("@langchain/langgraph").OverwriteValue | undefined; activeSocialIds?: string[] | import("@langchain/langgraph").OverwriteValue | undefined; profile?: { identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | import("@langchain/langgraph").OverwriteValue<{ identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined> | undefined; needsProfileGeneration?: boolean | import("@langchain/langgraph").OverwriteValue | undefined; needsUserInfo?: boolean | import("@langchain/langgraph").OverwriteValue | undefined; missingUserInfo?: string[] | import("@langchain/langgraph").OverwriteValue | undefined; error?: string | import("@langchain/langgraph").OverwriteValue | undefined; operationsPerformed?: { scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; } | import("@langchain/langgraph").OverwriteValue<{ scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }> | undefined; agentTimings?: DebugMetaAgent[] | import("@langchain/langgraph").OverwriteValue | undefined; readResult?: { hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | import("@langchain/langgraph").OverwriteValue<{ hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined> | undefined; }, "__start__" | "check_state" | "scrape" | "decompose_premises" | "auto_generate", { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; operationMode: import("@langchain/langgraph").BaseChannel<"query" | "write" | "generate", "query" | "write" | "generate" | import("@langchain/langgraph").OverwriteValue<"query" | "write" | "generate">, unknown>; forceUpdate: import("@langchain/langgraph").BaseChannel, unknown>; objective: import("@langchain/langgraph").BaseChannel | undefined, unknown>; input: import("@langchain/langgraph").BaseChannel | undefined, unknown>; activeSocialIds: import("@langchain/langgraph").BaseChannel, unknown>; profile: import("@langchain/langgraph").BaseChannel<{ identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined, { identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | import("@langchain/langgraph").OverwriteValue<{ identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined> | undefined, unknown>; needsProfileGeneration: import("@langchain/langgraph").BaseChannel, unknown>; needsUserInfo: import("@langchain/langgraph").BaseChannel, unknown>; missingUserInfo: import("@langchain/langgraph").BaseChannel, unknown>; error: import("@langchain/langgraph").BaseChannel | undefined, unknown>; operationsPerformed: import("@langchain/langgraph").BaseChannel<{ scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }, { scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; } | import("@langchain/langgraph").OverwriteValue<{ scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }>, unknown>; agentTimings: import("@langchain/langgraph").BaseChannel, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined, { hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | import("@langchain/langgraph").OverwriteValue<{ hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined> | undefined, unknown>; }, { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; operationMode: import("@langchain/langgraph").BaseChannel<"query" | "write" | "generate", "query" | "write" | "generate" | import("@langchain/langgraph").OverwriteValue<"query" | "write" | "generate">, unknown>; forceUpdate: import("@langchain/langgraph").BaseChannel, unknown>; objective: import("@langchain/langgraph").BaseChannel | undefined, unknown>; input: import("@langchain/langgraph").BaseChannel | undefined, unknown>; activeSocialIds: import("@langchain/langgraph").BaseChannel, unknown>; profile: import("@langchain/langgraph").BaseChannel<{ identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined, { identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | import("@langchain/langgraph").OverwriteValue<{ identity: { name: string; bio: string; location: string; }; context: string; userId?: string | undefined; } | undefined> | undefined, unknown>; needsProfileGeneration: import("@langchain/langgraph").BaseChannel, unknown>; needsUserInfo: import("@langchain/langgraph").BaseChannel, unknown>; missingUserInfo: import("@langchain/langgraph").BaseChannel, unknown>; error: import("@langchain/langgraph").BaseChannel | undefined, unknown>; operationsPerformed: import("@langchain/langgraph").BaseChannel<{ scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }, { scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; } | import("@langchain/langgraph").OverwriteValue<{ scraped?: boolean; decomposedPremises?: boolean; generatedProfile?: boolean; savedProfile?: boolean; }>, unknown>; agentTimings: import("@langchain/langgraph").BaseChannel, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined, { hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | import("@langchain/langgraph").OverwriteValue<{ hasProfile: boolean; profile?: { id?: string; name: string; bio: string; location: string; }; message?: string; } | undefined> | undefined, unknown>; }, import("@langchain/langgraph").StateDefinition, { check_state: { error: string; profile?: undefined; readResult?: undefined; needsProfileGeneration?: undefined; needsUserInfo?: undefined; missingUserInfo?: undefined; } | { profile: any; readResult: { hasProfile: boolean; profile: { id: string | undefined; name: any; bio: any; location: any; }; message?: undefined; } | { hasProfile: boolean; message: string; profile?: undefined; }; error?: undefined; needsProfileGeneration?: undefined; needsUserInfo?: undefined; missingUserInfo?: undefined; } | { profile: any; needsProfileGeneration: boolean; needsUserInfo: boolean; missingUserInfo: string[]; error?: undefined; readResult?: undefined; } | { profile: undefined; error: string; readResult?: undefined; needsProfileGeneration?: undefined; needsUserInfo?: undefined; missingUserInfo?: undefined; }; scrape: { error?: undefined; objective?: undefined; input?: undefined; activeSocialIds?: undefined; operationsPerformed?: undefined; } | { error: string; objective?: undefined; input?: undefined; activeSocialIds?: undefined; operationsPerformed?: undefined; } | { objective: string; input: string; activeSocialIds: string[]; operationsPerformed: { scraped: boolean; }; error?: undefined; }; decompose_premises: { error: string; } | { error?: undefined; } | { operationsPerformed?: { decomposedPremises: boolean; } | undefined; agentTimings: DebugMetaAgent[]; error?: undefined; }; auto_generate: { error: string; input?: undefined; needsUserInfo?: undefined; needsProfileGeneration?: undefined; operationsPerformed?: undefined; forceUpdate?: undefined; activeSocialIds?: undefined; } | { input: string; needsUserInfo: boolean; needsProfileGeneration: boolean; operationsPerformed: { scraped: boolean; }; error?: undefined; forceUpdate?: undefined; activeSocialIds?: undefined; } | { input: string; needsUserInfo: boolean; needsProfileGeneration: boolean; forceUpdate: boolean; activeSocialIds: string[]; operationsPerformed: { scraped: boolean; }; error?: undefined; }; }, unknown, unknown, []>; }