plugmem 0.11.0 → 0.12.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 +40 -57
- package/index.d.ts +46 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -447,72 +447,55 @@ the platform config directory, then defaults. The database path resolves from an
|
|
|
447
447
|
explicit argument, then `$PLUGMEM_DB`, then `[database].path`, then the platform
|
|
448
448
|
data directory.
|
|
449
449
|
|
|
450
|
-
```
|
|
451
|
-
const db = await Plugmem.open(
|
|
450
|
+
```javascript
|
|
451
|
+
const db = await Plugmem.open("agent.plugmem", { config: "./plugmem.toml" });
|
|
452
452
|
```
|
|
453
453
|
|
|
454
454
|
```toml
|
|
455
455
|
# plugmem.toml
|
|
456
|
-
[database]
|
|
457
|
-
path = "/path/to/memory.plugmem"
|
|
458
|
-
|
|
459
456
|
[engine]
|
|
460
|
-
dim = 768
|
|
457
|
+
dim = 768 # 0 (the default) stores no vectors
|
|
461
458
|
|
|
462
|
-
[
|
|
463
|
-
|
|
464
|
-
half_life_days = 30 # and treat anything older than a month as stale
|
|
465
|
-
|
|
466
|
-
[embedder] # optional — omit for lexical/tag/graph/time only
|
|
467
|
-
enabled = true # false keeps settings but makes no embedder calls
|
|
468
|
-
url = "http://localhost:11434/v1/embeddings"
|
|
459
|
+
[embedder] # omit for lexical, tag, graph and time only
|
|
460
|
+
url = "http://localhost:11434/v1/embeddings"
|
|
469
461
|
model = "nomic-embed-text"
|
|
470
|
-
|
|
471
|
-
api_key_env = "OPENAI_API_KEY" # env var holding the bearer token
|
|
472
|
-
|
|
473
|
-
[maintenance]
|
|
474
|
-
fsync = "each_op" # or "on_snapshot": faster, loses the journal tail on an OS crash
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
`[engine]` is what a database is *built* with; changing one of those on an
|
|
478
|
-
existing file is refused. `[recall]` and `[index]` are the opposite — reopening
|
|
479
|
-
with different weights is how you change the ranking, so tune them freely. All
|
|
480
|
-
of them are in the [full settings reference](https://github.com/m62624/plugmem/blob/main/crates/plugmem-host/SETTINGS.md).
|
|
481
|
-
|
|
482
|
-
### When a key is misspelled
|
|
483
|
-
|
|
484
|
-
Unknown keys and sections do not stop anything, but they are not swallowed
|
|
485
|
-
either — a misspelled `w_vec` changes no behaviour, and silence would leave you
|
|
486
|
-
believing you had tuned something. **Read them once after opening**, because a
|
|
487
|
-
native addon has nowhere sensible to print:
|
|
488
|
-
|
|
489
|
-
```javascript
|
|
490
|
-
const db = await Plugmem.open("agent.plugmem", { config: "./plugmem.toml" });
|
|
491
|
-
for (const warning of db.configWarnings()) console.warn(warning);
|
|
492
|
-
// unknown setting [recall].w_vector — did you mean `w_vec`?
|
|
462
|
+
on_error = "degrade" # keep answering when the provider is down
|
|
493
463
|
```
|
|
494
464
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
A
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
465
|
+
Every other key, its default and what it costs live in one place:
|
|
466
|
+
|
|
467
|
+
- [`config.example.toml`](https://github.com/m62624/plugmem/blob/main/config.example.toml) — every key with its default, commented
|
|
468
|
+
out, ready to copy.
|
|
469
|
+
- [SETTINGS.md](https://github.com/m62624/plugmem/blob/main/crates/plugmem-host/SETTINGS.md) — the reference: what each key is for, which
|
|
470
|
+
sections are safe to change on an existing database, and the OS-specific
|
|
471
|
+
paths.
|
|
472
|
+
- `settingsHelp()` — the same catalogue from the addon you have loaded.
|
|
473
|
+
|
|
474
|
+
What is specific to this binding:
|
|
475
|
+
|
|
476
|
+
- **`dim` is an open option too**, for callers with no config file. If the
|
|
477
|
+
config built an embedder, that embedder's dimension governs and `dim` must
|
|
478
|
+
agree with it.
|
|
479
|
+
- **A text-only `remember`/`recall` embeds automatically**, and the provider's
|
|
480
|
+
HTTP call happens outside the engine lock — including on a read-only handle,
|
|
481
|
+
which embeds its query out here because the engine cannot embed into a
|
|
482
|
+
zero-copy mapping.
|
|
483
|
+
- **`embedderState()`** answers `'absent' | 'active' | 'suspended'`, and
|
|
484
|
+
`suspendEmbedder()` / `resumeEmbedder()` are the manual switches, for when you
|
|
485
|
+
already know the provider is gone. With `on_error = "degrade"` the addon does
|
|
486
|
+
this for itself: a failed call costs the vector and suspends the embedder
|
|
487
|
+
rather than failing the verb, and `reembed()` fills the missing vectors in
|
|
488
|
+
later. A `WorkspaceMemory` has the same three, as promises: one shared
|
|
489
|
+
provider, but a gate per memory, so suspending one leaves its siblings
|
|
490
|
+
answering with vectors.
|
|
491
|
+
- **Unknown keys are returned, not printed.** A native addon has nowhere
|
|
492
|
+
sensible to write, so read them once after opening:
|
|
493
|
+
|
|
494
|
+
```javascript
|
|
495
|
+
const db = await Plugmem.open("agent.plugmem", { config: "./plugmem.toml" });
|
|
496
|
+
for (const warning of db.configWarnings()) console.warn(warning);
|
|
497
|
+
// unknown setting [recall].w_vector — did you mean `w_vec`?
|
|
498
|
+
```
|
|
516
499
|
|
|
517
500
|
## Async and the event loop
|
|
518
501
|
|
package/index.d.ts
CHANGED
|
@@ -887,6 +887,32 @@ export declare class Plugmem {
|
|
|
887
887
|
* but `close()` makes the moment explicit — e.g. before a read-only reopen.)
|
|
888
888
|
*/
|
|
889
889
|
close(): void
|
|
890
|
+
/**
|
|
891
|
+
* Whether this handle has an embedder, and whether it is usable now.
|
|
892
|
+
*
|
|
893
|
+
* `"absent"` when none is configured, `"active"` when it is being called,
|
|
894
|
+
* `"suspended"` when it is not — either because `suspendEmbedder()` said
|
|
895
|
+
* so, or because it failed under `on_error = "degrade"`. A suspended
|
|
896
|
+
* memory still remembers, still recalls and still forgets; what it does
|
|
897
|
+
* not do is meaning-based ranking.
|
|
898
|
+
*/
|
|
899
|
+
embedderState(): 'absent' | 'active' | 'suspended'
|
|
900
|
+
/**
|
|
901
|
+
* Stops calling the embedder until `resumeEmbedder()`.
|
|
902
|
+
*
|
|
903
|
+
* For when the caller knows the provider is gone — the machine went
|
|
904
|
+
* offline, the model was unloaded — and would rather not pay one failed
|
|
905
|
+
* request per verb to rediscover it. Writes made meanwhile store no
|
|
906
|
+
* vector; `reembed()` fills them in later. Idempotent, and a no-op
|
|
907
|
+
* without an embedder. Works on a read-only handle too, which is the one
|
|
908
|
+
* that embeds its own queries.
|
|
909
|
+
*/
|
|
910
|
+
suspendEmbedder(): void
|
|
911
|
+
/**
|
|
912
|
+
* Calls the embedder again. Nothing is verified here: the next verb that
|
|
913
|
+
* needs a vector finds out, and suspends it again if it is still down.
|
|
914
|
+
*/
|
|
915
|
+
resumeEmbedder(): void
|
|
890
916
|
}
|
|
891
917
|
/**
|
|
892
918
|
* A resumable byte-level check of one snapshot generation.
|
|
@@ -961,6 +987,26 @@ export declare class WorkspaceMemory {
|
|
|
961
987
|
maintain(mode?: 'auto' | 'compact' | 'reindex-text' | 'optimize-vectors' | 'full'): Promise<MaintainReport>
|
|
962
988
|
reembed(batchSize?: number | undefined | null): Promise<ReembedReport>
|
|
963
989
|
checkpoint(): Promise<void>
|
|
990
|
+
/**
|
|
991
|
+
* Whether this memory has an embedder, and whether it is usable now:
|
|
992
|
+
* `"absent"`, `"active"` or `"suspended"`.
|
|
993
|
+
*
|
|
994
|
+
* A workspace shares one provider between its memories, but each memory
|
|
995
|
+
* keeps its own gate — so this answers for this memory alone. A sibling
|
|
996
|
+
* that has not called the dead endpoint yet still reports `"active"`.
|
|
997
|
+
*/
|
|
998
|
+
embedderState(): Promise<'absent' | 'active' | 'suspended'>
|
|
999
|
+
/**
|
|
1000
|
+
* Stops calling this memory's embedder until `resumeEmbedder()`. Writes
|
|
1001
|
+
* made meanwhile store no vector; `reembed()` fills them in later.
|
|
1002
|
+
*/
|
|
1003
|
+
suspendEmbedder(): Promise<void>
|
|
1004
|
+
/**
|
|
1005
|
+
* Calls this memory's embedder again. Nothing is verified here: the next
|
|
1006
|
+
* verb that needs a vector finds out, and suspends it again if it is
|
|
1007
|
+
* still down.
|
|
1008
|
+
*/
|
|
1009
|
+
resumeEmbedder(): Promise<void>
|
|
964
1010
|
}
|
|
965
1011
|
export declare class Workspace {
|
|
966
1012
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugmem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Native Node.js addon for plugmem: an embedded bitemporal memory and retrieval engine for local-first applications and agents (remember / recall / revise / forget over one local database).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"typecheck": "tsc -p tsconfig.json"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"plugmem-linux-x64-gnu": "0.
|
|
47
|
-
"plugmem-linux-arm64-gnu": "0.
|
|
48
|
-
"plugmem-darwin-x64": "0.
|
|
49
|
-
"plugmem-darwin-arm64": "0.
|
|
50
|
-
"plugmem-win32-x64-msvc": "0.
|
|
51
|
-
"plugmem-win32-arm64-msvc": "0.
|
|
46
|
+
"plugmem-linux-x64-gnu": "0.12.0",
|
|
47
|
+
"plugmem-linux-arm64-gnu": "0.12.0",
|
|
48
|
+
"plugmem-darwin-x64": "0.12.0",
|
|
49
|
+
"plugmem-darwin-arm64": "0.12.0",
|
|
50
|
+
"plugmem-win32-x64-msvc": "0.12.0",
|
|
51
|
+
"plugmem-win32-arm64-msvc": "0.12.0"
|
|
52
52
|
}
|
|
53
53
|
}
|