@llmnesia/local-agent-host 0.3.5 → 0.3.7

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # LLMnesia local agent host
2
2
 
3
- A tiny local helper that lets the LLMnesia browser extension (1) index your local coding-agent sessions automatically: **Claude Code**, **Codex**, and **ZCode**, with no folder picking and no hidden-folder navigation, and (2) sync your LLMnesia conversation corpus for the [MCP companion](https://www.npmjs.com/package/@llmnesia/mcp) without the File System Access picker.
3
+ A tiny local helper that lets the LLMnesia browser extension (1) index your local coding-agent sessions automatically: **Claude Code**, **Codex**, **ZCode**, and **Mistral Vibe**, with no folder picking and no hidden-folder navigation, and (2) sync your LLMnesia conversation corpus for the [MCP companion](https://www.npmjs.com/package/@llmnesia/mcp) without the File System Access picker.
4
4
 
5
- It reads `.jsonl` session files under `~/.claude/projects` and `~/.codex/sessions`, and ZCode's session database at `~/.zcode/cli/db/db.sqlite` (opened read-only). It writes only inside the corpus root named in its own config (`~/.llmnesia/config.json`): there is no protocol field that lets a caller choose a different write location. It makes no network calls.
5
+ It reads `.jsonl` session files under `~/.claude/projects` and `~/.codex/sessions`, ZCode's session database at `~/.zcode/cli/db/db.sqlite` (opened read-only), and Mistral Vibe's per-session stores under `~/.vibe/logs/session/unified/` (read-only; each session is materialized into the same JSONL shape the extension parses). It writes only inside the corpus root named in its own config (`~/.llmnesia/config.json`): there is no protocol field that lets a caller choose a different write location. It makes no network calls.
6
6
 
7
7
  Claude Code project folders inside `~/.claude/projects` can be symbolic links to relocated folders. The helper reads session files directly inside each project folder without scanning nested folders. Broken or inaccessible project links are skipped and reported as a partial scan, so other projects can still sync.
8
8
 
@@ -65,7 +65,7 @@ If the extension's Settings page says the helper isn't answering, run:
65
65
  npx -y @llmnesia/local-agent-host@latest doctor
66
66
  ```
67
67
 
68
- It is read-only: checks the host script, each browser's manifest, `config.json`, whether Claude Code, Codex, and ZCode sessions were found, and pings the helper directly, and prints exactly which step is missing instead of a generic failure.
68
+ It is read-only: checks the host script, each browser's manifest, `config.json`, whether Claude Code, Codex, ZCode, and Mistral Vibe sessions were found, and pings the helper directly, and prints exactly which step is missing instead of a generic failure.
69
69
 
70
70
  ## Uninstall
71
71
 
@@ -84,7 +84,7 @@ delete the retained data too.
84
84
  Native messaging over stdio (little-endian uint32 length prefix + UTF-8 JSON):
85
85
 
86
86
  Helper 0.3.5 reports protocol version 5 and supplies per-source scan health for
87
- Claude Code, Codex and ZCode, plus each Claude Code and Codex session's size in bytes so the extension can skip sessions that were touched but not changed. It also discovers Claude Code projects relocated through symbolic links. To update the helper, run
87
+ Claude Code, Codex, ZCode and Mistral Vibe, plus each Claude Code and Codex session's size in bytes so the extension can skip sessions that were touched but not changed. It also discovers Claude Code projects relocated through symbolic links. To update the helper, run
88
88
  `npx -y @llmnesia/local-agent-host@0.3.5`, then fully quit and reopen the browser.
89
89
  MCP installers bundle their own helper copy. If an older MCP installer replaces
90
90
  this helper, run the standalone helper update again afterward.
@@ -92,7 +92,7 @@ Session files stream in bounded blocks with output backpressure, so a large sess
92
92
  Existing protocol-v4 helpers can still sync conversations; they cannot supply
93
93
  the new scan-health fields.
94
94
 
95
- - `{ cmd: "ping" }` → `{ type: "pong", version }`
95
+ - `{ cmd: "ping" }` → `{ type: "pong", version, projectCatchUp: 1 }`. Projects checks the explicit catch-up capability before offering agent launch. Older helpers without it show the update command instead.
96
96
  - `{ cmd: "list" }` → `{ type: "list", sessions: [{ sessionId, mtime, project }] }`
97
97
  - `{ cmd: "get", sessionId }` → `{ type: "chunk", sessionId, seq, total, data }` × N, then `{ type: "sessionDone", sessionId }`
98
98
  - `{ cmd: "corpusInfo" }` → `{ type: "corpusInfo", present: false }`, or `{ type: "corpusInfo", present: true, root }` if `~/.llmnesia/config.json` names a corpus
@@ -100,6 +100,35 @@ the new scan-health fields.
100
100
 
101
101
  `putChunk` is how the extension's service worker pushes corpus sync deltas without ever holding a File System Access handle. Deltas are sent as plain uncompressed NDJSON text (each `data` string is written verbatim into a `.jsonl` file the companion drains directly), so there is no base64 or gzip round-trip. The corpus root is written by the installer into `~/.llmnesia/config.json`.
102
102
 
103
+ ## Claude Code usage in Projects
104
+
105
+ With a current LLMnesia helper, the optional LLMnesia Usage plug-in shares
106
+ usage from local sessions in the Code tab of Claude Desktop. Begin or reopen a
107
+ local Code session after enabling the plug-in. Usage appears in Projects after
108
+ Claude replies on a plan that reports these limits.
109
+
110
+ The plug-in is in `claude-usage/`. To install it from this directory on a Mac
111
+ with Claude Code installed, use:
112
+
113
+ ```sh
114
+ claude plugin marketplace add "$PWD/claude-usage"
115
+ claude plugin install llmnesia-usage@llmnesia-local --scope user
116
+ ```
117
+
118
+ Terminal users can also opt in through Claude Code's
119
+ [status line settings](https://code.claude.com/docs/en/statusline).
120
+ Use this command as the status line, or pass the same input to it from an
121
+ existing status line script:
122
+
123
+ ```sh
124
+ "$HOME/.llmnesia/llmnesia-claude-host.mjs" --capture-claude-usage
125
+ ```
126
+
127
+ Projects shows the latest reading and its age. Only usage percentages, reset
128
+ times and the reading time are saved by the plug-in. Sharing requires no extra
129
+ model requests. To stop sharing, disable the plug-in or remove the status line
130
+ command, depending on which you use.
131
+
103
132
  ## Support
104
133
 
105
134
  If `doctor` does not resolve the problem, email [hello@llmnesia.com](mailto:hello@llmnesia.com) and paste its output.
package/install.mjs CHANGED
@@ -226,6 +226,12 @@ async function installWindows(manifestBase, hostPath, installDir, log) {
226
226
  return installed;
227
227
  }
228
228
 
229
+ /** The helper's `const PROTOCOL_VERSION = N`, or null when it has none. */
230
+ function hostProtocolVersion(source) {
231
+ const match = /^const PROTOCOL_VERSION = (\d+);$/m.exec(source);
232
+ return match ? Number(match[1]) : null;
233
+ }
234
+
229
235
  /**
230
236
  * Install (or update) the native-messaging host and its corpus config. Pure
231
237
  * function of its arguments — no process.argv/process.exit — so it can be
@@ -281,11 +287,20 @@ export async function installNativeHost({ ids = [], corpus, codexHome, force = f
281
287
  // Windows the .bat wrapper invokes node explicitly, so the shebang is unused.
282
288
  const hosted = isWindows ? hostSource : hostSource.replace(/^#![^\n]*\n/, `#!${process.execPath}\n`);
283
289
  const hostPath = join(installDir, "llmnesia-claude-host.mjs");
284
- await writeFile(hostPath, hosted, "utf8");
285
- if (!isWindows) {
286
- await chmod(hostPath, 0o755);
290
+ // Two packages install this helper (@llmnesia/local-agent-host and
291
+ // @llmnesia/mcp), each bundling its own copy. Never let the older bundle
292
+ // replace a helper that speaks a newer protocol: the extension relies on it.
293
+ const installedProtocol = hostProtocolVersion(await readFile(hostPath, "utf8").catch(() => ""));
294
+ const bundledProtocol = hostProtocolVersion(hostSource);
295
+ if (installedProtocol !== null && bundledProtocol !== null && installedProtocol > bundledProtocol) {
296
+ log(`✓ Helper already up to date (kept the newer protocol ${installedProtocol} helper)`);
297
+ } else {
298
+ await writeFile(hostPath, hosted, "utf8");
299
+ if (!isWindows) {
300
+ await chmod(hostPath, 0o755);
301
+ }
302
+ log("✓ Helper installed");
287
303
  }
288
- log("✓ Helper installed");
289
304
 
290
305
  const manifestBase = {
291
306
  name: HOST_NAME,