@mcampa/ai-context-core 0.0.1 → 0.0.2-beta.357ea87

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.
Files changed (109) hide show
  1. package/README.md +55 -47
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/context.d.ts +30 -5
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/context.js +160 -16
  6. package/dist/context.js.map +1 -1
  7. package/dist/embedding/base-embedding.d.ts.map +1 -1
  8. package/dist/embedding/base-embedding.js +4 -0
  9. package/dist/embedding/base-embedding.js.map +1 -1
  10. package/dist/embedding/gemini-embedding.d.ts +43 -1
  11. package/dist/embedding/gemini-embedding.d.ts.map +1 -1
  12. package/dist/embedding/gemini-embedding.js +164 -26
  13. package/dist/embedding/gemini-embedding.js.map +1 -1
  14. package/dist/embedding/huggingface-embedding.d.ts +70 -0
  15. package/dist/embedding/huggingface-embedding.d.ts.map +1 -0
  16. package/dist/embedding/huggingface-embedding.js +270 -0
  17. package/dist/embedding/huggingface-embedding.js.map +1 -0
  18. package/dist/embedding/index.d.ts +3 -2
  19. package/dist/embedding/index.d.ts.map +1 -1
  20. package/dist/embedding/index.js +3 -2
  21. package/dist/embedding/index.js.map +1 -1
  22. package/dist/embedding/ollama-embedding.d.ts +2 -1
  23. package/dist/embedding/ollama-embedding.d.ts.map +1 -1
  24. package/dist/embedding/ollama-embedding.js +2 -3
  25. package/dist/embedding/ollama-embedding.js.map +1 -1
  26. package/dist/embedding/openai-embedding.d.ts +2 -1
  27. package/dist/embedding/openai-embedding.d.ts.map +1 -1
  28. package/dist/embedding/openai-embedding.js +3 -3
  29. package/dist/embedding/openai-embedding.js.map +1 -1
  30. package/dist/embedding/voyageai-embedding.d.ts +2 -1
  31. package/dist/embedding/voyageai-embedding.d.ts.map +1 -1
  32. package/dist/embedding/voyageai-embedding.js +2 -2
  33. package/dist/embedding/voyageai-embedding.js.map +1 -1
  34. package/dist/index.d.ts +4 -4
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +4 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/splitter/ast-splitter.d.ts +1 -1
  39. package/dist/splitter/ast-splitter.d.ts.map +1 -1
  40. package/dist/splitter/ast-splitter.js +7 -7
  41. package/dist/splitter/ast-splitter.js.map +1 -1
  42. package/dist/splitter/index.d.ts +4 -4
  43. package/dist/splitter/index.d.ts.map +1 -1
  44. package/dist/splitter/index.js +1 -1
  45. package/dist/splitter/index.js.map +1 -1
  46. package/dist/splitter/langchain-splitter.d.ts +1 -1
  47. package/dist/splitter/langchain-splitter.d.ts.map +1 -1
  48. package/dist/splitter/langchain-splitter.js +2 -2
  49. package/dist/splitter/langchain-splitter.js.map +1 -1
  50. package/dist/sync/merkle.js +1 -1
  51. package/dist/sync/merkle.js.map +1 -1
  52. package/dist/sync/synchronizer.js +6 -6
  53. package/dist/sync/synchronizer.js.map +1 -1
  54. package/dist/utils/env-manager.js +4 -4
  55. package/dist/utils/env-manager.js.map +1 -1
  56. package/dist/vectordb/base/base-vector-database.d.ts +58 -0
  57. package/dist/vectordb/base/base-vector-database.d.ts.map +1 -0
  58. package/dist/vectordb/base/base-vector-database.js +32 -0
  59. package/dist/vectordb/base/base-vector-database.js.map +1 -0
  60. package/dist/vectordb/factory.d.ts +113 -0
  61. package/dist/vectordb/factory.d.ts.map +1 -0
  62. package/dist/vectordb/factory.js +170 -0
  63. package/dist/vectordb/factory.js.map +1 -0
  64. package/dist/vectordb/faiss-vectordb.d.ts +162 -0
  65. package/dist/vectordb/faiss-vectordb.d.ts.map +1 -0
  66. package/dist/vectordb/faiss-vectordb.js +777 -0
  67. package/dist/vectordb/faiss-vectordb.js.map +1 -0
  68. package/dist/vectordb/index.d.ts +13 -4
  69. package/dist/vectordb/index.d.ts.map +1 -1
  70. package/dist/vectordb/index.js +39 -5
  71. package/dist/vectordb/index.js.map +1 -1
  72. package/dist/vectordb/libsql-vectordb.d.ts +170 -0
  73. package/dist/vectordb/libsql-vectordb.d.ts.map +1 -0
  74. package/dist/vectordb/libsql-vectordb.js +837 -0
  75. package/dist/vectordb/libsql-vectordb.js.map +1 -0
  76. package/dist/vectordb/milvus-restful-vectordb.d.ts +12 -11
  77. package/dist/vectordb/milvus-restful-vectordb.d.ts.map +1 -1
  78. package/dist/vectordb/milvus-restful-vectordb.js +29 -31
  79. package/dist/vectordb/milvus-restful-vectordb.js.map +1 -1
  80. package/dist/vectordb/milvus-vectordb.d.ts +12 -12
  81. package/dist/vectordb/milvus-vectordb.d.ts.map +1 -1
  82. package/dist/vectordb/milvus-vectordb.js +31 -28
  83. package/dist/vectordb/milvus-vectordb.js.map +1 -1
  84. package/dist/vectordb/qdrant-vectordb.d.ts +149 -0
  85. package/dist/vectordb/qdrant-vectordb.d.ts.map +1 -0
  86. package/dist/vectordb/qdrant-vectordb.js +856 -0
  87. package/dist/vectordb/qdrant-vectordb.js.map +1 -0
  88. package/dist/vectordb/sparse/index.d.ts +4 -0
  89. package/dist/vectordb/sparse/index.d.ts.map +1 -0
  90. package/dist/vectordb/sparse/index.js +23 -0
  91. package/dist/vectordb/sparse/index.js.map +1 -0
  92. package/dist/vectordb/sparse/simple-bm25.d.ts +115 -0
  93. package/dist/vectordb/sparse/simple-bm25.d.ts.map +1 -0
  94. package/dist/vectordb/sparse/simple-bm25.js +249 -0
  95. package/dist/vectordb/sparse/simple-bm25.js.map +1 -0
  96. package/dist/vectordb/sparse/sparse-vector-generator.d.ts +54 -0
  97. package/dist/vectordb/sparse/sparse-vector-generator.d.ts.map +1 -0
  98. package/dist/vectordb/sparse/sparse-vector-generator.js +3 -0
  99. package/dist/vectordb/sparse/sparse-vector-generator.js.map +1 -0
  100. package/dist/vectordb/sparse/types.d.ts +38 -0
  101. package/dist/vectordb/sparse/types.d.ts.map +1 -0
  102. package/dist/vectordb/sparse/types.js +3 -0
  103. package/dist/vectordb/sparse/types.js.map +1 -0
  104. package/dist/vectordb/types.d.ts +16 -16
  105. package/dist/vectordb/types.d.ts.map +1 -1
  106. package/dist/vectordb/types.js.map +1 -1
  107. package/dist/vectordb/zilliz-utils.js +3 -3
  108. package/dist/vectordb/zilliz-utils.js.map +1 -1
  109. package/package.json +32 -22
