import type { NetworkGraphDatabase } from "../ports/index.js"; /** * Factory class to build and compile the Network (community) lifecycle graph. * * Handles create, read, update, and delete operations for networks. * Membership and intent–network assignment operations are delegated to * NetworkMembershipGraphFactory and IntentNetworkGraphFactory respectively. * * ## Ownership policy * * - `create`: the calling user becomes the sole owner. The owner–membership * write is performed atomically after the network row is created; on failure * the network is soft-deleted (rollback). Rollback failures are logged but * do NOT mutate the error response — the caller always receives the first * meaningful failure, not a noisy rollback message. * - `update`: owner-only. Any member field may be updated in one call. * - `delete`: owner-only; the network must have no other members. * * ## Scope semantics (read mode) * * When `networkId` is set and `showAll` is false, only the focused network and * the user's personal network (contacts) are returned. This is the strict-scope * invariant for network-bound agents. Set `showAll: true` to bypass. * * Flow: * START → routerNode → {createNode | readNode | updateNode | deleteNode} → END * * IND-546: canonical home — previously network/network.graph.ts. */ export declare class NetworkGraphFactory { private database; constructor(database: NetworkGraphDatabase); createGraph(): import("@langchain/langgraph").CompiledStateGraph<{ userId: string; networkId: string | undefined; operationMode: "delete" | "update" | "create" | "read"; createInput: { title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined; updateInput: { title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined; showAll: boolean; readResult: { memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined; mutationResult: { success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined; error: string | null; }, { userId?: string | undefined; networkId?: string | import("@langchain/langgraph").OverwriteValue | undefined; operationMode?: "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read"> | undefined; createInput?: { title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined; updateInput?: { title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined; showAll?: boolean | import("@langchain/langgraph").OverwriteValue | undefined; readResult?: { memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | import("@langchain/langgraph").OverwriteValue<{ memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined> | undefined; mutationResult?: { success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined> | undefined; error?: string | import("@langchain/langgraph").OverwriteValue | null | undefined; }, "update" | "__start__" | "create" | "read" | "delete_idx", { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; networkId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "update" | "create" | "read", "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read">, unknown>; createInput: import("@langchain/langgraph").BaseChannel<{ title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined, { title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined, unknown>; updateInput: import("@langchain/langgraph").BaseChannel<{ title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined, { title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined, unknown>; showAll: import("@langchain/langgraph").BaseChannel, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined, { memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | import("@langchain/langgraph").OverwriteValue<{ memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined> | undefined, unknown>; mutationResult: import("@langchain/langgraph").BaseChannel<{ success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined, { success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined> | undefined, unknown>; error: import("@langchain/langgraph").BaseChannel | null, unknown>; }, { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; networkId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "update" | "create" | "read", "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read">, unknown>; createInput: import("@langchain/langgraph").BaseChannel<{ title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined, { title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title: string; prompt?: string; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined, unknown>; updateInput: import("@langchain/langgraph").BaseChannel<{ title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined, { title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | import("@langchain/langgraph").OverwriteValue<{ title?: string; prompt?: string | null; imageUrl?: string | null; joinPolicy?: "anyone" | "invite_only"; } | undefined> | undefined, unknown>; showAll: import("@langchain/langgraph").BaseChannel, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined, { memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | import("@langchain/langgraph").OverwriteValue<{ memberOf: Array<{ networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }>; owns: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: string; }>; publicNetworks?: Array<{ networkId: string; title: string; prompt: string | null; memberCount: number; owner: { name: string; avatar: string | null; } | null; }>; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount?: number; scopeNote?: string; }; } | undefined> | undefined, unknown>; mutationResult: import("@langchain/langgraph").BaseChannel<{ success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined, { success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; networkId?: string; title?: string; message?: string; error?: string; } | undefined> | undefined, unknown>; error: import("@langchain/langgraph").BaseChannel | null, unknown>; }, import("@langchain/langgraph").StateDefinition, { read: { readResult: { memberOf: { networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }[]; owns: { networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: "anyone" | "invite_only"; }[]; stats: { memberOfCount: number; ownsCount: number; scopeNote: string; publicNetworksCount?: undefined; }; publicNetworks?: undefined; }; error?: undefined; } | { readResult: { memberOf: { networkId: string; title: string; prompt: string | null; autoAssign: boolean; isPersonal: boolean; joinedAt: Date; }[]; owns: { networkId: string; title: string; prompt: string | null; memberCount: number; intentCount: number; joinPolicy: "anyone" | "invite_only"; }[]; publicNetworks: { networkId: string; title: string; prompt: string | null; memberCount: number; owner: { id: string; name: string; avatar: string | null; } | null; }[]; stats: { memberOfCount: number; ownsCount: number; publicNetworksCount: number; scopeNote?: undefined; }; }; error?: undefined; } | { error: string; readResult?: undefined; }; create: { mutationResult: { success: boolean; error: string; networkId?: undefined; title?: undefined; message?: undefined; }; } | { mutationResult: { success: boolean; networkId: string; title: string; message: string; error?: undefined; }; }; update: { mutationResult: { success: boolean; error: string; networkId?: undefined; message?: undefined; }; } | { mutationResult: { success: boolean; networkId: string; message: string; error?: undefined; }; }; delete_idx: { mutationResult: { success: boolean; error: string; networkId?: undefined; message?: undefined; }; } | { mutationResult: { success: boolean; networkId: string; message: string; error?: undefined; }; }; }, unknown, unknown, []>; }