mnemo-engine 0.19.1__tar.gz → 0.20.0__tar.gz
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.
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/PKG-INFO +19 -4
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/README.md +1 -1
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/Cargo.lock +3 -3
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/Cargo.toml +15 -7
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/README.md +35 -19
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/shared_bench.rs +314 -1
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/guide/guide.md +3 -2
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo.rs +30 -11
- mnemo_engine-0.20.0/mnemo/src/cache.rs +481 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/error.rs +4 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/index.rs +20 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/lib.rs +24 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/pager.rs +222 -32
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/lock.rs +1 -1
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/mod.rs +1 -0
- mnemo_engine-0.20.0/mnemo/src/store/catchup.rs +638 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/flush.rs +236 -110
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/hooks.rs +153 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/mod.rs +7 -3
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/open.rs +3 -3
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/records.rs +7 -2
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/shared.rs +184 -1
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/wal.rs +4 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/Cargo.lock +2 -2
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/Cargo.toml +4 -4
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/README.md +1 -1
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/pyproject.toml +20 -3
- mnemo_engine-0.19.1/mnemo/src/cache.rs +0 -299
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/.gitignore +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/benches/corpus.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/build.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/deny.toml +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/ann_defaults_v0_6_0.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/ann_diagnose.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/ann_recall_grid.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/candle_hard.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/embedder_server.py +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/file_size_breakdown.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/inspect_demo_brain.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/open_rss.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/perf2_split.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/quickstart.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/ranking_v2.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/session.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/examples/thread_profile.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/export.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/hook.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/inspect.html +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/inspect.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/mcp_install.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/onboard.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/bin/mnemo/project.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/builtin.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/crypto.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/embed.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/embed_cmd.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/format.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/freelist.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/guide.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/ident.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/keys/display.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/keys/mod.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/keys/os_store.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/keys/recovery.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/keyslot.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/mcp/context.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/mcp.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/memory.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/redact.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/result_cache.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/session.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/call.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/fscheck.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/presence.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/shared/sidecar.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/ann.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/cache_api.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/continuation.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/coordination.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/crud.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/essence.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/findings.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/header_graft_tests.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/keyed.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/load.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/maintenance.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/recall.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/snapshots.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/store/threads.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/text.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/transcript.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo/src/veccol.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/.gitignore +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/src/lib.rs +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/mnemo-python/test_mnemo.py +0 -0
- {mnemo_engine-0.19.1 → mnemo_engine-0.20.0}/python/mnemo_engine/__init__.py +0 -0
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mnemo-engine
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.20.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
4
10
|
Classifier: Programming Language :: Rust
|
|
5
11
|
Classifier: Programming Language :: Python :: 3
|
|
6
|
-
Classifier:
|
|
7
|
-
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Summary: Shared memory for your coding agents, in one encrypted file: Python bindings for the embedded MNemo engine, with recall
|
|
19
|
+
Keywords: mcp,agent-memory,encryption,vector-search,embedded-database
|
|
8
20
|
Home-Page: https://toarchkumar.github.io/mnemo/
|
|
9
21
|
License: Apache-2.0
|
|
10
22
|
Requires-Python: >=3.8
|
|
11
23
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
|
+
Project-URL: Changelog, https://github.com/toarchkumar/mnemo/blob/main/CHANGELOG.md
|
|
25
|
+
Project-URL: Documentation, https://github.com/toarchkumar/mnemo/blob/main/mnemo-python/README.md
|
|
12
26
|
Project-URL: Homepage, https://github.com/toarchkumar/mnemo
|
|
27
|
+
Project-URL: Issues, https://github.com/toarchkumar/mnemo/issues
|
|
13
28
|
Project-URL: Repository, https://github.com/toarchkumar/mnemo
|
|
14
29
|
|
|
15
30
|
# Memory Nemo (MNemo) — Python bindings
|
|
@@ -310,7 +325,7 @@ before the engine sees them, are still `ValueError`):
|
|
|
310
325
|
| `CorruptError` | a page or the header failed its integrity check: corrupt or tampered | restore from a backup or an export |
|
|
311
326
|
| `CancelledError` | shared mode: the call was cancelled while it waited for the lock; nothing changed | |
|
|
312
327
|
| `UnsupportedError` | shared mode isn't available here (a network or synced folder, an old Windows build), or a file-wide setting on a shared handle | pass `allow_network_fs=True` if you know the lock works there; drop the setting |
|
|
313
|
-
| `MaybeStoredError` |
|
|
328
|
+
| `MaybeStoredError` | a write failed after its commit point (shared mode), or a flush after one did on this handle (since v0.20.0); it may be in the file | reopen the file and check whether it's there before retrying |
|
|
314
329
|
| `ReplacedDuringWriteError` | shared mode: another file was renamed over the path during the write (an older `mnemo compact`); the write isn't in the file at the path now | update every `mnemo` that opens the file, then write again |
|
|
315
330
|
| `ReplacedError` | the file at the path is no longer the one the handle opened: another file was renamed over it, or it was moved or removed; nothing was written. `shared` is `True` in a shared-mode write (an older `mnemo compact` renamed over the path just before the commit) | `shared` true: call again, and the call follows the new file. Otherwise reopen the path, or move a moved brain back |
|
|
316
331
|
| `MnemoError` (only) | I/O, cryptography, key derivation or serialization | the message says which |
|
|
@@ -296,7 +296,7 @@ before the engine sees them, are still `ValueError`):
|
|
|
296
296
|
| `CorruptError` | a page or the header failed its integrity check: corrupt or tampered | restore from a backup or an export |
|
|
297
297
|
| `CancelledError` | shared mode: the call was cancelled while it waited for the lock; nothing changed | |
|
|
298
298
|
| `UnsupportedError` | shared mode isn't available here (a network or synced folder, an old Windows build), or a file-wide setting on a shared handle | pass `allow_network_fs=True` if you know the lock works there; drop the setting |
|
|
299
|
-
| `MaybeStoredError` |
|
|
299
|
+
| `MaybeStoredError` | a write failed after its commit point (shared mode), or a flush after one did on this handle (since v0.20.0); it may be in the file | reopen the file and check whether it's there before retrying |
|
|
300
300
|
| `ReplacedDuringWriteError` | shared mode: another file was renamed over the path during the write (an older `mnemo compact`); the write isn't in the file at the path now | update every `mnemo` that opens the file, then write again |
|
|
301
301
|
| `ReplacedError` | the file at the path is no longer the one the handle opened: another file was renamed over it, or it was moved or removed; nothing was written. `shared` is `True` in a shared-mode write (an older `mnemo compact` renamed over the path just before the commit) | `shared` true: call again, and the call follows the new file. Otherwise reopen the path, or move a moved brain back |
|
|
302
302
|
| `MnemoError` (only) | I/O, cryptography, key derivation or serialization | the message says which |
|
|
@@ -1520,7 +1520,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
|
1520
1520
|
|
|
1521
1521
|
[[package]]
|
|
1522
1522
|
name = "mnemo-engine"
|
|
1523
|
-
version = "0.
|
|
1523
|
+
version = "0.20.0"
|
|
1524
1524
|
dependencies = [
|
|
1525
1525
|
"aes-gcm",
|
|
1526
1526
|
"apple-native-keyring-store",
|
|
@@ -1561,7 +1561,7 @@ dependencies = [
|
|
|
1561
1561
|
|
|
1562
1562
|
[[package]]
|
|
1563
1563
|
name = "mnemo-node"
|
|
1564
|
-
version = "0.
|
|
1564
|
+
version = "0.20.0"
|
|
1565
1565
|
dependencies = [
|
|
1566
1566
|
"mnemo-engine",
|
|
1567
1567
|
"napi",
|
|
@@ -1571,7 +1571,7 @@ dependencies = [
|
|
|
1571
1571
|
|
|
1572
1572
|
[[package]]
|
|
1573
1573
|
name = "mnemo-uniffi"
|
|
1574
|
-
version = "0.
|
|
1574
|
+
version = "0.20.0"
|
|
1575
1575
|
dependencies = [
|
|
1576
1576
|
"mnemo-engine",
|
|
1577
1577
|
"serde_json",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# The CLI binary name stays `mnemo`, so users still invoke `mnemo` on
|
|
11
11
|
# the command line after `cargo install mnemo-engine`.
|
|
12
12
|
name = "mnemo-engine"
|
|
13
|
-
version = "0.
|
|
13
|
+
version = "0.20.0"
|
|
14
14
|
edition = "2021"
|
|
15
15
|
rust-version = "1.94"
|
|
16
16
|
# `benches/corpus.rs` is a shared helper module pulled into real benches
|
|
@@ -18,7 +18,7 @@ rust-version = "1.94"
|
|
|
18
18
|
# auto-discovery so cargo doesn't try to build it as its own bench
|
|
19
19
|
# executable; the `[[bench]]` entries below list every real target.
|
|
20
20
|
autobenches = false
|
|
21
|
-
description = "
|
|
21
|
+
description = "Shared memory for your coding agents, in one encrypted file: an embedded Rust engine with recall, an MCP server and a CLI"
|
|
22
22
|
license = "Apache-2.0"
|
|
23
23
|
repository = "https://github.com/toarchkumar/mnemo"
|
|
24
24
|
homepage = "https://toarchkumar.github.io/mnemo/"
|
|
@@ -41,11 +41,19 @@ exclude = [
|
|
|
41
41
|
"examples/device_budget.rs",
|
|
42
42
|
"examples/fmt9_proto.rs",
|
|
43
43
|
]
|
|
44
|
-
# crates.io
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
# crates.io takes at most 5 keywords, each at most 20 characters of ASCII
|
|
45
|
+
# letters, digits, `_`, `-` or `+`, starting with a letter; pick the ones
|
|
46
|
+
# people search for (v0200-d2).
|
|
47
|
+
keywords = ["mcp", "agent-memory", "encryption", "vector-search", "embedded-database"]
|
|
48
|
+
# Standard crates.io category slugs (https://crates.io/category_slugs), at
|
|
49
|
+
# most 5.
|
|
50
|
+
categories = [
|
|
51
|
+
"database-implementations",
|
|
52
|
+
"database",
|
|
53
|
+
"cryptography",
|
|
54
|
+
"development-tools",
|
|
55
|
+
"command-line-utilities",
|
|
56
|
+
]
|
|
49
57
|
|
|
50
58
|
# The core crate is the workspace root. The Node binding lives here as a
|
|
51
59
|
# workspace member but is NOT a default member: a plain `cargo build` /
|
|
@@ -120,18 +120,29 @@ file that records another embedder, or when the model can't be loaded
|
|
|
120
120
|
(offline, first use), it serves without one and says so on stderr:
|
|
121
121
|
`recall`'s `text` is then matched by keyword only (v9 files).
|
|
122
122
|
|
|
123
|
-
The server
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
**The server is shared by default since v0.20** (12.4 shared mode, behind
|
|
124
|
+
`--shared` since v0.14): it holds nothing between tool calls, and each call
|
|
125
|
+
takes the lock for itself (a read runs alongside other readers, a write
|
|
126
|
+
waits with writer preference) for up to `--wait` (default 10 s), so several
|
|
127
|
+
servers, the CLI and Python can use one brain. What the server warns about
|
|
128
|
+
(a sidecar directory it can't use, a synced folder) goes to stderr once at
|
|
129
|
+
start. It refuses a network or synced folder unless you pass
|
|
130
|
+
`--allow-network-fs`. `--shared` is still accepted, so existing configs
|
|
131
|
+
keep working.
|
|
132
|
+
|
|
133
|
+
**`--exclusive`** keeps the behaviour from before v0.20: the server holds
|
|
134
|
+
the file's lock for its whole life, so a second server or a CLI write on
|
|
135
|
+
the same file gets `Locked`.
|
|
136
|
+
|
|
137
|
+
**Update every `mnemo` on the machine** before you rely on shared mode:
|
|
138
|
+
every CLI, the `mnemo-engine` wheel in every virtualenv, and any app built
|
|
139
|
+
on an older binding. A `mnemo compact` from before v0.14 releases its lock
|
|
140
|
+
before it renames, so a shared write in that gap is lost; it's reported
|
|
141
|
+
(`ReplacedDuringWrite`), never acknowledged. See `docs/shared-mode.md`.
|
|
132
142
|
|
|
133
143
|
```sh
|
|
134
|
-
MNEMO_PASSPHRASE=... mnemo serve --mcp
|
|
144
|
+
MNEMO_PASSPHRASE=... mnemo serve --mcp team.mnemo # shared
|
|
145
|
+
MNEMO_PASSPHRASE=... mnemo serve --mcp --exclusive solo.mnemo # holds the file
|
|
135
146
|
```
|
|
136
147
|
|
|
137
148
|
#### Resources, prompts and instructions (v0.16, 12.2)
|
|
@@ -336,10 +347,11 @@ parts: `nosync` finds `mnemo.nosync`, `icloud` finds `iCloud's`. A file
|
|
|
336
347
|
written before v0.15 keeps tokenizer 1 (whole words) until `mnemo compact`
|
|
337
348
|
rebuilds its index; `mnemo info` shows which (`keywords:`).
|
|
338
349
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
on the
|
|
342
|
-
|
|
350
|
+
Since v0.20 the server is shared by default, so two MCP servers on the
|
|
351
|
+
same file work side by side. With `--exclusive` it holds an exclusive write
|
|
352
|
+
lock on the file for its lifetime (see
|
|
353
|
+
[Concurrency](#concurrency--read-only-opens)), and a second server fails
|
|
354
|
+
to start with `Locked`.
|
|
343
355
|
|
|
344
356
|
### Result caching
|
|
345
357
|
|
|
@@ -571,17 +583,21 @@ would need monotonic counters tracked outside the file.
|
|
|
571
583
|
|
|
572
584
|
`flush()` is one **atomic transaction**, committed through a write-ahead log:
|
|
573
585
|
|
|
574
|
-
1. Record (vector) data pages are written copy-on-write to fresh pages and
|
|
575
|
-
|
|
576
|
-
crash-safe by
|
|
586
|
+
1. Record (vector) data pages are written copy-on-write to fresh pages, and
|
|
587
|
+
so is any control-plane run too big for the WAL (FMT-9c). Being
|
|
588
|
+
unreferenced until the catalog below commits, they are crash-safe by
|
|
589
|
+
construction. **One fsync, the barrier, makes them all durable** before
|
|
590
|
+
the commit (since v0.20.0; before, the big runs had a second one).
|
|
577
591
|
2. The transaction's control plane — the new catalog, the ANN index, and the
|
|
578
592
|
new header — is written into the WAL region as a run of
|
|
579
593
|
`(txn_id, page_no, page_image)` frames followed by a checksummed `COMMIT`
|
|
580
594
|
frame.
|
|
581
595
|
3. **One fsync of the WAL is the commit point.** Before it the transaction
|
|
582
596
|
does not exist; after it the transaction is durable even though no home
|
|
583
|
-
page has changed.
|
|
584
|
-
|
|
597
|
+
page has changed. It's never merged with the barrier: within one fsync
|
|
598
|
+
the disk may persist the commit frame before the pages it names.
|
|
599
|
+
4. A *checkpoint* copies each frame to its home page and rewrites page 0,
|
|
600
|
+
and fsyncs: three fsyncs a commit.
|
|
585
601
|
|
|
586
602
|
A crash *before* the commit fsync leaves the previous state untouched. A crash
|
|
587
603
|
*after* it is repaired on open: [`recover`](src/wal.rs) replays the committed
|
|
@@ -6,8 +6,20 @@
|
|
|
6
6
|
//! cargo run --release --example shared_bench -- --cells 1,2,3,4 --sizes 1000,10000,100000
|
|
7
7
|
//! cargo run --release --example shared_bench -- --cells 5,6,7,8 --sizes 10000,100000 --secs 8
|
|
8
8
|
//! cargo run --release --example shared_bench -- --cells 9 --sizes 10000 --secs 20 --valve-ms 250,500,1000,2000
|
|
9
|
+
//! cargo run --release --features failpoints --example shared_bench -- --cells 10,11 --sizes 10000,100000
|
|
10
|
+
//! cargo run --release --example shared_bench -- --cells 12 --sizes 10000,100000
|
|
11
|
+
//! cargo run --release --features failpoints --example shared_bench -- --cells 10 --sizes 100000 --commits 500
|
|
9
12
|
//! ```
|
|
10
13
|
//!
|
|
14
|
+
//! Cells 10 and 11 (v0.20.0, v0200-3) are the incremental catch-up's
|
|
15
|
+
//! (`docs/design/catch-up.md`): 10 is a reader's catch-up after another
|
|
16
|
+
//! handle's one-memory commit, the recalls after it and the memory it
|
|
17
|
+
//! keeps (`--commits N` for the long run, `--reps N` for its loops); 11 is what the first recall
|
|
18
|
+
//! pays to rebuild each lazily built part a catch-up may drop; 12 is cell
|
|
19
|
+
//! 10's footprint control (as many recalls, no commit). With the
|
|
20
|
+
//! `failpoints` feature, cell 10 also counts incremental and full
|
|
21
|
+
//! catch-ups.
|
|
22
|
+
//!
|
|
11
23
|
//! Child processes are this binary run again with `MNEMO_SB_ROLE` set
|
|
12
24
|
//! (writers, readers, a compactor, an opener). Each child writes its counts
|
|
13
25
|
//! and latencies to a file in the run's directory. The results are printed
|
|
@@ -24,7 +36,9 @@ use std::path::{Path, PathBuf};
|
|
|
24
36
|
use std::process::{Child, Command, Stdio};
|
|
25
37
|
use std::time::{Duration, Instant};
|
|
26
38
|
|
|
27
|
-
use mnemo_engine::{
|
|
39
|
+
use mnemo_engine::{
|
|
40
|
+
Memory, MemoryType, Mnemo, MnemoError, RecallRequest, SharedMnemo, SharedOptions, Ulid,
|
|
41
|
+
};
|
|
28
42
|
use rand::{Rng, SeedableRng};
|
|
29
43
|
use serde_json::{json, Value};
|
|
30
44
|
|
|
@@ -434,6 +448,280 @@ fn cell4(n: usize, reps: usize, scratch: &Path) -> Value {
|
|
|
434
448
|
})
|
|
435
449
|
}
|
|
436
450
|
|
|
451
|
+
/// The physical footprint in MB (`vmmap --summary`, macOS): what memory
|
|
452
|
+
/// pressure acts on. `ps`'s RSS also counts freed pages the allocator
|
|
453
|
+
/// hasn't returned. `None` elsewhere.
|
|
454
|
+
fn footprint_mb() -> Option<f64> {
|
|
455
|
+
let o = Command::new("vmmap")
|
|
456
|
+
.args(["--summary", &std::process::id().to_string()])
|
|
457
|
+
.stderr(Stdio::null())
|
|
458
|
+
.output()
|
|
459
|
+
.ok()?;
|
|
460
|
+
let s = String::from_utf8_lossy(&o.stdout);
|
|
461
|
+
let v = s
|
|
462
|
+
.lines()
|
|
463
|
+
.find(|l| l.starts_with("Physical footprint:"))?
|
|
464
|
+
.split_whitespace()
|
|
465
|
+
.last()?
|
|
466
|
+
.to_string();
|
|
467
|
+
let (num, unit) = v.split_at(v.len() - 1);
|
|
468
|
+
let x: f64 = num.parse().ok()?;
|
|
469
|
+
match unit {
|
|
470
|
+
"K" => Some(x / 1024.0),
|
|
471
|
+
"M" => Some(x),
|
|
472
|
+
"G" => Some(x * 1024.0),
|
|
473
|
+
_ => None,
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
fn recall_req(rng: &mut impl Rng) -> RecallRequest {
|
|
478
|
+
RecallRequest::new(vector(rng))
|
|
479
|
+
.top_k(10)
|
|
480
|
+
.track_access(false)
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
#[cfg(feature = "failpoints")]
|
|
484
|
+
fn catch_ups(s: &SharedMnemo) -> Value {
|
|
485
|
+
let (inc, full) = s.__catch_ups();
|
|
486
|
+
json!({ "incremental": inc, "full": full })
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
#[cfg(not(feature = "failpoints"))]
|
|
490
|
+
fn catch_ups(_: &SharedMnemo) -> Value {
|
|
491
|
+
Value::Null
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/// The handle's full reloads so far (0 without the counter).
|
|
495
|
+
#[cfg(feature = "failpoints")]
|
|
496
|
+
fn full_reloads(s: &SharedMnemo) -> u64 {
|
|
497
|
+
s.__catch_ups().1
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
#[cfg(not(feature = "failpoints"))]
|
|
501
|
+
fn full_reloads(_: &SharedMnemo) -> u64 {
|
|
502
|
+
0
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/// What the handle holds (the dev-hooks budget report, MB), with the
|
|
506
|
+
/// vector column's filled rows: live data, to set against the footprint.
|
|
507
|
+
fn held(s: &mut SharedMnemo) -> Value {
|
|
508
|
+
let (r, filled) = s
|
|
509
|
+
.read(|db| Ok((db.__budget_report()?, db.__column_filled().len())))
|
|
510
|
+
.unwrap();
|
|
511
|
+
let mb = |b: u64| round(b as f64 / 1_048_576.0);
|
|
512
|
+
json!({
|
|
513
|
+
"total_mb": mb(r.ram_total),
|
|
514
|
+
"catalog_mb": mb(r.ram_catalog),
|
|
515
|
+
"id_map_mb": mb(r.ram_id_map),
|
|
516
|
+
"ann_mb": mb(r.ram_ann_centroids
|
|
517
|
+
+ r.ram_ann_codebook
|
|
518
|
+
+ r.ram_ann_posting_ids
|
|
519
|
+
+ r.ram_ann_posting_codes
|
|
520
|
+
+ r.ram_ann_assignment),
|
|
521
|
+
"vector_column_mb": mb(r.ram_vector_column),
|
|
522
|
+
"column_rows_filled": filled,
|
|
523
|
+
})
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/// Cell 10: a reader's catch-up after another handle's one-memory commit,
|
|
527
|
+
/// the recalls after it, and the memory the process keeps.
|
|
528
|
+
fn cell10(n: usize, reps: usize, commits: usize, scratch: &Path) -> Value {
|
|
529
|
+
let dir = tempfile::tempdir_in(scratch).unwrap();
|
|
530
|
+
let p = copy_of(dir.path(), n, "c10");
|
|
531
|
+
let mut rng = rand::rngs::StdRng::seed_from_u64(10);
|
|
532
|
+
let mut a = shared(&p);
|
|
533
|
+
let mut b = shared(&p);
|
|
534
|
+
for _ in 0..20 {
|
|
535
|
+
let q = recall_req(&mut rng);
|
|
536
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
537
|
+
}
|
|
538
|
+
let mut warm = Vec::new();
|
|
539
|
+
for _ in 0..reps {
|
|
540
|
+
let q = recall_req(&mut rng);
|
|
541
|
+
let t = Instant::now();
|
|
542
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
543
|
+
warm.push(ms(t.elapsed()));
|
|
544
|
+
}
|
|
545
|
+
// The control: a warm recall after the thread sleeps about as long as a
|
|
546
|
+
// commit takes, with no commit. On the machine this was measured on, a
|
|
547
|
+
// recall after any such pause runs slower, whatever the engine does,
|
|
548
|
+
// so the recalls after a commit are read against this row too.
|
|
549
|
+
let mut idle = Vec::new();
|
|
550
|
+
for _ in 0..reps {
|
|
551
|
+
std::thread::sleep(std::time::Duration::from_millis(20));
|
|
552
|
+
let q = recall_req(&mut rng);
|
|
553
|
+
let t = Instant::now();
|
|
554
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
555
|
+
idle.push(ms(t.elapsed()));
|
|
556
|
+
}
|
|
557
|
+
let start = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
558
|
+
let held_start = held(&mut a);
|
|
559
|
+
let (mut empty, mut first, mut second, mut direct) = (vec![], vec![], vec![], vec![]);
|
|
560
|
+
for i in 0..reps {
|
|
561
|
+
let m = mem(&mut rng, format!("other's write {i}"));
|
|
562
|
+
b.write(move |db| db.remember(m)).unwrap();
|
|
563
|
+
let t = Instant::now();
|
|
564
|
+
a.read(|_| Ok(())).unwrap();
|
|
565
|
+
empty.push(ms(t.elapsed()));
|
|
566
|
+
let q = recall_req(&mut rng);
|
|
567
|
+
let t = Instant::now();
|
|
568
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
569
|
+
first.push(ms(t.elapsed()));
|
|
570
|
+
let q = recall_req(&mut rng);
|
|
571
|
+
let t = Instant::now();
|
|
572
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
573
|
+
second.push(ms(t.elapsed()));
|
|
574
|
+
}
|
|
575
|
+
for i in 0..reps {
|
|
576
|
+
let m = mem(&mut rng, format!("other's write b{i}"));
|
|
577
|
+
b.write(move |db| db.remember(m)).unwrap();
|
|
578
|
+
let q = recall_req(&mut rng);
|
|
579
|
+
let t = Instant::now();
|
|
580
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
581
|
+
direct.push(ms(t.elapsed()));
|
|
582
|
+
}
|
|
583
|
+
// Warm recalls again, back to back with no commit: does the caught-up
|
|
584
|
+
// state recall as fast as the state it started from?
|
|
585
|
+
let mut warm_after = Vec::new();
|
|
586
|
+
for _ in 0..reps {
|
|
587
|
+
let q = recall_req(&mut rng);
|
|
588
|
+
let t = Instant::now();
|
|
589
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
590
|
+
warm_after.push(ms(t.elapsed()));
|
|
591
|
+
}
|
|
592
|
+
let after = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
593
|
+
let held_after = held(&mut a);
|
|
594
|
+
let counts = catch_ups(&a);
|
|
595
|
+
// The long run: `commits` more one-memory commits, each followed by a
|
|
596
|
+
// catch-up and a recall, with the footprint every 25.
|
|
597
|
+
let mut series = Vec::new();
|
|
598
|
+
let long_start = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
599
|
+
let mut long = Vec::new();
|
|
600
|
+
// Each commit's catch-up (an empty read) and the recall after it, split
|
|
601
|
+
// by the path the catch-up took: the full reloads here are the fallback
|
|
602
|
+
// that section 8 compares with today's reload.
|
|
603
|
+
let (mut cu_inc, mut cu_full, mut rec_inc, mut rec_full) = (vec![], vec![], vec![], vec![]);
|
|
604
|
+
for i in 0..commits {
|
|
605
|
+
let m = mem(&mut rng, format!("long run {i}"));
|
|
606
|
+
b.write(move |db| db.remember(m)).unwrap();
|
|
607
|
+
let before = full_reloads(&a);
|
|
608
|
+
let t = Instant::now();
|
|
609
|
+
a.read(|_| Ok(())).unwrap();
|
|
610
|
+
let cu = ms(t.elapsed());
|
|
611
|
+
let full = full_reloads(&a) != before;
|
|
612
|
+
let q = recall_req(&mut rng);
|
|
613
|
+
let t = Instant::now();
|
|
614
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
615
|
+
let r = ms(t.elapsed());
|
|
616
|
+
long.push(r);
|
|
617
|
+
if full {
|
|
618
|
+
cu_full.push(cu);
|
|
619
|
+
rec_full.push(r);
|
|
620
|
+
} else {
|
|
621
|
+
cu_inc.push(cu);
|
|
622
|
+
rec_inc.push(r);
|
|
623
|
+
}
|
|
624
|
+
if (i + 1) % 25 == 0 {
|
|
625
|
+
series.push(json!({
|
|
626
|
+
"commits": i + 1,
|
|
627
|
+
"rss_mb": round(rss_kb() as f64 / 1024.0),
|
|
628
|
+
"footprint_mb": footprint_mb().map(round),
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
let long_end = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
633
|
+
json!({
|
|
634
|
+
"reps": reps,
|
|
635
|
+
"warm_recall_no_commit": stats(&mut warm),
|
|
636
|
+
"warm_recall_after_the_catch_ups": stats(&mut warm_after),
|
|
637
|
+
"warm_recall_after_20ms_sleep_no_commit": stats(&mut idle),
|
|
638
|
+
"catch_up_empty_read_after_commit": stats(&mut empty),
|
|
639
|
+
"first_recall_after_catch_up": stats(&mut first),
|
|
640
|
+
"second_recall_after_catch_up": stats(&mut second),
|
|
641
|
+
"recall_as_first_call_after_commit": stats(&mut direct),
|
|
642
|
+
"rss_mb_before_after": [round(start.0), round(after.0)],
|
|
643
|
+
"footprint_mb_before_after": [start.1.map(round), after.1.map(round)],
|
|
644
|
+
"held_before_after": [held_start, held_after],
|
|
645
|
+
"catch_ups": counts,
|
|
646
|
+
"long_run": {
|
|
647
|
+
"commits": commits,
|
|
648
|
+
"recall_after_each_catch_up": stats(&mut long),
|
|
649
|
+
"catch_up_incremental": stats(&mut cu_inc),
|
|
650
|
+
"catch_up_full": stats(&mut cu_full),
|
|
651
|
+
"recall_after_incremental": stats(&mut rec_inc),
|
|
652
|
+
"recall_after_full": stats(&mut rec_full),
|
|
653
|
+
"rss_mb_before_after": [round(long_start.0), round(long_end.0)],
|
|
654
|
+
"footprint_mb_before_after": [long_start.1.map(round), long_end.1.map(round)],
|
|
655
|
+
"series": series,
|
|
656
|
+
"catch_ups": catch_ups(&a),
|
|
657
|
+
},
|
|
658
|
+
})
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/// Cell 12 (v0200-3): the control for cell 10's footprint, the same warm-up
|
|
662
|
+
/// and as many recalls as cell 10 makes, with no commit, so what the
|
|
663
|
+
/// recalls themselves fill (the vector column, the page cache) is measured
|
|
664
|
+
/// apart from what the catch-ups keep.
|
|
665
|
+
fn cell12(n: usize, reps: usize, scratch: &Path) -> Value {
|
|
666
|
+
let dir = tempfile::tempdir_in(scratch).unwrap();
|
|
667
|
+
let p = copy_of(dir.path(), n, "c12");
|
|
668
|
+
let mut rng = rand::rngs::StdRng::seed_from_u64(10);
|
|
669
|
+
let mut a = shared(&p);
|
|
670
|
+
for _ in 0..20 + 2 * reps {
|
|
671
|
+
let q = recall_req(&mut rng);
|
|
672
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
673
|
+
}
|
|
674
|
+
let start = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
675
|
+
for _ in 0..4 * reps {
|
|
676
|
+
let q = recall_req(&mut rng);
|
|
677
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
678
|
+
}
|
|
679
|
+
let after = (rss_kb() as f64 / 1024.0, footprint_mb());
|
|
680
|
+
json!({
|
|
681
|
+
"recalls": 4 * reps,
|
|
682
|
+
"rss_mb_before_after": [round(start.0), round(after.0)],
|
|
683
|
+
"footprint_mb_before_after": [start.1.map(round), after.1.map(round)],
|
|
684
|
+
})
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/// Cell 11 (v0200-3, addition (d)): what the first recall pays to rebuild
|
|
688
|
+
/// each lazily built part, dropped alone on a warm handle.
|
|
689
|
+
fn cell11(n: usize, reps: usize, scratch: &Path) -> Value {
|
|
690
|
+
let dir = tempfile::tempdir_in(scratch).unwrap();
|
|
691
|
+
let p = copy_of(dir.path(), n, "c11");
|
|
692
|
+
let mut rng = rand::rngs::StdRng::seed_from_u64(11);
|
|
693
|
+
let mut a = shared(&p);
|
|
694
|
+
for _ in 0..20 {
|
|
695
|
+
let q = recall_req(&mut rng);
|
|
696
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
697
|
+
}
|
|
698
|
+
let mut out = serde_json::Map::new();
|
|
699
|
+
for which in [
|
|
700
|
+
"none",
|
|
701
|
+
"key_index",
|
|
702
|
+
"superseded",
|
|
703
|
+
"layers",
|
|
704
|
+
"agent_set",
|
|
705
|
+
"bm25_stats",
|
|
706
|
+
"bm25_dicts",
|
|
707
|
+
"ann",
|
|
708
|
+
"column",
|
|
709
|
+
] {
|
|
710
|
+
let mut lat = Vec::new();
|
|
711
|
+
for _ in 0..reps {
|
|
712
|
+
if which != "none" {
|
|
713
|
+
a.read(|db| db.__drop_lazy_for_testing(which)).unwrap();
|
|
714
|
+
}
|
|
715
|
+
let q = recall_req(&mut rng);
|
|
716
|
+
let t = Instant::now();
|
|
717
|
+
a.read(|db| db.recall(&q)).unwrap();
|
|
718
|
+
lat.push(ms(t.elapsed()));
|
|
719
|
+
}
|
|
720
|
+
out.insert(which.into(), stats(&mut lat));
|
|
721
|
+
}
|
|
722
|
+
Value::Object(out)
|
|
723
|
+
}
|
|
724
|
+
|
|
437
725
|
/// Cell 8: the open wait under compaction: an opener against a compaction every
|
|
438
726
|
/// ~100 ms and three writers.
|
|
439
727
|
fn cell8(n: usize, secs: f64, scratch: &Path) -> Value {
|
|
@@ -471,6 +759,13 @@ fn main() {
|
|
|
471
759
|
.map(|c| c.parse().unwrap())
|
|
472
760
|
.collect();
|
|
473
761
|
let secs: f64 = arg("--secs", "8").parse().unwrap();
|
|
762
|
+
let commits: usize = arg("--commits", "0").parse().unwrap();
|
|
763
|
+
// Cell 10's loop count (default: 200 at 10K, 100 at 100K).
|
|
764
|
+
let reps10: Option<usize> = args
|
|
765
|
+
.iter()
|
|
766
|
+
.position(|a| a == "--reps")
|
|
767
|
+
.and_then(|i| args.get(i + 1))
|
|
768
|
+
.map(|r| r.parse().unwrap());
|
|
474
769
|
let out_path = arg("--out", "");
|
|
475
770
|
let scratch = PathBuf::from(arg(
|
|
476
771
|
"--scratch",
|
|
@@ -502,6 +797,24 @@ fn main() {
|
|
|
502
797
|
cell4(n, reps_for(n, 60), &scratch),
|
|
503
798
|
);
|
|
504
799
|
}
|
|
800
|
+
if cells.contains(&10) {
|
|
801
|
+
eprintln!("cell 10 at {n}");
|
|
802
|
+
cellv.insert(
|
|
803
|
+
"10_catch_up".into(),
|
|
804
|
+
cell10(n, reps10.unwrap_or(reps_for(n, 100) * 2), commits, &scratch),
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
if cells.contains(&12) {
|
|
808
|
+
eprintln!("cell 12 at {n}");
|
|
809
|
+
cellv.insert(
|
|
810
|
+
"12_recalls_alone".into(),
|
|
811
|
+
cell12(n, reps_for(n, 100) * 2, &scratch),
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
if cells.contains(&11) {
|
|
815
|
+
eprintln!("cell 11 at {n}");
|
|
816
|
+
cellv.insert("11_lazy_parts".into(), cell11(n, 20, &scratch));
|
|
817
|
+
}
|
|
505
818
|
let mixes: [(&str, &[(&str, usize)]); 4] = [
|
|
506
819
|
("1w_1r", &[("writer", 1), ("reader", 1)]),
|
|
507
820
|
("1w_7r", &[("writer", 1), ("reader", 7)]),
|
|
@@ -85,8 +85,9 @@ as if started in `<dir>`.
|
|
|
85
85
|
|
|
86
86
|
## 2. Use the tools
|
|
87
87
|
|
|
88
|
-
The MCP server is `mnemo serve --mcp
|
|
89
|
-
|
|
88
|
+
The MCP server is `mnemo serve --mcp`, in shared mode: each tool call
|
|
89
|
+
takes the brain's lock for itself, so several sessions and the CLI can use
|
|
90
|
+
one brain. `onboard` starts it for your client. The tools you'll use most:
|
|
90
91
|
|
|
91
92
|
| Tool | What it does |
|
|
92
93
|
|---|---|
|
|
@@ -1312,16 +1312,19 @@ enum Command {
|
|
|
1312
1312
|
/// Prevents a stuck child from freezing the MCP agent.
|
|
1313
1313
|
#[arg(long, default_value_t = 60)]
|
|
1314
1314
|
embed_timeout: u64,
|
|
1315
|
-
/// 12.4 shared mode: hold no lock between
|
|
1316
|
-
/// servers, the CLI and Python can use the file
|
|
1317
|
-
/// call takes the lock for itself, waiting up to
|
|
1318
|
-
///
|
|
1319
|
-
/// as before.
|
|
1315
|
+
/// 12.4 shared mode, the default since v0.20: hold no lock between
|
|
1316
|
+
/// tool calls, so other servers, the CLI and Python can use the file
|
|
1317
|
+
/// meanwhile; each tool call takes the lock for itself, waiting up to
|
|
1318
|
+
/// `--wait`. The flag is kept so configs that name it keep working.
|
|
1320
1319
|
#[arg(long)]
|
|
1321
1320
|
shared: bool,
|
|
1322
|
-
///
|
|
1323
|
-
///
|
|
1324
|
-
#[arg(long,
|
|
1321
|
+
/// Hold the file's lock for the server's whole life, as before v0.20:
|
|
1322
|
+
/// a second server or a CLI write on the same file gets `Locked`.
|
|
1323
|
+
#[arg(long, conflicts_with = "shared")]
|
|
1324
|
+
exclusive: bool,
|
|
1325
|
+
/// In shared mode: use it on a network or synced folder anyway,
|
|
1326
|
+
/// where the lock may not reach every process.
|
|
1327
|
+
#[arg(long, conflicts_with = "exclusive")]
|
|
1325
1328
|
allow_network_fs: bool,
|
|
1326
1329
|
},
|
|
1327
1330
|
/// 12.3 step 5: the built-in embedder (snowflake-arctic-embed-xs on
|
|
@@ -5510,7 +5513,8 @@ fn run() -> std::result::Result<(), String> {
|
|
|
5510
5513
|
embed_normalize,
|
|
5511
5514
|
embed_query,
|
|
5512
5515
|
embed_timeout,
|
|
5513
|
-
shared,
|
|
5516
|
+
shared: _,
|
|
5517
|
+
exclusive,
|
|
5514
5518
|
allow_network_fs,
|
|
5515
5519
|
} => {
|
|
5516
5520
|
if !mcp {
|
|
@@ -5522,7 +5526,8 @@ fn run() -> std::result::Result<(), String> {
|
|
|
5522
5526
|
// stdio JSON-RPC handshake. Stderr is safe for diagnostics.
|
|
5523
5527
|
let resolved = serve_path(&path)?;
|
|
5524
5528
|
let p = resolved.as_path();
|
|
5525
|
-
|
|
5529
|
+
// v0.20 (step 8): shared unless `--exclusive`.
|
|
5530
|
+
let shared = (!exclusive).then(|| {
|
|
5526
5531
|
let mut o = wait_opts();
|
|
5527
5532
|
o.allow_network_fs = allow_network_fs;
|
|
5528
5533
|
o
|
|
@@ -5541,7 +5546,21 @@ fn run() -> std::result::Result<(), String> {
|
|
|
5541
5546
|
(None, None) => serve_builtin(p, shared),
|
|
5542
5547
|
_ => return Err("--embed-cmd and --embed-name go together".into()),
|
|
5543
5548
|
}
|
|
5544
|
-
.map_err(
|
|
5549
|
+
.map_err(|e| {
|
|
5550
|
+
// v0.20: a bare `serve --mcp` is shared now, so a folder shared
|
|
5551
|
+
// mode refuses names the way to the old behaviour too.
|
|
5552
|
+
let refused = !exclusive && matches!(e, mnemo_engine::MnemoError::Unsupported(_));
|
|
5553
|
+
let msg = fmt(e);
|
|
5554
|
+
if refused {
|
|
5555
|
+
format!(
|
|
5556
|
+
"{msg} (serve --mcp is shared by default since v0.20: \
|
|
5557
|
+
--allow-network-fs uses shared mode anyway, \
|
|
5558
|
+
--exclusive holds the file for the server's whole life instead)"
|
|
5559
|
+
)
|
|
5560
|
+
} else {
|
|
5561
|
+
msg
|
|
5562
|
+
}
|
|
5563
|
+
})?;
|
|
5545
5564
|
}
|
|
5546
5565
|
Command::Onboard {
|
|
5547
5566
|
guide,
|