@ambicuity/kindx 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/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +578 -0
- package/dist/catalogs.d.ts +137 -0
- package/dist/catalogs.js +349 -0
- package/dist/inference.d.ts +398 -0
- package/dist/inference.js +1131 -0
- package/dist/kindx.d.ts +1 -0
- package/dist/kindx.js +2621 -0
- package/dist/protocol.d.ts +21 -0
- package/dist/protocol.js +666 -0
- package/dist/renderer.d.ts +119 -0
- package/dist/renderer.js +350 -0
- package/dist/repository.d.ts +783 -0
- package/dist/repository.js +2787 -0
- package/dist/runtime.d.ts +33 -0
- package/dist/runtime.js +34 -0
- package/package.json +90 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runtime.ts - Cross-runtime SQLite compatibility layer
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified Database export that works under both Bun (bun:sqlite)
|
|
5
|
+
* and Node.js (better-sqlite3). The APIs are nearly identical — the main
|
|
6
|
+
* difference is the import path.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isBun: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Open a SQLite database. Works with both bun:sqlite and better-sqlite3.
|
|
11
|
+
*/
|
|
12
|
+
export declare function openDatabase(path: string): Database;
|
|
13
|
+
/**
|
|
14
|
+
* Common subset of the Database interface used throughout QMD.
|
|
15
|
+
*/
|
|
16
|
+
export interface Database {
|
|
17
|
+
exec(sql: string): void;
|
|
18
|
+
prepare(sql: string): Statement;
|
|
19
|
+
loadExtension(path: string): void;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
22
|
+
export interface Statement {
|
|
23
|
+
run(...params: any[]): {
|
|
24
|
+
changes: number;
|
|
25
|
+
lastInsertRowid: number | bigint;
|
|
26
|
+
};
|
|
27
|
+
get(...params: any[]): any;
|
|
28
|
+
all(...params: any[]): any[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Load the sqlite-vec extension into a database.
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadSqliteVec(db: Database): void;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runtime.ts - Cross-runtime SQLite compatibility layer
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified Database export that works under both Bun (bun:sqlite)
|
|
5
|
+
* and Node.js (better-sqlite3). The APIs are nearly identical — the main
|
|
6
|
+
* difference is the import path.
|
|
7
|
+
*/
|
|
8
|
+
export const isBun = typeof globalThis.Bun !== "undefined";
|
|
9
|
+
let _Database;
|
|
10
|
+
let _sqliteVecLoad;
|
|
11
|
+
if (isBun) {
|
|
12
|
+
// Dynamic string prevents tsc from resolving bun:sqlite on Node.js builds
|
|
13
|
+
const bunSqlite = "bun:" + "sqlite";
|
|
14
|
+
_Database = (await import(/* @vite-ignore */ bunSqlite)).Database;
|
|
15
|
+
const { getLoadablePath } = await import("sqlite-vec");
|
|
16
|
+
_sqliteVecLoad = (db) => db.loadExtension(getLoadablePath());
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
_Database = (await import("better-sqlite3")).default;
|
|
20
|
+
const sqliteVec = await import("sqlite-vec");
|
|
21
|
+
_sqliteVecLoad = (db) => sqliteVec.load(db);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Open a SQLite database. Works with both bun:sqlite and better-sqlite3.
|
|
25
|
+
*/
|
|
26
|
+
export function openDatabase(path) {
|
|
27
|
+
return new _Database(path);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Load the sqlite-vec extension into a database.
|
|
31
|
+
*/
|
|
32
|
+
export function loadSqliteVec(db) {
|
|
33
|
+
_sqliteVecLoad(db);
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ambicuity/kindx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "KINDX - On-device hybrid search engine for markdown documents with BM25, vector embeddings, and LLM reranking",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kindx": "dist/kindx.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"CHANGELOG.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prepare": "[ -d .git ] && ./tooling/install-hooks.sh || true",
|
|
16
|
+
"build": "tsc -p tsconfig.build.json && printf '#!/usr/bin/env node\n' | cat - dist/kindx.js > dist/kindx.tmp && mv dist/kindx.tmp dist/kindx.js && chmod +x dist/kindx.js",
|
|
17
|
+
"test": "vitest run --reporter=verbose specs/",
|
|
18
|
+
"kindx": "tsx engine/kindx.ts",
|
|
19
|
+
"index": "tsx engine/kindx.ts index",
|
|
20
|
+
"vector": "tsx engine/kindx.ts vector",
|
|
21
|
+
"search": "tsx engine/kindx.ts search",
|
|
22
|
+
"vsearch": "tsx engine/kindx.ts vsearch",
|
|
23
|
+
"rerank": "tsx engine/kindx.ts rerank",
|
|
24
|
+
"inspector": "npx @modelcontextprotocol/inspector tsx engine/kindx.ts mcp",
|
|
25
|
+
"release": "./tooling/release.sh"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/ambicuity/KINDX.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/ambicuity/KINDX#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/ambicuity/KINDX/issues"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
40
|
+
"better-sqlite3": "^11.0.0",
|
|
41
|
+
"fast-glob": "^3.3.0",
|
|
42
|
+
"node-llama-cpp": "^3.17.1",
|
|
43
|
+
"picomatch": "^4.0.0",
|
|
44
|
+
"sqlite-vec": "^0.1.7-alpha.2",
|
|
45
|
+
"yaml": "^2.8.2",
|
|
46
|
+
"zod": "^4.2.1"
|
|
47
|
+
},
|
|
48
|
+
"optionalDependencies": {
|
|
49
|
+
"sqlite-vec-darwin-arm64": "^0.1.7-alpha.2",
|
|
50
|
+
"sqlite-vec-darwin-x64": "^0.1.7-alpha.2",
|
|
51
|
+
"sqlite-vec-linux-arm64": "^0.1.7-alpha.2",
|
|
52
|
+
"sqlite-vec-linux-x64": "^0.1.7-alpha.2",
|
|
53
|
+
"sqlite-vec-windows-x64": "^0.1.7-alpha.2"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/better-sqlite3": "^7.6.0",
|
|
57
|
+
"@types/node": "^25.3.5",
|
|
58
|
+
"@types/picomatch": "^4.0.2",
|
|
59
|
+
"@types/yaml": "^1.9.6",
|
|
60
|
+
"tsx": "^4.0.0",
|
|
61
|
+
"vitest": "^3.0.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"typescript": "^5.9.3"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=22.0.0"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"markdown",
|
|
71
|
+
"search",
|
|
72
|
+
"fts",
|
|
73
|
+
"full-text-search",
|
|
74
|
+
"vector",
|
|
75
|
+
"semantic-search",
|
|
76
|
+
"sqlite",
|
|
77
|
+
"bm25",
|
|
78
|
+
"embeddings",
|
|
79
|
+
"rag",
|
|
80
|
+
"mcp",
|
|
81
|
+
"reranking",
|
|
82
|
+
"knowledge-base",
|
|
83
|
+
"local-ai",
|
|
84
|
+
"llm",
|
|
85
|
+
"on-device",
|
|
86
|
+
"document-search"
|
|
87
|
+
],
|
|
88
|
+
"author": "Ritesh Rana <contact@riteshrana.engineer>",
|
|
89
|
+
"license": "MIT"
|
|
90
|
+
}
|