@nebutra/knowledge-rag 0.2.2 → 3.0.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/README.md +2 -2
- package/dist/keyword.d.ts +4 -5
- package/dist/keyword.d.ts.map +1 -1
- package/dist/keyword.js +8 -10
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -69,8 +69,8 @@ All thrown errors are `KnowledgeRagError` and carry an actionable
|
|
|
69
69
|
## How it wraps existing Sailor infra (no reinvention)
|
|
70
70
|
|
|
71
71
|
- **Keyword leg → `@nebutra/search`.** `SearchKeywordIndex` wraps the existing
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
search abstraction (`getSearch()` → Postgres pgvector/FTS, the single kept
|
|
73
|
+
search provider per ADR 2026-09-24). Each chunk is indexed as
|
|
74
74
|
a `SearchDocument` carrying `tenantId`; every keyword query passes
|
|
75
75
|
`filters: { tenantId }` and results are re-filtered by tenant, so the keyword
|
|
76
76
|
leg has the same isolation guarantee as the vector leg. `@nebutra/search` is
|
package/dist/keyword.d.ts
CHANGED
|
@@ -25,11 +25,10 @@ export declare class SearchKeywordIndex implements KeywordIndex {
|
|
|
25
25
|
private constructor();
|
|
26
26
|
/**
|
|
27
27
|
* Returns a live keyword index, or `null` when no @nebutra/search backend
|
|
28
|
-
* is genuinely reachable. The default provider
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* happens to be absent.
|
|
28
|
+
* is genuinely reachable. The default (pgvector) provider only fails on
|
|
29
|
+
* the first network call, so we probe with a real createIndex/search call
|
|
30
|
+
* and degrade to vector-only on any failure — the zero-config path must
|
|
31
|
+
* NEVER break because a search server happens to be absent.
|
|
33
32
|
*/
|
|
34
33
|
static tryCreate(indexName: string): Promise<SearchKeywordIndex | null>;
|
|
35
34
|
index(chunks: KnowledgeChunk[]): Promise<void>;
|
package/dist/keyword.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyword.d.ts","sourceRoot":"","sources":["../src/keyword.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyword.d.ts","sourceRoot":"","sources":["../src/keyword.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7E,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,MAAM,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAErD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAGnC,OAAO;IAKP;;;;;;OAMG;WACU,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IA0BvE,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa9C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IA6B5E,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,MAAM,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAWzD"}
|
package/dist/keyword.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// @nebutra/knowledge-rag — Keyword leg (wraps @nebutra/search)
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Rather than reinventing a keyword index, this WRAPS the existing
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// same tenant-isolation guarantee as the vector leg.
|
|
5
|
+
// @nebutra/search abstraction (pgvector-BM25). Each chunk is indexed as a
|
|
6
|
+
// SearchDocument carrying tenantId; every query filters by { tenantId } so
|
|
7
|
+
// the keyword leg has the same tenant-isolation guarantee as the vector leg.
|
|
9
8
|
//
|
|
10
9
|
// @nebutra/search is imported lazily so the zero-config path (keyword
|
|
11
10
|
// disabled, no search backend) never needs it at module load.
|
|
@@ -27,11 +26,10 @@ export class SearchKeywordIndex {
|
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
28
|
* Returns a live keyword index, or `null` when no @nebutra/search backend
|
|
30
|
-
* is genuinely reachable. The default provider
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* happens to be absent.
|
|
29
|
+
* is genuinely reachable. The default (pgvector) provider only fails on
|
|
30
|
+
* the first network call, so we probe with a real createIndex/search call
|
|
31
|
+
* and degrade to vector-only on any failure — the zero-config path must
|
|
32
|
+
* NEVER break because a search server happens to be absent.
|
|
35
33
|
*/
|
|
36
34
|
static async tryCreate(indexName) {
|
|
37
35
|
try {
|
|
@@ -92,7 +90,7 @@ export class SearchKeywordIndex {
|
|
|
92
90
|
throw new KnowledgeRagError(`Keyword search failed: ${err?.message ?? String(err)}`, {
|
|
93
91
|
code: "E_KEYWORD_SEARCH",
|
|
94
92
|
cause: err,
|
|
95
|
-
suggestion: "Check the @nebutra/search backend (
|
|
93
|
+
suggestion: "Check the @nebutra/search backend (DATABASE_URL for the pgvector provider), or set { disableKeyword: true } for vector-only retrieval.",
|
|
96
94
|
});
|
|
97
95
|
}
|
|
98
96
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebutra/knowledge-rag",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"nebutra": {
|
|
8
|
+
"graph": "core",
|
|
8
9
|
"status": "foundation",
|
|
9
10
|
"productionReady": false,
|
|
10
11
|
"requires": [
|
|
11
12
|
"(none) — zero-config: in-memory vector store + deterministic local embedder",
|
|
12
13
|
"optional: OPENAI_API_KEY or OPENROUTER_API_KEY (real embeddings via @nebutra/agents)",
|
|
13
|
-
"optional:
|
|
14
|
-
"optional: DATABASE_URL (pgvector store)"
|
|
14
|
+
"optional: DATABASE_URL (pgvector store; also powers the keyword leg via @nebutra/search)"
|
|
15
15
|
],
|
|
16
16
|
"gaps": [
|
|
17
17
|
"pgvector store is interface-only (Prisma snippet in README, not migrated)",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"p-timeout": "^7.0.1",
|
|
39
39
|
"zod": "^4.3.6",
|
|
40
|
-
"@nebutra/
|
|
41
|
-
"@nebutra/
|
|
42
|
-
"@nebutra/errors": "0.
|
|
43
|
-
"@nebutra/local-embedding": "0.1.
|
|
44
|
-
"@nebutra/logger": "0.
|
|
45
|
-
"@nebutra/search": "0.
|
|
46
|
-
"@nebutra/tenant-store": "0.
|
|
40
|
+
"@nebutra/agents": "3.0.0",
|
|
41
|
+
"@nebutra/ai-primitives": "0.1.3",
|
|
42
|
+
"@nebutra/errors": "3.0.0",
|
|
43
|
+
"@nebutra/local-embedding": "0.1.4",
|
|
44
|
+
"@nebutra/logger": "3.0.0",
|
|
45
|
+
"@nebutra/search": "3.0.0",
|
|
46
|
+
"@nebutra/tenant-store": "3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"typescript": "^5.9.3",
|