import { BaseMessage } from "@langchain/core/messages"; import { InferredIntent } from "../application/intent.inferrer.js"; import { SemanticVerifierOutput } from "../application/intent.verifier.js"; import type { DebugMetaAgent } from '../../capabilities/participant-agents.debug.facade.js'; import type { ToolScopeType } from '../../shared/agent/tool.scope.js'; /** * Extended InferredIntent that includes verification results. * We attach the verification output directly to the intent object * as it flows through the graph. */ export type VerifiedIntent = InferredIntent & { verification?: SemanticVerifierOutput; score?: number; }; export type IntentValidationFailureCategory = 'non_actionable' | 'vague_or_invalid' | 'verification_failure' | 'update_target_boundary' | 'reconciliation_boundary'; export interface IntentValidationFailure { category: IntentValidationFailureCategory; message: string; classification?: string; referentialBreadth?: 'narrow' | 'moderate' | 'broad'; } /** * Result of executing a single reconciler action. */ export interface ExecutionResult { /** The action type that was executed */ actionType: 'create' | 'update' | 'expire'; /** Whether the action succeeded */ success: boolean; /** The intent ID (created/updated/archived) */ intentId?: string; /** Final payload (sanitized, for create/update) */ payload?: string; /** Error message if failed */ error?: string; } /** * The Graph State using LangGraph Annotations. * This acts as the central bus for data flowing through our graph. */ export declare const IntentGraphState: import("@langchain/langgraph").AnnotationRoot<{ /** * The unique identifier of the user whose intents are being processed. * Required for database operations. */ userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; /** * The user's profile context (Identity, Narrative, etc.) */ userProfile: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; /** * Explicit input content (e.g., user message). * Optional - graph might run on implicit only. */ inputContent: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel | undefined, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; /** * Conversation history for context-aware intent inference. * Used to resolve anaphoric references ("that intent", "this goal"). * Limited to recent messages (typically last 10) for token efficiency. * Optional - if not provided, intent inference uses only inputContent. */ conversationContext: import("@langchain/langgraph").BaseChannel, import("@langchain/core/messages").MessageType>[] | undefined, BaseMessage, import("@langchain/core/messages").MessageType>[] | import("@langchain/langgraph").OverwriteValue, import("@langchain/core/messages").MessageType>[] | undefined> | undefined, unknown>; /** * Operation mode controls graph flow and determines which nodes execute. * - 'create': Full pipeline (prep → inference → verification → reconciliation → execution) * - 'update': Skip verification if no new intents (prep → inference → reconciliation → execution) * - 'delete': Skip inference and verification (prep → reconciliation → execution) * - 'read': Fast path (prep → queryNode → END) — reads intents without LLM calls * - 'propose': Inference + verification only, stops before reconciliation (no DB writes) * * Defaults to 'create' for backward compatibility. */ operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "propose" | "update" | "create" | "read", "delete" | "propose" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "propose" | "update" | "create" | "read">, unknown>; /** * For update/delete operations, specifies which intent IDs to target. * Optional - used when modifying or removing specific intents. */ targetIntentIds: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * Optional material compare-and-set guard used only by recovery-answer * updates. The database rechecks it while holding the final intent row lock. */ expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * Optional network scope (network ID). Used for linking created intents to a network * and for scoping read operations. Prep always fetches ALL user intents via * getActiveIntents(userId) regardless of network scope (for global dedup/reconciliation). */ networkId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** Focused request scope type for write-side assignment and follow-up queues. */ scopeType: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** Focused request scope id. When scopeType is `network`, this is the focused network id. */ scopeId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * The formatted string of currently active intents. * Always populated by prep via getActiveIntents(userId). */ activeIntents: import("@langchain/langgraph").BaseChannel, unknown>; /** IDs of active intents owned by the graph user, used to fail closed on explicit updates. */ activeIntentIds: import("@langchain/langgraph").BaseChannel, unknown>; /** * List of raw intents extracted from text. */ inferredIntents: import("@langchain/langgraph").BaseChannel<{ reasoning: string; type: "goal" | "tombstone"; confidence: "low" | "medium" | "high"; description: string; }[], { reasoning: string; type: "goal" | "tombstone"; confidence: "low" | "medium" | "high"; description: string; }[] | import("@langchain/langgraph").OverwriteValue<{ reasoning: string; type: "goal" | "tombstone"; confidence: "low" | "medium" | "high"; description: string; }[]>, unknown>; /** * List of intents that have passed semantic verification. * Invalid intents are filtered out before reaching this state. */ verifiedIntents: import("@langchain/langgraph").BaseChannel, unknown>; /** Structured reasons for candidates rejected before persistence. */ validationFailures: import("@langchain/langgraph").BaseChannel, unknown>; /** * Final actions to be performed on the DB (Create, Update, Expire). */ actions: import("@langchain/langgraph").BaseChannel, unknown>; /** * Results of executing actions against the database. * Populated by executorNode after actions are persisted. */ executionResults: import("@langchain/langgraph").BaseChannel, unknown>; /** * If set, indicates a fatal error that should short-circuit the graph to END. * Populated by prep when a precondition fails (e.g. missing profile). */ error: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * Accumulated trace entries from each graph node. * Used for observability: surfaces internal processing steps (inference, * verification with Felicity scores, reconciliation) to the frontend. */ trace: import("@langchain/langgraph").BaseChannel<{ node: string; detail?: string; data?: Record; }[], { node: string; detail?: string; data?: Record; }[] | import("@langchain/langgraph").OverwriteValue<{ node: string; detail?: string; data?: Record; }[]>, unknown>; /** Timing records for each agent invocation within this graph run. */ agentTimings: import("@langchain/langgraph").BaseChannel, unknown>; /** * For read mode: the set of network IDs the caller's agent can reach. * When set and neither networkId nor queryUserId is provided, the graph * returns the caller's own intents across all networks in this set (scope-aware * default path). Derived by the tool layer from the scope envelope plus memberships. */ indexScope: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * For read mode: filter intents by a specific user when reading in a network. * When omitted and network-scoped, returns all intents in the network. */ queryUserId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; /** * For read mode: when true, return all of the current user's intents * ignoring network scope. Used before create_intent to detect duplicates. */ allUserIntents: import("@langchain/langgraph").BaseChannel, unknown>; /** * Output of read mode: queried intents with count and optional metadata. */ readResult: import("@langchain/langgraph").BaseChannel<{ count: number; intents: Array<{ id: string; description: string; summary: string | null; createdAt: Date; userId?: string; userName?: string | null; }>; message?: string; networkId?: string; } | undefined, { count: number; intents: Array<{ id: string; description: string; summary: string | null; createdAt: Date; userId?: string; userName?: string | null; }>; message?: string; networkId?: string; } | import("@langchain/langgraph").OverwriteValue<{ count: number; intents: Array<{ id: string; description: string; summary: string | null; createdAt: Date; userId?: string; userName?: string | null; }>; message?: string; networkId?: string; } | undefined> | undefined, unknown>; }>;