@absolutejs/absolute-rag-sqlite 0.0.1

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 (4) hide show
  1. package/README.md +90 -0
  2. package/index.d.ts +69 -0
  3. package/index.js +84 -0
  4. package/package.json +52 -0
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @absolutejs/absolute-rag-sqlite
2
+
3
+ SQLite adapter package for AbsoluteJS RAG workflows.
4
+
5
+ This package is not the RAG feature itself. Core `@absolutejs/absolute` owns the
6
+ workflow model, hooks, plugin protocol, and fallback behavior. This package owns
7
+ SQLite-specific backend ergonomics and optional native sqlite-vec acceleration.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ bun add @absolutejs/absolute-rag-sqlite
13
+ ```
14
+
15
+ ## Supported native targets
16
+
17
+ The optional native sqlite-vec path currently vendors upstream binaries for:
18
+
19
+ - macOS arm64
20
+ - macOS x64
21
+ - Linux arm64
22
+ - Linux x64
23
+ - Windows x64
24
+
25
+ Unsupported targets stay on the owned fallback path until a backend package adds
26
+ support for them.
27
+
28
+ ## What it gives you
29
+
30
+ - `createSQLiteRAGStore(...)`: SQLite-backed RAG store
31
+ - `createSQLiteRAGCollection(...)`: convenience wrapper that creates the store and collection together
32
+ - `createSQLiteRAGBackend(...)`: one-shot backend bundle with `store`, `collection`, and native support helpers
33
+ - `getSQLiteRAGNativeSupport()`: inspect whether the platform sqlite vec package is available
34
+ - `summarizeSQLiteRAGSupport(...)`: turn store diagnostics into an actionable backend summary
35
+
36
+ ## Basic usage
37
+
38
+ ```ts
39
+ import { createSQLiteRAGBackend, ragPlugin } from "@absolutejs/absolute-rag-sqlite";
40
+
41
+ const backend = createSQLiteRAGBackend({
42
+ storeOptions: {
43
+ path: "./rag.sqlite",
44
+ native: {
45
+ mode: "vec0"
46
+ }
47
+ }
48
+ });
49
+
50
+ app.use(
51
+ ragPlugin({
52
+ path: "/rag",
53
+ collection: backend.collection
54
+ })
55
+ );
56
+ ```
57
+
58
+ ## Native vec0 behavior
59
+
60
+ `sqlite-vec` is treated as an optional accelerator.
61
+
62
+ - If the platform package is available and `native.mode` is set to `"vec0"`, the store can activate native vec0 search.
63
+ - If it is unavailable, AbsoluteJS falls back to the owned JSON/sqlite-table path.
64
+ - Your application code does not need to hardcode native library paths in the normal case.
65
+
66
+ You can inspect what happened at runtime:
67
+
68
+ ```ts
69
+ const support = backend.getNativeSupport();
70
+ console.log(support.actionableMessage);
71
+ ```
72
+
73
+ ## Release flow
74
+
75
+ ```bash
76
+ bun run vendor:binaries
77
+ bun run check
78
+ bun run publish:all
79
+ ```
80
+
81
+ The vendoring script verifies upstream checksums before copying binaries into the
82
+ platform package directories.
83
+
84
+ ## Scope
85
+
86
+ This package should stay replaceable.
87
+
88
+ - SQLite is one backend path.
89
+ - Core AbsoluteJS must continue to work without it.
90
+ - Future backends such as `@absolutejs/absolute-rag-pgvector` should fit the same adapter contract.
package/index.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ import type {
2
+ RAGBackendCapabilities,
3
+ RAGCollection,
4
+ RAGVectorStore,
5
+ RAGVectorStoreStatus,
6
+ SQLiteRAGStoreOptions,
7
+ SQLiteVecResolution
8
+ } from '@absolutejs/absolute/ai';
9
+ import {
10
+ createRAGCollection,
11
+ createSQLiteRAGStore as createCoreSQLiteRAGStore,
12
+ ragPlugin,
13
+ resolveAbsoluteSQLiteVec,
14
+ resolveAbsoluteSQLiteVecExtensionPath
15
+ } from '@absolutejs/absolute/ai';
16
+
17
+ export declare const ABSOLUTE_SQLITE_RAG_PACKAGE_NAME = "@absolutejs/absolute-rag-sqlite";
18
+
19
+ export type SQLiteRAGCollectionOptions = {
20
+ store?: RAGVectorStore;
21
+ storeOptions?: SQLiteRAGStoreOptions;
22
+ };
23
+
24
+ export type SQLiteRAGBackendOptions = {
25
+ store?: RAGVectorStore;
26
+ collection?: RAGCollection;
27
+ storeOptions?: SQLiteRAGStoreOptions;
28
+ };
29
+
30
+ export type SQLiteRAGSupportSummary = {
31
+ backendPackageName: typeof ABSOLUTE_SQLITE_RAG_PACKAGE_NAME;
32
+ recommendedInstallCommand: string;
33
+ resolution: SQLiteVecResolution;
34
+ status?: RAGVectorStoreStatus;
35
+ capabilities?: RAGBackendCapabilities;
36
+ nativeRequested: boolean;
37
+ nativeActive: boolean;
38
+ actionableMessage: string;
39
+ };
40
+
41
+ export type SQLiteRAGBackend = {
42
+ store: RAGVectorStore;
43
+ collection: RAGCollection;
44
+ getStatus: () => RAGVectorStoreStatus | undefined;
45
+ getCapabilities: () => RAGBackendCapabilities | undefined;
46
+ getNativeSupport: () => SQLiteRAGSupportSummary;
47
+ };
48
+
49
+ export declare const createSQLiteRAGStore: typeof createCoreSQLiteRAGStore;
50
+ export declare const createSQLiteRAGCollection: (options?: SQLiteRAGCollectionOptions) => RAGCollection;
51
+ export declare const createSQLiteRAGBackend: (options?: SQLiteRAGBackendOptions) => SQLiteRAGBackend;
52
+ export declare const getSQLiteRAGNativeSupport: typeof resolveAbsoluteSQLiteVec;
53
+ export declare const summarizeSQLiteRAGSupport: (target?: Pick<RAGCollection, 'getStatus' | 'getCapabilities'> | Pick<RAGVectorStore, 'getStatus' | 'getCapabilities'>) => SQLiteRAGSupportSummary;
54
+
55
+ export {
56
+ createRAGCollection,
57
+ ragPlugin,
58
+ resolveAbsoluteSQLiteVec,
59
+ resolveAbsoluteSQLiteVecExtensionPath
60
+ };
61
+
62
+ export type {
63
+ RAGBackendCapabilities,
64
+ RAGCollection,
65
+ RAGVectorStore,
66
+ RAGVectorStoreStatus,
67
+ SQLiteRAGStoreOptions,
68
+ SQLiteVecResolution
69
+ };
package/index.js ADDED
@@ -0,0 +1,84 @@
1
+ import {
2
+ createRAGCollection,
3
+ createSQLiteRAGStore as createCoreSQLiteRAGStore,
4
+ ragPlugin,
5
+ resolveAbsoluteSQLiteVec,
6
+ resolveAbsoluteSQLiteVecExtensionPath
7
+ } from '@absolutejs/absolute/ai';
8
+
9
+ export const ABSOLUTE_SQLITE_RAG_PACKAGE_NAME = '@absolutejs/absolute-rag-sqlite';
10
+
11
+ const nativeMessageFromResolution = (resolution) => {
12
+ switch (resolution?.status) {
13
+ case 'resolved':
14
+ return 'Native sqlite vec support is installed and can be activated with native.mode="vec0".';
15
+ case 'package_not_installed':
16
+ return `Install ${ABSOLUTE_SQLITE_RAG_PACKAGE_NAME} and restart to let AbsoluteJS resolve the platform sqlite vec package automatically.`;
17
+ case 'binary_missing':
18
+ return 'The platform sqlite vec package was resolved but its native library file is missing.';
19
+ case 'unsupported_platform':
20
+ return `No sqlite vec platform package is defined for ${resolution.platformKey}. JSON fallback remains available.`;
21
+ case 'package_invalid':
22
+ return 'The installed sqlite vec package is invalid. Reinstall the backend package and restart.';
23
+ case 'not_configured':
24
+ default:
25
+ return 'Native sqlite vec support is not configured. JSON fallback remains available.';
26
+ }
27
+ };
28
+
29
+ export const createSQLiteRAGStore = (options = {}) =>
30
+ createCoreSQLiteRAGStore(options);
31
+
32
+ export const createSQLiteRAGCollection = (options = {}) => {
33
+ const store = options.store ?? createSQLiteRAGStore(options.storeOptions ?? {});
34
+ return createRAGCollection({ store });
35
+ };
36
+
37
+ export const createSQLiteRAGBackend = (options = {}) => {
38
+ const store = options.store ?? createSQLiteRAGStore(options.storeOptions ?? {});
39
+ const collection = options.collection ?? createRAGCollection({ store });
40
+
41
+ return {
42
+ store,
43
+ collection,
44
+ getStatus: () => collection.getStatus?.() ?? store.getStatus?.(),
45
+ getCapabilities: () => collection.getCapabilities?.() ?? store.getCapabilities?.(),
46
+ getNativeSupport: () => summarizeSQLiteRAGSupport(collection)
47
+ };
48
+ };
49
+
50
+ export const getSQLiteRAGNativeSupport = () => resolveAbsoluteSQLiteVec();
51
+
52
+ export const summarizeSQLiteRAGSupport = (target) => {
53
+ const status = target?.getStatus?.();
54
+ const capabilities = target?.getCapabilities?.();
55
+ const resolution = status?.native?.resolution ?? resolveAbsoluteSQLiteVec();
56
+ const nativeRequested = status?.native?.requested ?? false;
57
+ const nativeActive = status?.native?.active ?? false;
58
+
59
+ let actionableMessage = nativeMessageFromResolution(resolution);
60
+
61
+ if (nativeActive) {
62
+ actionableMessage = 'Native sqlite vec0 is active for this store.';
63
+ } else if (resolution?.status === 'resolved' && nativeRequested) {
64
+ actionableMessage = 'Native sqlite vec is installed, but this store is still running in fallback mode. Check the store diagnostics for load or query errors.';
65
+ }
66
+
67
+ return {
68
+ backendPackageName: ABSOLUTE_SQLITE_RAG_PACKAGE_NAME,
69
+ recommendedInstallCommand: `bun add ${ABSOLUTE_SQLITE_RAG_PACKAGE_NAME}`,
70
+ resolution,
71
+ status,
72
+ capabilities,
73
+ nativeRequested,
74
+ nativeActive,
75
+ actionableMessage
76
+ };
77
+ };
78
+
79
+ export {
80
+ createRAGCollection,
81
+ ragPlugin,
82
+ resolveAbsoluteSQLiteVec,
83
+ resolveAbsoluteSQLiteVecExtensionPath
84
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@absolutejs/absolute-rag-sqlite",
3
+ "version": "0.0.1",
4
+ "description": "SQLite adapter package for AbsoluteJS RAG workflows with optional native vec0 acceleration",
5
+ "license": "BSL-1.1",
6
+ "type": "module",
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "sideEffects": false,
10
+ "files": [
11
+ "README.md",
12
+ "index.js",
13
+ "index.d.ts"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "import": "./index.js",
18
+ "types": "./index.d.ts"
19
+ }
20
+ },
21
+ "scripts": {
22
+ "check": "node ./scripts/check-release.mjs",
23
+ "vendor:binaries": "node ./scripts/vendor-sqlite-vec.mjs",
24
+ "pack": "bun pm pack",
25
+ "publish:all": "node ./scripts/publish-all.mjs",
26
+ "release:package": "bun publish --access public"
27
+ },
28
+ "peerDependencies": {
29
+ "@absolutejs/absolute": ">=0.19.0-beta.394 <0.20.0"
30
+ },
31
+ "optionalDependencies": {
32
+ "@absolutejs/absolute-rag-sqlite-darwin-arm64": "0.0.1",
33
+ "@absolutejs/absolute-rag-sqlite-darwin-x64": "0.0.1",
34
+ "@absolutejs/absolute-rag-sqlite-linux-arm64": "0.0.1",
35
+ "@absolutejs/absolute-rag-sqlite-linux-x64": "0.0.1",
36
+ "@absolutejs/absolute-rag-sqlite-windows-x64": "0.0.1"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/absolutejs/absolute-rag-sqlite.git"
41
+ },
42
+ "keywords": [
43
+ "absolutejs",
44
+ "rag",
45
+ "sqlite",
46
+ "vector",
47
+ "sqlite-vec"
48
+ ],
49
+ "sqliteVec": {
50
+ "version": "0.1.9"
51
+ }
52
+ }