package/README.md CHANGED
@@ -1,18 +1,20 @@
1
- # @mcampa/claude-context-core
1
+ # @mcampa/ai-context-core
2
2
 
3
3
  ![](../../assets/claude-context.png)
4
4
 
5
- The core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
5
+ The core indexing engine for Context Please - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
6
6
 
7
- [![npm version](https://img.shields.io/npm/v/@mcampa/claude-context-core.svg)](https://www.npmjs.com/package/@mcampa/claude-context-core)
8
- [![npm downloads](https://img.shields.io/npm/dm/@mcampa/claude-context-core.svg)](https://www.npmjs.com/package/@mcampa/claude-context-core)
7
+ > **Note:** This is a fork of [@zilliz/claude-context-core](https://www.npmjs.com/package/@zilliz/claude-context-core) by Zilliz, maintained by PleaseAI.
9
8
 
10
- > 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.
9
+ [![npm version](https://img.shields.io/npm/v/@mcampa/ai-context-core.svg)](https://www.npmjs.com/package/@mcampa/ai-context-core)
10
+ [![npm downloads](https://img.shields.io/npm/dm/@mcampa/ai-context-core.svg)](https://www.npmjs.com/package/@mcampa/ai-context-core)
11
+
12
+ > 📖 **New to Context Please?** Check out the [main project README](../../README.md) for an overview and quick start guide.
11
13
 
12
14
  ## Installation
13
15
 
14
16
  ```bash
15
- npm install @mcampa/claude-context-core
17
+ npm install @mcampa/ai-context-core
16
18
  ```
17
19
 
18
20
  ### Prepare Environment Variables
@@ -33,7 +35,7 @@ Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.c
33
35
 
34
36
  ![](../../assets/signup_and_create_cluster.jpeg)
35
37
 
36
- After creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.
38
+ After creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.
37
39
  These will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.
38
40
 
39
41
  ![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)
@@ -54,9 +56,9 @@ MILVUS_TOKEN=your-zilliz-cloud-api-key
54
56
  ```typescript
55
57
  import {
56
58
  Context,
57
- OpenAIEmbedding,
58
59
  MilvusVectorDatabase,
59
- } from "@mcampa/claude-context-core";
60
+ OpenAIEmbedding,
61
+ } from "@mcampa/ai-context-core";
60
62
 
61
63
  // Initialize embedding provider
62
64
  const embedding = new OpenAIEmbedding({
@@ -72,7 +74,6 @@ const vectorDatabase = new MilvusVectorDatabase({
72
74
 
73
75
  // Create context instance
74
76
  const context = new Context({
75
- name: "my-context",
76
77
  embedding,
77
78
  vectorDatabase,
78
79
  });
@@ -88,6 +89,7 @@ console.log(
88
89
 
89
90
  // Search the codebase
90
91
  const results = await context.semanticSearch(
92
+ "./my-project",
91
93
  "function that handles user authentication",
92
94
  5,
93
95
  );
@@ -142,12 +144,6 @@ interface ContextConfig {
142
144
  }
143
145
  ```
144
146
 
145
- **Note on configuration behavior:**
146
-
147
- - If you provide `supportedExtensions`, it **replaces** the default extensions entirely
148
- - If you provide `ignorePatterns`, it **replaces** the default ignore patterns entirely
149
- - `customExtensions` and `customIgnorePatterns` are **added** to whatever base is used (defaults or your custom ones)
150
-
151
147
  ### Supported File Extensions (Default)
152
148
 
153
149
  ```typescript
@@ -230,7 +226,7 @@ import {
230
226
  Context,
231
227
  MilvusVectorDatabase,
232
228
  VoyageAIEmbedding,
233
- } from "@mcampa/claude-context-core";
229
+ } from "@mcampa/ai-context-core";
234
230
 
235
231
  // Initialize with VoyageAI embedding provider
236
232
  const embedding = new VoyageAIEmbedding({
@@ -244,54 +240,66 @@ const vectorDatabase = new MilvusVectorDatabase({
244
240
  });
245
241
 
246
242
  const context = new Context({
247
- name: "my-context",
248
243
  embedding,
249
244
  vectorDatabase,
250
245
  });
251
246
  ```
252
247
 
253
- ### Custom File Filtering
248
+ ### Using Gemini Embeddings with Retry Configuration
254
249
 
255
250
  ```typescript
256
- // Replace default extensions and ignore patterns entirely
257
- const context = new Context({
258
- name: "my-context",
259
- embedding,
260
- vectorDatabase,
261
- supportedExtensions: [".ts", ".js", ".py", ".java"], // Only these extensions
262
- ignorePatterns: ["node_modules/**", "dist/**", "*.spec.ts", "*.test.js"], // Only these patterns
251
+ import {
252
+ Context,
253
+ MilvusVectorDatabase,
254
+ GeminiEmbedding,
255
+ } from "@mcampa/ai-context-core";
256
+
257
+ // Initialize with Gemini embedding provider
258
+ const embedding = new GeminiEmbedding({
259
+ apiKey: process.env.GEMINI_API_KEY || "your-gemini-api-key",
260
+ model: "gemini-embedding-001",
261
+ outputDimensionality: 768, // Optional: Matryoshka Representation Learning support (256, 768, 1536, 3072)
262
+ maxRetries: 3, // Optional: Maximum retry attempts (default: 3)
263
+ baseDelay: 1000, // Optional: Base delay in ms for exponential backoff (default: 1000ms)
263
264
  });
264
265
 
265
- // Or add to defaults using custom* properties
266
- const context2 = new Context({
267
- name: "my-context",
266
+ const vectorDatabase = new MilvusVectorDatabase({
267
+ address: process.env.MILVUS_ADDRESS || "localhost:19530",
268
+ token: process.env.MILVUS_TOKEN || "",
269
+ });
270
+
271
+ const context = new Context({
268
272
  embedding,
269
273
  vectorDatabase,
270
- customExtensions: [".vue", ".svelte"], // Adds to default extensions
271
- customIgnorePatterns: ["*.spec.ts"], // Adds to default ignore patterns
272
274
  });
273
- ```
274
-
275
- ### Relative Path Indexing
276
275
 
277
- File paths are indexed relative to the `codebasePath` parameter you provide when indexing:
276
+ // The retry mechanism automatically handles:
277
+ // - Rate limit errors (429)
278
+ // - Server errors (500, 502, 503, 504)
279
+ // - Network errors (ECONNREFUSED, ETIMEDOUT, ENOTFOUND, EAI_AGAIN)
280
+ // - Transient API failures with exponential backoff (1s → 2s → 4s → 8s, capped at 10s)
278
281
 
279
- ```typescript
280
- // Index a codebase - paths will be relative to this directory
281
- await context.indexCodebase("/Users/username/projects/my-workspace");
282
-
283
- // Search returns results with relative paths
284
- const results = await context.semanticSearch("user authentication function");
282
+ // Update retry configuration at runtime
283
+ embedding.setMaxRetries(5);
284
+ embedding.setBaseDelay(2000);
285
285
 
286
- // Results show paths relative to the indexed codebase path, e.g.:
287
- // "packages/app/src/auth.ts" instead of full absolute path
286
+ // Check current retry configuration
287
+ const retryConfig = embedding.getRetryConfig();
288
+ console.log(
289
+ `Max retries: ${retryConfig.maxRetries}, Base delay: ${retryConfig.baseDelay}ms`,
290
+ );
288
291
  ```
289
292
 
290
- This makes search results:
293
+ ### Custom File Filtering
291
294
 
292
- - More readable and concise
293
- - Portable across different machines
294
- - Consistent in monorepo environments
295
+ ```typescript
296
+ const context = new Context({
297
+ embedding,
298
+ vectorDatabase,
299
+ supportedExtensions: [".ts", ".js", ".py", ".java"],
300
+ ignorePatterns: ["node_modules/**", "dist/**", "*.spec.ts", "*.test.js"],
301
+ });
302
+ ```
295
303
 
296
304
  ## File Synchronization Architecture
297
305