minimem 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -855,4 +855,201 @@ declare class MemorySearcher {
855
855
  private ensureVectorReady;
856
856
  }
857
857
 
858
- export { type SearchResult as CoreSearchResult, DebugFn, type EmbeddingProvider, type EmbeddingProviderOptions, type EmbeddingProviderResult, type GeminiBatchRequest, type GeminiEmbeddingClient, type GraphLink, type GraphNeighbor, type IndexStats, type IndexerConfig, KNOWLEDGE_GRAPH_TOOL, KNOWLEDGE_PATH_TOOL, KNOWLEDGE_SEARCH_TOOL, type KnowledgeGraphParams, type KnowledgePathParams, type KnowledgeSearchOptions, type KnowledgeSearchParams, MEMORY_GET_DETAILS_TOOL, MEMORY_SEARCH_TOOL, MEMORY_TOOLS, McpServer, type McpServerConfig, MemoryChunk, MemoryFileEntry, type MemoryGetDetailsParams, type MemoryIndexMeta, MemoryIndexer, type MemoryInstance, type MemorySearchParams, MemorySearcher, MemoryToolExecutor, Minimem, type MinimemConfig, type MinimemSearchResult, type OpenAiBatchRequest, type OpenAiEmbeddingClient, type SearchConfig, type MinimemSearchResult as SearchResult, type ToolDefinition, type ToolInputSchema, type ToolResult, buildKnowledgeFilterSql, createEmbeddingProvider, createGeminiEmbeddingProvider, createMcpServer, createOpenAiEmbeddingProvider, createToolExecutor, generateMcpConfig, getLinksFrom, getLinksTo, getNeighbors, getPathBetween, getToolDefinitions, runGeminiEmbeddingBatches, runMcpServer, runOpenAiEmbeddingBatches };
858
+ /**
859
+ * Store manifest: defines known stores and their relationships.
860
+ *
861
+ * Manifests can live in two places:
862
+ * 1. Global: ~/.config/minimem/stores.json (user-wide registry)
863
+ * 2. Per-store: .minimem/links.json (declares that store's dependencies)
864
+ *
865
+ * The global manifest is the source of truth for store metadata (path, remote).
866
+ * Per-store link files declare which other stores a store depends on.
867
+ */
868
+ /**
869
+ * A single store definition in the global manifest.
870
+ */
871
+ type StoreDefinition = {
872
+ /** Absolute path to the store's memory directory */
873
+ path: string;
874
+ /** Git remote URL for remote materialization */
875
+ remote?: string;
876
+ /** Human-readable description */
877
+ description?: string;
878
+ };
879
+ /**
880
+ * Global store manifest (~/.config/minimem/stores.json)
881
+ */
882
+ type StoreManifest = {
883
+ stores: Record<string, StoreDefinition>;
884
+ };
885
+ /**
886
+ * Per-store links file (.minimem/links.json or .swarm/minimem/links.json)
887
+ * Declares which other stores this store depends on.
888
+ */
889
+ type StoreLinks = {
890
+ /** Store names that this store links to (depth-1 only) */
891
+ links: string[];
892
+ };
893
+ /**
894
+ * Load the global store manifest.
895
+ * Returns an empty manifest if the file doesn't exist.
896
+ */
897
+ declare function loadManifest(manifestPath?: string): Promise<StoreManifest>;
898
+ /**
899
+ * Save the global store manifest.
900
+ */
901
+ declare function saveManifest(manifest: StoreManifest, manifestPath?: string): Promise<void>;
902
+ /**
903
+ * Load per-store links from a memory directory.
904
+ * Checks .minimem/links.json, .swarm/minimem/links.json, and links.json (contained layout).
905
+ */
906
+ declare function loadStoreLinks(memoryDir: string): Promise<StoreLinks>;
907
+ /**
908
+ * Save per-store links to a memory directory.
909
+ * Writes to the first config subdirectory that exists.
910
+ */
911
+ declare function saveStoreLinks(memoryDir: string, links: StoreLinks): Promise<void>;
912
+ /**
913
+ * Resolve store name to its definition.
914
+ * Looks up the store in the global manifest.
915
+ */
916
+ declare function resolveStore(manifest: StoreManifest, storeName: string): StoreDefinition | null;
917
+ /**
918
+ * Resolve a directory path to its store name in the manifest.
919
+ * Returns the first store whose path matches.
920
+ */
921
+ declare function resolveStoreName(manifest: StoreManifest, dirPath: string): string | null;
922
+ /**
923
+ * Get all linked store names for a given store (depth 1 only).
924
+ * Merges links from the global manifest and per-store links file.
925
+ */
926
+ declare function getLinkedStoreNames(manifest: StoreManifest, storeName: string): Promise<string[]>;
927
+ /**
928
+ * Get the default global manifest path.
929
+ */
930
+ declare function getManifestPath(): string;
931
+
932
+ /**
933
+ * Store materialization strategies.
934
+ *
935
+ * Two strategies for making a linked store accessible:
936
+ *
937
+ * A. Remote materialization: clone/fetch a git remote into a cache directory
938
+ * Used when the store isn't available locally.
939
+ *
940
+ * B. Symlink materialization: create temporary symlinks to a local store
941
+ * Used when the store is already present on disk.
942
+ * Symlinks go into a temp directory with unique subdirectory names
943
+ * to avoid path collisions between stores.
944
+ */
945
+
946
+ type MaterializeResult = {
947
+ /** The directory path to use for creating a Minimem instance */
948
+ path: string;
949
+ /** How the store was materialized */
950
+ strategy: "local" | "symlink" | "remote";
951
+ /** Cleanup function to call when done (removes symlinks, etc.) */
952
+ cleanup: () => Promise<void>;
953
+ };
954
+ /**
955
+ * Materialize a store so it can be accessed by a Minimem instance.
956
+ *
957
+ * Resolution order:
958
+ * 1. If the store path exists locally → use directly (no materialization needed)
959
+ * 2. If the store has a remote → clone/fetch into cache
960
+ * 3. Otherwise → return null (store unavailable)
961
+ */
962
+ declare function materializeStore(storeName: string, storeDef: StoreDefinition, opts?: {
963
+ /** Force refresh from remote even if cache exists */
964
+ refresh?: boolean;
965
+ }): Promise<MaterializeResult | null>;
966
+ /**
967
+ * Get the cache directory for remote stores.
968
+ */
969
+ declare function getRemoteCacheDir(): string;
970
+ /**
971
+ * List cached remote stores.
972
+ */
973
+ declare function listCachedStores(): Promise<string[]>;
974
+ /**
975
+ * Clear the cache for a specific remote store.
976
+ */
977
+ declare function clearStoreCache(storeName: string): Promise<void>;
978
+
979
+ /**
980
+ * StoreGraph: meta-layer above Minimem for managing linked stores.
981
+ *
982
+ * A StoreGraph resolves a store and its dependencies (depth 1),
983
+ * materializes them as needed, and produces an array of MemoryInstance
984
+ * objects that can be passed to MemoryToolExecutor or used directly.
985
+ *
986
+ * The Minimem class is unchanged — StoreGraph just orchestrates
987
+ * multiple independent Minimem instances.
988
+ */
989
+
990
+ type StoreGraphOptions = {
991
+ /** Path to the global manifest file (default: ~/.config/minimem/stores.json) */
992
+ manifestPath?: string;
993
+ /** Factory to create a MinimemConfig for a given store directory */
994
+ configFactory?: (memoryDir: string, storeName: string) => Promise<MinimemConfig>;
995
+ /** Debug logging */
996
+ debug?: (message: string) => void;
997
+ };
998
+ type ResolvedStore = {
999
+ name: string;
1000
+ definition: StoreDefinition;
1001
+ materialization: MaterializeResult;
1002
+ instance: Minimem;
1003
+ };
1004
+ declare class StoreGraph {
1005
+ private manifest;
1006
+ private resolved;
1007
+ private configFactory;
1008
+ private debug?;
1009
+ private constructor();
1010
+ /**
1011
+ * Create a StoreGraph from the global manifest.
1012
+ */
1013
+ static create(opts?: StoreGraphOptions): Promise<StoreGraph>;
1014
+ /**
1015
+ * Create a StoreGraph from an explicit manifest object (useful for testing).
1016
+ */
1017
+ static fromManifest(manifest: StoreManifest, opts?: StoreGraphOptions): StoreGraph;
1018
+ /**
1019
+ * Get the loaded manifest.
1020
+ */
1021
+ getManifest(): StoreManifest;
1022
+ /**
1023
+ * Resolve a store by name: materialize it and all its linked stores (depth 1).
1024
+ * Returns an array of MemoryInstance objects ready for search.
1025
+ *
1026
+ * Linked stores that fail to materialize are skipped with a warning.
1027
+ */
1028
+ resolve(storeName: string): Promise<MemoryInstance[]>;
1029
+ /**
1030
+ * Resolve a store by directory path (looks up the store name in the manifest).
1031
+ * Falls back to creating a standalone instance if the directory isn't in the manifest.
1032
+ */
1033
+ resolveByPath(dirPath: string): Promise<MemoryInstance[]>;
1034
+ /**
1035
+ * List all known stores from the manifest with their link info.
1036
+ */
1037
+ listStores(): Promise<Array<{
1038
+ name: string;
1039
+ path: string;
1040
+ remote?: string;
1041
+ links: string[];
1042
+ available: boolean;
1043
+ }>>;
1044
+ /**
1045
+ * Close all resolved Minimem instances and clean up materializations.
1046
+ */
1047
+ close(): Promise<void>;
1048
+ /**
1049
+ * Resolve a single store by name.
1050
+ * Returns cached instance if already resolved.
1051
+ */
1052
+ private resolveOne;
1053
+ }
1054
+
1055
+ export { type SearchResult as CoreSearchResult, DebugFn, type EmbeddingProvider, type EmbeddingProviderOptions, type EmbeddingProviderResult, type GeminiBatchRequest, type GeminiEmbeddingClient, type GraphLink, type GraphNeighbor, type IndexStats, type IndexerConfig, KNOWLEDGE_GRAPH_TOOL, KNOWLEDGE_PATH_TOOL, KNOWLEDGE_SEARCH_TOOL, type KnowledgeGraphParams, type KnowledgePathParams, type KnowledgeSearchOptions, type KnowledgeSearchParams, MEMORY_GET_DETAILS_TOOL, MEMORY_SEARCH_TOOL, MEMORY_TOOLS, type MaterializeResult, McpServer, type McpServerConfig, MemoryChunk, MemoryFileEntry, type MemoryGetDetailsParams, type MemoryIndexMeta, MemoryIndexer, type MemoryInstance, type MemorySearchParams, MemorySearcher, MemoryToolExecutor, Minimem, type MinimemConfig, type MinimemSearchResult, type OpenAiBatchRequest, type OpenAiEmbeddingClient, type ResolvedStore, type SearchConfig, type MinimemSearchResult as SearchResult, type StoreDefinition, StoreGraph, type StoreGraphOptions, type StoreLinks, type StoreManifest, type ToolDefinition, type ToolInputSchema, type ToolResult, buildKnowledgeFilterSql, clearStoreCache, createEmbeddingProvider, createGeminiEmbeddingProvider, createMcpServer, createOpenAiEmbeddingProvider, createToolExecutor, generateMcpConfig, getLinkedStoreNames, getLinksFrom, getLinksTo, getManifestPath, getNeighbors, getPathBetween, getRemoteCacheDir, getToolDefinitions, listCachedStores, loadManifest, loadStoreLinks, materializeStore, resolveStore, resolveStoreName, runGeminiEmbeddingBatches, runMcpServer, runOpenAiEmbeddingBatches, saveManifest, saveStoreLinks };
package/dist/index.d.ts CHANGED
@@ -855,4 +855,201 @@ declare class MemorySearcher {
855
855
  private ensureVectorReady;
856
856
  }
