@wiscale/tauri-plugin-velesdb 7.1.0 → 8.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/README.md +57 -0
- package/dist/index.d.mts +17 -8
- package/dist/index.d.ts +17 -8
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @wiscale/tauri-plugin-velesdb
|
|
2
|
+
|
|
3
|
+
Typed frontend wrapper for [`tauri-plugin-velesdb`](https://crates.io/crates/tauri-plugin-velesdb),
|
|
4
|
+
the Tauri 2 plugin that embeds VelesDB (vector search, knowledge graph and
|
|
5
|
+
agent memory) in a desktop app. Each function calls one plugin command through
|
|
6
|
+
`invoke` and returns its typed result.
|
|
7
|
+
|
|
8
|
+
The wrapper is optional: the plugin's commands can be called with
|
|
9
|
+
`invoke('plugin:velesdb|<command>', { request })` and no extra dependency.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
The Rust plugin must be registered and its commands granted first; see the
|
|
14
|
+
[plugin README](https://github.com/cyberlife-coder/VelesDB/tree/main/crates/tauri-plugin-velesdb#readme)
|
|
15
|
+
(`tauri_plugin_velesdb::init()` and a capability with `velesdb:default`).
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @wiscale/tauri-plugin-velesdb
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use the same version as the `tauri-plugin-velesdb` crate.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { createCollection, upsert, search } from '@wiscale/tauri-plugin-velesdb';
|
|
27
|
+
|
|
28
|
+
await createCollection({ name: 'demo', dimension: 4, metric: 'cosine' });
|
|
29
|
+
|
|
30
|
+
await upsert({
|
|
31
|
+
collection: 'demo',
|
|
32
|
+
points: [
|
|
33
|
+
{ id: 1, vector: [1, 0, 0, 0], payload: { title: 'north' } },
|
|
34
|
+
{ id: 2, vector: [0, 1, 0, 0], payload: { title: 'east' } },
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const { results } = await search({ collection: 'demo', vector: [1, 0, 0, 0], topK: 2 });
|
|
39
|
+
console.log(results[0].payload); // { title: 'north' }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A rejected command rejects with a `CommandError`: a `code` (core's `VELES-###`,
|
|
43
|
+
or `TASK_JOIN` when the plugin's task could not be joined), a `message` and a
|
|
44
|
+
`recoverable` flag (see the
|
|
45
|
+
[plugin reference](https://github.com/cyberlife-coder/VelesDB/blob/main/docs/guides/TAURI_PLUGIN_REFERENCE.md)).
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
The exported functions and request types are declared in
|
|
50
|
+
[`index.ts`](https://github.com/cyberlife-coder/VelesDB/blob/main/crates/tauri-plugin-velesdb/guest-js/index.ts),
|
|
51
|
+
one per plugin command. The
|
|
52
|
+
[plugin reference](https://github.com/cyberlife-coder/VelesDB/blob/main/docs/guides/TAURI_PLUGIN_REFERENCE.md)
|
|
53
|
+
documents every command.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
VelesDB Core License 1.0, see `LICENSE`.
|
package/dist/index.d.mts
CHANGED
|
@@ -184,7 +184,7 @@ interface BatchSearchRequest {
|
|
|
184
184
|
searches: IndividualSearchRequest[];
|
|
185
185
|
}
|
|
186
186
|
/** Fusion strategy for multi-query search. */
|
|
187
|
-
type FusionStrategy = 'rrf' | 'average' | 'maximum' | 'weighted' | 'relative_score';
|
|
187
|
+
type FusionStrategy = 'rrf' | 'weighted_rrf' | 'average' | 'maximum' | 'weighted' | 'relative_score';
|
|
188
188
|
/** Fusion parameters for multi-query search. */
|
|
189
189
|
interface FusionParams {
|
|
190
190
|
/** RRF k parameter (default: 60). */
|
|
@@ -199,6 +199,8 @@ interface FusionParams {
|
|
|
199
199
|
denseWeight?: number;
|
|
200
200
|
/** Relative score fusion: sparse branch weight (default: 0.5). */
|
|
201
201
|
sparseWeight?: number;
|
|
202
|
+
/** Weighted RRF: one weight per query vector, in vector order. Required under `weighted_rrf`. */
|
|
203
|
+
branchWeights?: number[];
|
|
202
204
|
}
|
|
203
205
|
/** Request for multi-query fusion search. */
|
|
204
206
|
interface MultiQuerySearchRequest {
|
|
@@ -208,7 +210,7 @@ interface MultiQuerySearchRequest {
|
|
|
208
210
|
vectors: number[][];
|
|
209
211
|
/** Number of results to return. Default: 10. */
|
|
210
212
|
topK?: number;
|
|
211
|
-
/** Fusion strategy: 'rrf', 'average', 'maximum', 'weighted', 'relative_score'. Default: 'rrf'. */
|
|
213
|
+
/** Fusion strategy: 'rrf', 'weighted_rrf', 'average', 'maximum', 'weighted', 'relative_score'. Default: 'rrf'. */
|
|
212
214
|
fusion?: FusionStrategy;
|
|
213
215
|
/** Fusion parameters. */
|
|
214
216
|
fusionParams?: FusionParams;
|
|
@@ -266,8 +268,13 @@ interface QueryResponse {
|
|
|
266
268
|
interface CommandError {
|
|
267
269
|
/** Human-readable error message. */
|
|
268
270
|
message: string;
|
|
269
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* Core taxonomy code (`VELES-###`) for programmatic handling, or
|
|
273
|
+
* `TASK_JOIN` when the plugin's blocking task could not be joined.
|
|
274
|
+
*/
|
|
270
275
|
code: string;
|
|
276
|
+
/** Whether retrying can succeed, as core answers for the same condition. */
|
|
277
|
+
recoverable: boolean;
|
|
271
278
|
}
|
|
272
279
|
/**
|
|
273
280
|
* Creates a new vector collection.
|
|
@@ -759,6 +766,8 @@ interface SemanticQueryRequest {
|
|
|
759
766
|
embedding: number[];
|
|
760
767
|
/** Number of results to return. Default: 10. */
|
|
761
768
|
topK?: number;
|
|
769
|
+
/** Search quality: 'fast', 'balanced', 'accurate', 'perfect', 'auto', 'custom:<ef>' or 'adaptive:<min_ef>:<max_ef>', each ef in 16-4096; any other value is refused. Omitted keeps the memory collection's own quality. */
|
|
770
|
+
quality?: string;
|
|
762
771
|
}
|
|
763
772
|
/** Result from semantic memory query. */
|
|
764
773
|
interface SemanticQueryResult {
|
|
@@ -997,15 +1006,15 @@ interface ListIndexesRequest {
|
|
|
997
1006
|
}
|
|
998
1007
|
/** A single secondary index entry. */
|
|
999
1008
|
interface IndexInfoOutput {
|
|
1000
|
-
/** Node label (
|
|
1009
|
+
/** Node label (`secondary` for a secondary payload index). */
|
|
1001
1010
|
label: string;
|
|
1002
|
-
/** Property name. */
|
|
1011
|
+
/** Property name (the payload field for a secondary index). */
|
|
1003
1012
|
property: string;
|
|
1004
|
-
/** Index type
|
|
1013
|
+
/** Index type: `hash` (graph property), `range` (graph range) or `btree` (secondary payload index). */
|
|
1005
1014
|
indexType: string;
|
|
1006
|
-
/** Number of
|
|
1015
|
+
/** Number of distinct values indexed. */
|
|
1007
1016
|
cardinality: number;
|
|
1008
|
-
/**
|
|
1017
|
+
/** Estimated heap size of the index, in bytes. */
|
|
1009
1018
|
memoryBytes: number;
|
|
1010
1019
|
}
|
|
1011
1020
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -184,7 +184,7 @@ interface BatchSearchRequest {
|
|
|
184
184
|
searches: IndividualSearchRequest[];
|
|
185
185
|
}
|
|
186
186
|
/** Fusion strategy for multi-query search. */
|
|
187
|
-
type FusionStrategy = 'rrf' | 'average' | 'maximum' | 'weighted' | 'relative_score';
|
|
187
|
+
type FusionStrategy = 'rrf' | 'weighted_rrf' | 'average' | 'maximum' | 'weighted' | 'relative_score';
|
|
188
188
|
/** Fusion parameters for multi-query search. */
|
|
189
189
|
interface FusionParams {
|
|
190
190
|
/** RRF k parameter (default: 60). */
|
|
@@ -199,6 +199,8 @@ interface FusionParams {
|
|
|
199
199
|
denseWeight?: number;
|
|
200
200
|
/** Relative score fusion: sparse branch weight (default: 0.5). */
|
|
201
201
|
sparseWeight?: number;
|
|
202
|
+
/** Weighted RRF: one weight per query vector, in vector order. Required under `weighted_rrf`. */
|
|
203
|
+
branchWeights?: number[];
|
|
202
204
|
}
|
|
203
205
|
/** Request for multi-query fusion search. */
|
|
204
206
|
interface MultiQuerySearchRequest {
|
|
@@ -208,7 +210,7 @@ interface MultiQuerySearchRequest {
|
|
|
208
210
|
vectors: number[][];
|
|
209
211
|
/** Number of results to return. Default: 10. */
|
|
210
212
|
topK?: number;
|
|
211
|
-
/** Fusion strategy: 'rrf', 'average', 'maximum', 'weighted', 'relative_score'. Default: 'rrf'. */
|
|
213
|
+
/** Fusion strategy: 'rrf', 'weighted_rrf', 'average', 'maximum', 'weighted', 'relative_score'. Default: 'rrf'. */
|
|
212
214
|
fusion?: FusionStrategy;
|
|
213
215
|
/** Fusion parameters. */
|
|
214
216
|
fusionParams?: FusionParams;
|
|
@@ -266,8 +268,13 @@ interface QueryResponse {
|
|
|
266
268
|
interface CommandError {
|
|
267
269
|
/** Human-readable error message. */
|
|
268
270
|
message: string;
|
|
269
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* Core taxonomy code (`VELES-###`) for programmatic handling, or
|
|
273
|
+
* `TASK_JOIN` when the plugin's blocking task could not be joined.
|
|
274
|
+
*/
|
|
270
275
|
code: string;
|
|
276
|
+
/** Whether retrying can succeed, as core answers for the same condition. */
|
|
277
|
+
recoverable: boolean;
|
|
271
278
|
}
|
|
272
279
|
/**
|
|
273
280
|
* Creates a new vector collection.
|
|
@@ -759,6 +766,8 @@ interface SemanticQueryRequest {
|
|
|
759
766
|
embedding: number[];
|
|
760
767
|
/** Number of results to return. Default: 10. */
|
|
761
768
|
topK?: number;
|
|
769
|
+
/** Search quality: 'fast', 'balanced', 'accurate', 'perfect', 'auto', 'custom:<ef>' or 'adaptive:<min_ef>:<max_ef>', each ef in 16-4096; any other value is refused. Omitted keeps the memory collection's own quality. */
|
|
770
|
+
quality?: string;
|
|
762
771
|
}
|
|
763
772
|
/** Result from semantic memory query. */
|
|
764
773
|
interface SemanticQueryResult {
|
|
@@ -997,15 +1006,15 @@ interface ListIndexesRequest {
|
|
|
997
1006
|
}
|
|
998
1007
|
/** A single secondary index entry. */
|
|
999
1008
|
interface IndexInfoOutput {
|
|
1000
|
-
/** Node label (
|
|
1009
|
+
/** Node label (`secondary` for a secondary payload index). */
|
|
1001
1010
|
label: string;
|
|
1002
|
-
/** Property name. */
|
|
1011
|
+
/** Property name (the payload field for a secondary index). */
|
|
1003
1012
|
property: string;
|
|
1004
|
-
/** Index type
|
|
1013
|
+
/** Index type: `hash` (graph property), `range` (graph range) or `btree` (secondary payload index). */
|
|
1005
1014
|
indexType: string;
|
|
1006
|
-
/** Number of
|
|
1015
|
+
/** Number of distinct values indexed. */
|
|
1007
1016
|
cardinality: number;
|
|
1008
|
-
/**
|
|
1017
|
+
/** Estimated heap size of the index, in bytes. */
|
|
1009
1018
|
memoryBytes: number;
|
|
1010
1019
|
}
|
|
1011
1020
|
/**
|
package/package.json
CHANGED