import { WikiMemory, ReadOptions, MemoryBundle, WikiEvent, HealResult, ReembedResult, ChunkFailure, MemoryDump, EntityStatus, OntologyManifest, OntologyMode, WikiFact, WikiEdge, GraphTraversalOptions } from '@equationalapplications/core-llm-wiki'; export * from '@equationalapplications/core-llm-wiki'; import React, { ReactNode } from 'react'; declare function WikiProvider({ wiki, children }: { wiki: WikiMemory; children: ReactNode; }): React.JSX.Element; declare function useWiki(): WikiMemory; declare function useMemoryRead(entityId: string | string[], query: string, options?: ReadOptions): { data: MemoryBundle | null; isPending: boolean; error: Error | null; refetch: () => void; }; type WriteEvent = Omit; declare function useWikiWrite(): { execute: (entityId: string, event: WriteEvent) => Promise; lastResult: void | null; isPending: boolean; error: Error | null; }; type MaintenanceResult = { operation: 'librarian'; result: undefined; } | { operation: 'heal'; result: HealResult; } | { operation: 'prune'; result: { entries: number; tasks: number; events: number; }; }; declare function useWikiMaintenance(): { runLibrarian: (entityId: string, options?: { promptOverride?: string; }) => Promise; runHeal: (entityId: string, options?: { promptOverride?: string; batchSize?: number; }) => Promise; runPrune: (entityId: string, options?: { retainSoftDeletedFor?: number | null; retainEventsFor?: number | null; vacuum?: boolean; }) => Promise<{ entries: number; tasks: number; events: number; }>; runReembed: (entityId?: string, opts?: { force?: boolean; skipExisting?: boolean; }) => Promise; lastResult: MaintenanceResult | null; isPending: boolean; error: Error | null; }; interface IngestParams { sourceRef: string; sourceHash: string; documentChunk: string; maxChunkLength?: number; promptOverride?: string; } /** * Mirrors the widened `IngestDocumentResult` contract: `ingestDocument` no * longer throws when a SUBSET of chunks fails — it returns successfully with * `failedChunks > 0` and `parseFailures` describing each failed chunk. * Consumers of this hook should check `failedChunks`/`parseFailures` on the * resolved value; `error` remains reserved for total failure * (`WikiIngestEmptyError`) and systemic throws. */ type IngestResult = { truncated: boolean; chunks: number; ingestedChunks: number; failedChunks: number; duplicateOf?: string; parseFailures?: ChunkFailure[]; }; declare function useWikiIngest(): { execute: (entityId: string, params: IngestParams) => Promise; lastResult: IngestResult | null; isPending: boolean; error: Error | null; }; interface ForgetParams { entryId?: string; taskId?: string; sourceRef?: string; sourceHash?: string; clearAll?: boolean; } type ForgetResult = { deleted: { entries: number; tasks: number; }; }; declare function useWikiForget(): { execute: (entityId: string, params: ForgetParams) => Promise; lastResult: ForgetResult | null; isPending: boolean; error: Error | null; }; declare function useWikiExport(): { execute: (entityIds?: string[]) => Promise; lastResult: MemoryDump | null; isPending: boolean; error: Error | null; }; declare function useWikiHasChanged(): { execute: (entityId: string, sourceRef: string, sourceHash: string) => Promise; lastResult: boolean | null; isPending: boolean; error: Error | null; }; declare function useEntityStatus(entityId: string): EntityStatus; /** * Reactive state returned by {@link useOntologyManifest}. */ interface OntologyManifestState { /** Resolved manifest, or `null` when `getOntologyManifest` returns `null`. */ manifest: OntologyManifest | null; /** Resolved mode, or `null` when no manifest row/seed applies. */ mode: OntologyMode | null; isPending: boolean; error: Error | null; refetch: () => void; } /** * Reactive read hook for an entity's ontology manifest and mode. * Fetches on mount and whenever `entityId` or `wiki` changes. * Call `refetch()` after mutations (e.g. {@link useSetOntologyManifest}) to refresh. */ declare function useOntologyManifest(entityId: string): OntologyManifestState; /** * Mutation hook for seeding or replacing an entity's ontology manifest. * Mirrors the `{ execute, isPending, error, lastResult }` contract of {@link useWikiWrite}. * Does not auto-refresh {@link useOntologyManifest} — call `refetch()` after a successful `execute()`. */ declare function useSetOntologyManifest(): { execute: (entityId: string, manifest: OntologyManifest, options?: { mode?: OntologyMode; }) => Promise; lastResult: void | null; isPending: boolean; error: Error | null; }; interface WikiTraversalState { nodes: WikiFact[]; edges: WikiEdge[]; isPending: boolean; error: Error | null; refetch: () => void; } /** * Reactive read hook for graph traversal. Fetches on mount and whenever * `entityId` or a stable serialization of `options` changes. * Call `refetch()` after mutations that change the underlying edges (e.g. runLibrarian). */ declare function useWikiTraversal(entityId: string, options: GraphTraversalOptions): WikiTraversalState; export { type MaintenanceResult, type OntologyManifestState, WikiProvider, type WikiTraversalState, useEntityStatus, useMemoryRead, useOntologyManifest, useSetOntologyManifest, useWiki, useWikiExport, useWikiForget, useWikiHasChanged, useWikiIngest, useWikiMaintenance, useWikiTraversal, useWikiWrite };