@customize-agent/knowledge 4.0.3 → 4.0.4

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.
@@ -94,7 +94,10 @@ export declare class KnowledgeBaseManager {
94
94
  createdAt: number;
95
95
  }[];
96
96
  } | undefined;
97
- reindexFile(relativePath: string): Promise<DiffResult>;
97
+ reindexFile(relativePath: string, options?: {
98
+ onProgress?: (progress: KnowledgeIndexProgress) => void;
99
+ vectorMode?: 'sync' | 'defer';
100
+ }): Promise<DiffResult>;
98
101
  addFile(sourcePath: string, targetRelativePath?: string): Promise<DiffResult>;
99
102
  getUploadRelativePath(fileName: string, targetRelativePath?: string): string;
100
103
  uploadFile(fileName: string, content: Buffer, targetRelativePath?: string, onProgress?: (progress: KnowledgeIndexProgress) => void, options?: {
@@ -396,7 +396,7 @@ export class KnowledgeBaseManager {
396
396
  tags: this.store.listTags(normalized),
397
397
  };
398
398
  }
399
- async reindexFile(relativePath) {
399
+ async reindexFile(relativePath, options = {}) {
400
400
  const normalized = this.normalizeRelativePath(relativePath);
401
401
  const record = this.store.listRecords().find(item => item.relativePath === normalized);
402
402
  const targetPath = this.resolveKbRelativePath(normalized);
@@ -405,7 +405,7 @@ export class KnowledgeBaseManager {
405
405
  if (record)
406
406
  await this.deleteVectorFile(record.collectionName, normalized);
407
407
  this.store.deleteRecord(normalized);
408
- return this.incrementalIndex();
408
+ return this.incrementalIndex({ ...options, onlyRelativePaths: [normalized] });
409
409
  }
410
410
  async addFile(sourcePath, targetRelativePath) {
411
411
  this.initialize();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customize-agent/knowledge",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Local knowledge base infrastructure for customize-agent",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,14 +12,6 @@
12
12
  "default": "./dist/index.js"
13
13
  }
14
14
  },
15
- "scripts": {
16
- "prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
17
- "build": "tsc",
18
- "typecheck": "tsc --noEmit",
19
- "lint": "eslint src/",
20
- "postinstall": "node scripts/install-hnsw.cjs",
21
- "doctor:hnsw": "node scripts/install-hnsw.cjs"
22
- },
23
15
  "license": "MIT",
24
16
  "engines": {
25
17
  "node": ">=22.13.0"
@@ -64,5 +56,13 @@
64
56
  "devDependencies": {
65
57
  "@types/better-sqlite3": "^7.6.13",
66
58
  "@types/node": "^25.9.3"
59
+ },
60
+ "scripts": {
61
+ "prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
62
+ "build": "tsc",
63
+ "typecheck": "tsc --noEmit",
64
+ "lint": "eslint src/",
65
+ "postinstall": "node scripts/install-hnsw.cjs",
66
+ "doctor:hnsw": "node scripts/install-hnsw.cjs"
67
67
  }
68
- }
68
+ }