@wiscale/tauri-plugin-velesdb 7.1.0 → 8.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 +57 -0
- package/dist/index.d.mts +13 -6
- package/dist/index.d.ts +13 -6
- 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
|
@@ -266,8 +266,13 @@ interface QueryResponse {
|
|
|
266
266
|
interface CommandError {
|
|
267
267
|
/** Human-readable error message. */
|
|
268
268
|
message: string;
|
|
269
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* Core taxonomy code (`VELES-###`) for programmatic handling, or
|
|
271
|
+
* `TASK_JOIN` when the plugin's blocking task could not be joined.
|
|
272
|
+
*/
|
|
270
273
|
code: string;
|
|
274
|
+
/** Whether retrying can succeed, as core answers for the same condition. */
|
|
275
|
+
recoverable: boolean;
|
|
271
276
|
}
|
|
272
277
|
/**
|
|
273
278
|
* Creates a new vector collection.
|
|
@@ -759,6 +764,8 @@ interface SemanticQueryRequest {
|
|
|
759
764
|
embedding: number[];
|
|
760
765
|
/** Number of results to return. Default: 10. */
|
|
761
766
|
topK?: number;
|
|
767
|
+
/** 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. */
|
|
768
|
+
quality?: string;
|
|
762
769
|
}
|
|
763
770
|
/** Result from semantic memory query. */
|
|
764
771
|
interface SemanticQueryResult {
|
|
@@ -997,15 +1004,15 @@ interface ListIndexesRequest {
|
|
|
997
1004
|
}
|
|
998
1005
|
/** A single secondary index entry. */
|
|
999
1006
|
interface IndexInfoOutput {
|
|
1000
|
-
/** Node label (
|
|
1007
|
+
/** Node label (`secondary` for a secondary payload index). */
|
|
1001
1008
|
label: string;
|
|
1002
|
-
/** Property name. */
|
|
1009
|
+
/** Property name (the payload field for a secondary index). */
|
|
1003
1010
|
property: string;
|
|
1004
|
-
/** Index type
|
|
1011
|
+
/** Index type: `hash` (graph property), `range` (graph range) or `btree` (secondary payload index). */
|
|
1005
1012
|
indexType: string;
|
|
1006
|
-
/** Number of
|
|
1013
|
+
/** Number of distinct values indexed. */
|
|
1007
1014
|
cardinality: number;
|
|
1008
|
-
/**
|
|
1015
|
+
/** Estimated heap size of the index, in bytes. */
|
|
1009
1016
|
memoryBytes: number;
|
|
1010
1017
|
}
|
|
1011
1018
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -266,8 +266,13 @@ interface QueryResponse {
|
|
|
266
266
|
interface CommandError {
|
|
267
267
|
/** Human-readable error message. */
|
|
268
268
|
message: string;
|
|
269
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* Core taxonomy code (`VELES-###`) for programmatic handling, or
|
|
271
|
+
* `TASK_JOIN` when the plugin's blocking task could not be joined.
|
|
272
|
+
*/
|
|
270
273
|
code: string;
|
|
274
|
+
/** Whether retrying can succeed, as core answers for the same condition. */
|
|
275
|
+
recoverable: boolean;
|
|
271
276
|
}
|
|
272
277
|
/**
|
|
273
278
|
* Creates a new vector collection.
|
|
@@ -759,6 +764,8 @@ interface SemanticQueryRequest {
|
|
|
759
764
|
embedding: number[];
|
|
760
765
|
/** Number of results to return. Default: 10. */
|
|
761
766
|
topK?: number;
|
|
767
|
+
/** 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. */
|
|
768
|
+
quality?: string;
|
|
762
769
|
}
|
|
763
770
|
/** Result from semantic memory query. */
|
|
764
771
|
interface SemanticQueryResult {
|
|
@@ -997,15 +1004,15 @@ interface ListIndexesRequest {
|
|
|
997
1004
|
}
|
|
998
1005
|
/** A single secondary index entry. */
|
|
999
1006
|
interface IndexInfoOutput {
|
|
1000
|
-
/** Node label (
|
|
1007
|
+
/** Node label (`secondary` for a secondary payload index). */
|
|
1001
1008
|
label: string;
|
|
1002
|
-
/** Property name. */
|
|
1009
|
+
/** Property name (the payload field for a secondary index). */
|
|
1003
1010
|
property: string;
|
|
1004
|
-
/** Index type
|
|
1011
|
+
/** Index type: `hash` (graph property), `range` (graph range) or `btree` (secondary payload index). */
|
|
1005
1012
|
indexType: string;
|
|
1006
|
-
/** Number of
|
|
1013
|
+
/** Number of distinct values indexed. */
|
|
1007
1014
|
cardinality: number;
|
|
1008
|
-
/**
|
|
1015
|
+
/** Estimated heap size of the index, in bytes. */
|
|
1009
1016
|
memoryBytes: number;
|
|
1010
1017
|
}
|
|
1011
1018
|
/**
|
package/package.json
CHANGED