plugmem 0.9.0 → 0.10.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.
Files changed (3) hide show
  1. package/README.md +32 -0
  2. package/index.d.ts +10 -0
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -185,6 +185,21 @@ duplicate or contradict**. If a preflight must not write, use
185
185
  `rememberGuarded`: the database holds one write scope across its similarity
186
186
  check and conditional insertion, so concurrent preflights cannot both pass.
187
187
 
188
+ **`entity` is what makes the guard a guard.** The detector compares the new text
189
+ against that entity's most recent live facts and against nothing else, so a
190
+ `rememberGuarded` call with **no** `entity` has no candidates and always returns
191
+ `status: "stored"` - it does not fail, it simply has nothing to compare against.
192
+ Six identical guarded writes with no entity produce six facts; the same six with
193
+ `entity` produce one and five `blocked`.
194
+
195
+ `checked` on the result says whether a comparison happened at all: `false` is a
196
+ fact stored exactly as `remember` would have stored it. Do not read `status:
197
+ "stored"` as "checked and clear" without it.
198
+
199
+ `similar` carries `{ id, score, reason }` - the ids, not the text. Resolve a
200
+ hit's wording with `get(id)` when you want to show the caller what it collided
201
+ with.
202
+
188
203
  ```typescript
189
204
  const decision = await db.rememberGuarded({
190
205
  text: "the user prefers async-std",
@@ -254,6 +269,23 @@ of mixing incompatible vectors. `reembed` is the deliberate transition; it
254
269
  runs on a libuv worker, leaves the JavaScript event loop responsive, keeps reads
255
270
  live and makes concurrent writes reject with `PLUGMEM_BUSY`.
256
271
 
272
+ A mismatch does **not** stop the database opening, on a writer or a read-only
273
+ handle, and loses nothing. What fails is exactly two things: `recall` with a
274
+ `query` and `remember` with `text`. Everything else - `stats`, `get`, `tagsOf`,
275
+ `listTags`, entity/graph recall, `exportPage`, `forget`, `link`, `verify`,
276
+ `maintain`, `checkpoint`, `reembed` - keeps answering. So the content is safe
277
+ and recovery is always available, and a consumer only finds out at its first
278
+ lookup after the change: detect it by making the cheapest text recall and
279
+ watching for the error, rather than from a note of what was configured last
280
+ time.
281
+
282
+ `reembed` is idempotent; it rebuilds ONE database, so a workspace needs a pass
283
+ over every memory in it. On an EMPTY database it still makes one request whose
284
+ input is the empty string - a provider that rejects empty input fails a rebuild
285
+ that had nothing to rebuild. And switching an embedder on over a database built
286
+ without one breaks nothing and warns about nothing: compare `stats().vectors`
287
+ with `stats().facts` to notice the facts that have no vectors yet.
288
+
257
289
  **Read-only handles** (`{ readOnly: true }`) observe another process's writer
258
290
  over a published snapshot. The read verbs answer, the write verbs throw, and two
259
291
  more appear: `generation()` (the pinned snapshot number) and `refresh()` (adopt
package/index.d.ts CHANGED
@@ -218,6 +218,16 @@ export interface GuardedRememberOutcome {
218
218
  status: 'stored' | 'blocked'
219
219
  outcome?: RememberOutcome
220
220
  similar: Array<Similar>
221
+ /**
222
+ * Whether the similarity detector had anything to compare against.
223
+ *
224
+ * `false` means the fact was stored WITHOUT a duplicate check: the
225
+ * detector is scoped to the fact's entity, so a call carrying no
226
+ * `entity` has no candidate set and cannot block anything, now or after
227
+ * any number of later writes. Always `true` on a blocked result, which
228
+ * by definition compared something.
229
+ */
230
+ checked: boolean
221
231
  }
222
232
  /** One recalled fact. */
223
233
  export interface RecalledFact {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugmem",
3
- "version": "0.9.0",
3
+ "version": "0.10.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.9.0",
47
- "plugmem-linux-arm64-gnu": "0.9.0",
48
- "plugmem-darwin-x64": "0.9.0",
49
- "plugmem-darwin-arm64": "0.9.0",
50
- "plugmem-win32-x64-msvc": "0.9.0",
51
- "plugmem-win32-arm64-msvc": "0.9.0"
46
+ "plugmem-linux-x64-gnu": "0.10.0",
47
+ "plugmem-linux-arm64-gnu": "0.10.0",
48
+ "plugmem-darwin-x64": "0.10.0",
49
+ "plugmem-darwin-arm64": "0.10.0",
50
+ "plugmem-win32-x64-msvc": "0.10.0",
51
+ "plugmem-win32-arm64-msvc": "0.10.0"
52
52
  }
53
53
  }