857
857
 
858
- export { type SearchResult as CoreSearchResult, DebugFn, type EmbeddingProvider, type EmbeddingProviderOptions, type EmbeddingProviderResult, type GeminiBatchRequest, type GeminiEmbeddingClient, type GraphLink, type GraphNeighbor, type IndexStats, type IndexerConfig, KNOWLEDGE_GRAPH_TOOL, KNOWLEDGE_PATH_TOOL, KNOWLEDGE_SEARCH_TOOL, type KnowledgeGraphParams, type KnowledgePathParams, type KnowledgeSearchOptions, type KnowledgeSearchParams, MEMORY_GET_DETAILS_TOOL, MEMORY_SEARCH_TOOL, MEMORY_TOOLS, McpServer, type McpServerConfig, MemoryChunk, MemoryFileEntry, type MemoryGetDetailsParams, type MemoryIndexMeta, MemoryIndexer, type MemoryInstance, type MemorySearchParams, MemorySearcher, MemoryToolExecutor, Minimem, type MinimemConfig, type MinimemSearchResult, type OpenAiBatchRequest, type OpenAiEmbeddingClient, type SearchConfig, type MinimemSearchResult as SearchResult, type ToolDefinition, type ToolInputSchema, type ToolResult, buildKnowledgeFilterSql, createEmbeddingProvider, createGeminiEmbeddingProvider, createMcpServer, createOpenAiEmbeddingProvider, createToolExecutor, generateMcpConfig, getLinksFrom, getLinksTo, getNeighbors, getPathBetween, getToolDefinitions, runGeminiEmbeddingBatches, runMcpServer, runOpenAiEmbeddingBatches };
858
+ /**
859
+ * Store manifest: defines known stores and their relationships.
860
+ *
861
+ * Manifests can live in two places:
862
+ * 1. Global: ~/.config/minimem/stores.json (user-wide registry)
863
+ * 2. Per-store: .minimem/links.json (declares that store's dependencies)
864
+ *
865
+ * The global manifest is the source of truth for store metadata (path, remote).
866
+ * Per-store link files declare which other stores a store depends on.
867
+ */
868
+ /**
869
+ * A single store definition in the global manifest.
870
+ */
871
+ type StoreDefinition = {
872
+ /** Absolute path to the store's memory directory */
873
+ path: string;
874
+ /** Git remote URL for remote materialization */
875
+ remote?: string;
876
+ /** Human-readable description */
877
+ description?: string;
878
+ };
879
+ /**
880
+ * Global store manifest (~/.config/minimem/stores.json)
881
+ */
882
+ type StoreManifest = {
883
+ stores: Record<string, StoreDefinition>;
884
+ };
885
+ /**
886
+ * Per-store links file (.minimem/links.json or .swarm/minimem/links.json)
887
+ * Declares which other stores this store depends on.
888
+ */
889
+ type StoreLinks = {
890
+ /** Store names that this store links to (depth-1 only) */
891
+ links: string[];
892
+ };
893
+ /**
894
+ * Load the global store manifest.
895
+ * Returns an empty manifest if the file doesn't exist.
896
+ */
897
+ declare function loadManifest(manifestPath?: string): Promise<StoreManifest>;
898
+ /**
899
+ * Save the global store manifest.
900
+ */
901
+ declare function saveManifest(manifest: StoreManifest, manifestPath?: string): Promise<void>;
902
+ /**
903
+ * Load per-store links from a memory directory.
904
+ * Checks .minimem/links.json, .swarm/minimem/links.json, and links.json (contained layout).
905
+ */
906
+ declare function loadStoreLinks(memoryDir: string): Promise<StoreLinks>;
907
+ /**
908
+ * Save per-store links to a memory directory.
909
+ * Writes to the first config subdirectory that exists.
910
+ */
911
+ declare function saveStoreLinks(memoryDir: string, links: StoreLinks): Promise<void>;
912
+ /**
913
+ * Resolve store name to its definition.
914
+ * Looks up the store in the global manifest.
915
+ */
916
+ declare function resolveStore(manifest: StoreManifest, storeName: string): StoreDefinition | null;
917
+ /**
918
+ * Resolve a directory path to its store name in the manifest.
919
+ * Returns the first store whose path matches.
920
+ */
921
+ declare function resolveStoreName(manifest: StoreManifest, dirPath: string): string | null;
922
+ /**
923
+ * Get all linked store names for a given store (depth 1 only).
924
+ * Merges links from the global manifest and per-store links file.
925
+ */
926
+ declare function getLinkedStoreNames(manifest: StoreManifest, storeName: string): Promise<string[]>;
927
+ /**
928
+ * Get the default global manifest path.
929
+ */
930
+ declare function getManifestPath(): string;
931
+
932
+ /**
933
+ * Store materialization strategies.
934
+ *
935
+ * Two strategies for making a linked store accessible:
936
+ *
937
+ * A. Remote materialization: clone/fetch a git remote into a cache directory
938
+ * Used when the store isn't available locally.
939
+ *
940
+ * B. Symlink materialization: create temporary symlinks to a local store
941
+ * Used when the store is already present on disk.
942
+ * Symlinks go into a temp directory with unique subdirectory names
943
+ * to avoid path collisions between stores.
944
+ */
945
+
946
+ type MaterializeResult = {
947
+ /** The directory path to use for creating a Minimem instance */
948
+ path: string;
949
+ /** How the store was materialized */
950
+ strategy: "local" | "symlink" | "remote";
951
+ /** Cleanup function to call when done (removes symlinks, etc.) */
952
+ cleanup: () => Promise<void>;
953
+ };
954
+ /**
955
+ * Materialize a store so it can be accessed by a Minimem instance.
956
+ *
957
+ * Resolution order:
958
+ * 1. If the store path exists locally → use directly (no materialization needed)
959
+ * 2. If the store has a remote → clone/fetch into cache
960
+ * 3. Otherwise → return null (store unavailable)
961
+ */
962
+ declare function materializeStore(storeName: string, storeDef: StoreDefinition, opts?: {
963
+ /** Force refresh from remote even if cache exists */
964
+ refresh?: boolean;
965
+ }): Promise<MaterializeResult | null>;
966
+ /**
967
+ * Get the cache directory for remote stores.
968
+ */
969
+ declare function getRemoteCacheDir(): string;
970
+ /**
971
+ * List cached remote stores.
972
+ */
973
+ declare function listCachedStores(): Promise<string[]>;
974
+ /**
975
+ * Clear the cache for a specific remote store.
976
+ */
977
+ declare function clearStoreCache(storeName: string): Promise<void>;
978
+
979
+ /**
980
+ * StoreGraph: meta-layer above Minimem for managing linked stores.
981
+ *
982
+ * A StoreGraph resolves a store and its dependencies (depth 1),
983
+ * materializes them as needed, and produces an array of MemoryInstance
984
+ * objects that can be passed to MemoryToolExecutor or used directly.
985
+ *
986
+ * The Minimem class is unchanged — StoreGraph just orchestrates
987
+ * multiple independent Minimem instances.
988
+ */
989
+
990
+ type StoreGraphOptions = {
991
+ /** Path to the global manifest file (default: ~/.config/minimem/stores.json) */
992
+ manifestPath?: string;
993
+ /** Factory to create a MinimemConfig for a given store directory */
994
+ configFactory?: (memoryDir: string, storeName: string) => Promise<MinimemConfig>;
995
+ /** Debug logging */
996
+ debug?: (message: string) => void;
997
+ };
998
+ type ResolvedStore = {
999
+ name: string;
1000
+ definition: StoreDefinition;
1001
+ materialization: MaterializeResult;
1002
+ instance: Minimem;
1003
+ };
1004
+ declare class StoreGraph {
1005
+ private manifest;
1006
+ private resolved;
1007
+ private configFactory;
1008
+ private debug?;
1009
+ private constructor();
1010
+ /**
1011
+ * Create a StoreGraph from the global manifest.
1012
+ */
1013
+ static create(opts?: StoreGraphOptions): Promise<StoreGraph>;
1014
+ /**
1015
+ * Create a StoreGraph from an explicit manifest object (useful for testing).
1016
+ */
1017
+ static fromManifest(manifest: StoreManifest, opts?: StoreGraphOptions): StoreGraph;
1018
+ /**
1019
+ * Get the loaded manifest.
1020
+ */
1021
+ getManifest(): StoreManifest;
1022
+ /**
1023
+ * Resolve a store by name: materialize it and all its linked stores (depth 1).
1024
+ * Returns an array of MemoryInstance objects ready for search.
1025
+ *
1026
+ * Linked stores that fail to materialize are skipped with a warning.
1027
+ */
1028
+ resolve(storeName: string): Promise<MemoryInstance[]>;
1029
+ /**
1030
+ * Resolve a store by directory path (looks up the store name in the manifest).
1031
+ * Falls back to creating a standalone instance if the directory isn't in the manifest.
1032
+ */
1033
+ resolveByPath(dirPath: string): Promise<MemoryInstance[]>;
1034
+ /**
1035
+ * List all known stores from the manifest with their link info.
1036
+ */
1037
+ listStores(): Promise<Array<{
1038
+ name: string;
1039
+ path: string;
1040
+ remote?: string;
1041
+ links: string[];
1042
+ available: boolean;
1043
+ }>>;
1044
+ /**
1045
+ * Close all resolved Minimem instances and clean up materializations.
1046
+ */
1047
+ close(): Promise<void>;
1048
+ /**
1049
+ * Resolve a single store by name.
1050
+ * Returns cached instance if already resolved.
1051
+ */
1052
+ private resolveOne;
1053
+ }
1054
+
1055
+ export { type SearchResult as CoreSearchResult, DebugFn, type EmbeddingProvider, type EmbeddingProviderOptions, type EmbeddingProviderResult, type GeminiBatchRequest, type GeminiEmbeddingClient, type GraphLink, type GraphNeighbor, type IndexStats, type IndexerConfig, KNOWLEDGE_GRAPH_TOOL, KNOWLEDGE_PATH_TOOL, KNOWLEDGE_SEARCH_TOOL, type KnowledgeGraphParams, type KnowledgePathParams, type KnowledgeSearchOptions, type KnowledgeSearchParams, MEMORY_GET_DETAILS_TOOL, MEMORY_SEARCH_TOOL, MEMORY_TOOLS, type MaterializeResult, McpServer, type McpServerConfig, MemoryChunk, MemoryFileEntry, type MemoryGetDetailsParams, type MemoryIndexMeta, MemoryIndexer, type MemoryInstance, type MemorySearchParams, MemorySearcher, MemoryToolExecutor, Minimem, type MinimemConfig, type MinimemSearchResult, type OpenAiBatchRequest, type OpenAiEmbeddingClient, type ResolvedStore, type SearchConfig, type MinimemSearchResult as SearchResult, type StoreDefinition, StoreGraph, type StoreGraphOptions, type StoreLinks, type StoreManifest, type ToolDefinition, type ToolInputSchema, type ToolResult, buildKnowledgeFilterSql, clearStoreCache, createEmbeddingProvider, createGeminiEmbeddingProvider, createMcpServer, createOpenAiEmbeddingProvider, createToolExecutor, generateMcpConfig, getLinkedStoreNames, getLinksFrom, getLinksTo, getManifestPath, getNeighbors, getPathBetween, getRemoteCacheDir, getToolDefinitions, listCachedStores, loadManifest, loadStoreLinks, materializeStore, resolveStore, resolveStoreName, runGeminiEmbeddingBatches, runMcpServer, runOpenAiEmbeddingBatches, saveManifest, saveStoreLinks };