pi-vault-mind 0.16.3 → 0.16.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.5 / 0.6.7 — 2026-07-18
4
+
5
+ ### Fixed
6
+
7
+ - **Vault-scoped runtime ownership.** The plugin serializes startup per vault, adopts only a healthy bridge for the same canonical vault, and uses the configured `vaultMind.files.serverState` discovery path. This prevents duplicate Pi runtime launches across plugin instances and reloads.
8
+ - **Post-setup chat handoff.** A successful setup refreshes the shared panel controller before revealing an existing Vault Mind leaf. The panel remains available with its retained status if that refresh transiently fails.
9
+ - **Setup REST identity.** `GET /vm/status` now returns the configured vault identity so the plugin can verify runtime ownership.
10
+
11
+ ### Tests
12
+
13
+ - Added focused coverage for same-vault startup serialization, custom runtime discovery paths, setup-to-chat refresh ordering, and mount-on-refresh-failure behavior.
14
+
15
+ ## 0.16.4 / 0.6.6 — 2026-07-17
16
+
17
+ ### Fixed
18
+
19
+ - **Obsidian-contained popovers.** Shared folder pickers now convert viewport anchor coordinates into the workspace leaf's fixed containing block, so their menus stay aligned with their input fields in the real Obsidian shell.
20
+ - **Cloud-only default chat routing.** New vault model-router configurations use `ollama/gemma4:31b-cloud` for every auto profile tier and explicit cloud fallbacks only. ReturnVape's active vault-local runtime configuration was migrated to remove local Gemma chat routes; local embedding models remain unchanged.
21
+
22
+ ### Tests
23
+
24
+ - Added focused regression coverage for contained popover placement and cloud-only model-router defaults/profiles.
25
+
3
26
  ## 0.16.3 / 0.6.5 — 2026-07-16
4
27
 
5
28
  ### Added
@@ -14,12 +14,14 @@ import * as fs from "node:fs";
14
14
  import { ensureDir, resolveVaultMindPaths } from "./utils.js";
15
15
  /** Tuned default primary model + fallback sequence for the `auto` router profile. */
16
16
  export const defaultModelRouterChoices = () => {
17
- const isMacOS = process.platform === "darwin";
18
17
  return {
19
18
  primary: "ollama/gemma4:31b-cloud",
20
- fallbackSequence: isMacOS
21
- ? ["ollama/gemma4:e4b", "ollama/gemma4:12b-mlx", "ollama/gemma3:4b", "ollama/*"]
22
- : ["ollama/gemma4:e4b", "ollama/gemma4:12b", "ollama/gemma3:4b", "ollama/*"],
19
+ fallbackSequence: [
20
+ "ollama/gemma4:31b-cloud",
21
+ "ollama/deepseek-v4-flash:cloud",
22
+ "ollama/minimax-m3:cloud",
23
+ "ollama/kimi-k2.7-code:cloud",
24
+ ],
23
25
  };
24
26
  };
25
27
  /**
@@ -32,7 +34,7 @@ export const scaffoldModelRouterConfig = (cwd) => {
32
34
  const { modelRouter: configPath } = resolveVaultMindPaths(cwd);
33
35
  if (fs.existsSync(configPath))
34
36
  return { created: false, path: configPath };
35
- const { primary: mediumModel, fallbackSequence } = defaultModelRouterChoices();
37
+ const { primary, fallbackSequence } = defaultModelRouterChoices();
36
38
  const config = {
37
39
  defaultProfile: "auto",
38
40
  features: {
@@ -55,9 +57,9 @@ export const scaffoldModelRouterConfig = (cwd) => {
55
57
  },
56
58
  profiles: {
57
59
  auto: {
58
- high: { model: "ollama/gemma4:31b-cloud", thinking: "medium" },
59
- medium: { model: mediumModel, thinking: "low" },
60
- low: { model: "ollama/gemma4:e4b", thinking: "off" },
60
+ high: { model: primary, thinking: "medium" },
61
+ medium: { model: primary, thinking: "low" },
62
+ low: { model: primary, thinking: "off" },
61
63
  },
62
64
  },
63
65
  };
@@ -98,8 +98,13 @@ export function startServer(pi, serverState, watcherState, readinessCallback) {
98
98
  // Resolve the vault path from the loaded config's default vault, else cwd.
99
99
  const startupCfg = loadConfig(process.cwd());
100
100
  const defaultVault = startupCfg.vaultMind.vaults?.default?.path;
101
- const vaultPath = defaultVault && fs.existsSync(defaultVault) ? defaultVault : process.cwd();
102
- serverState.vaultPath = vaultPath;
101
+ const configuredVaultPath = defaultVault && fs.existsSync(defaultVault) ? defaultVault : process.cwd();
102
+ try {
103
+ serverState.vaultPath = fs.realpathSync.native(configuredVaultPath);
104
+ }
105
+ catch {
106
+ serverState.vaultPath = path.resolve(configuredVaultPath);
107
+ }
103
108
  serverState.server = http.createServer(async (req, res) => {
104
109
  applyCorsPolicy(req.headers.origin, serverState.port, res);
105
110
  res.setHeader("Content-Type", "application/json");
@@ -750,15 +755,25 @@ export function startServer(pi, serverState, watcherState, readinessCallback) {
750
755
  res.end(JSON.stringify({ error: message }));
751
756
  }
752
757
  });
753
- let retriedEphemeral = false;
754
758
  serverState.server.on("error", (err) => {
755
- if (err.code === "EADDRINUSE" && !retriedEphemeral) {
756
- retriedEphemeral = true;
757
- console.warn(`[pi-vault-mind] Port ${serverState.port} in use; retrying on ephemeral port.`);
758
- serverState.server?.listen(0, "127.0.0.1");
759
- }
760
- else if (err.code === "EADDRINUSE") {
761
- console.warn(`[pi-vault-mind] Port ${serverState.port} in use. HTTP server not started.`);
759
+ if (err.code === "EADDRINUSE") {
760
+ console.warn(`[pi-vault-mind] Port ${serverState.port} in use; HTTP server not started.`);
761
+ if (serverState.unsubQueue) {
762
+ serverState.unsubQueue();
763
+ serverState.unsubQueue = undefined;
764
+ }
765
+ if (serverState.unsubToolBus) {
766
+ serverState.unsubToolBus();
767
+ serverState.unsubToolBus = undefined;
768
+ }
769
+ if (serverState.wss) {
770
+ serverState.wss.close();
771
+ serverState.wss = null;
772
+ }
773
+ if (serverState.server) {
774
+ serverState.server.close();
775
+ serverState.server = null;
776
+ }
762
777
  }
763
778
  else {
764
779
  console.error("[pi-vault-mind] HTTP server error:", err);
@@ -1077,14 +1092,21 @@ function handleVaultMindContextGet(res, serverState) {
1077
1092
  // ── Stage 1 setup routes (auth-gated) ───────────────────────────────────────
1078
1093
  function handleVmStatus(res, serverState) {
1079
1094
  const ws = serverState.watcherState;
1080
- const cfg = loadConfig(process.cwd());
1081
- const configured = !!findConfig(process.cwd()).project;
1095
+ const vaultPath = serverState.vaultPath;
1096
+ if (!vaultPath) {
1097
+ res.writeHead(500);
1098
+ res.end(JSON.stringify({ error: "Vault path not set" }));
1099
+ return;
1100
+ }
1101
+ const cfg = loadConfig(vaultPath);
1102
+ const configured = !!findConfig(vaultPath).project;
1082
1103
  const model = cfg.vaultMind.embedding[EMBEDDING_FLAT_KEYS[2]] || "embeddinggemma";
1083
1104
  const dim = cfg.vaultMind.embedding[EMBEDDING_FLAT_KEYS[4]] ?? 768;
1084
1105
  res.writeHead(200);
1085
1106
  res.end(JSON.stringify({
1086
1107
  ok: true,
1087
1108
  configured,
1109
+ vaultPath,
1088
1110
  watcher: ws?.running ?? false,
1089
1111
  embedding: {
1090
1112
  model,
@@ -15,19 +15,21 @@ describe("defaultModelRouterChoices", () => {
15
15
  assert.ok(Array.isArray(fallbackSequence));
16
16
  assert.equal(fallbackSequence.length, 4);
17
17
  });
18
- it("includes the common baseline entries regardless of platform", () => {
18
+ it("selects only explicit cloud fallbacks", () => {
19
19
  const { fallbackSequence } = defaultModelRouterChoices();
20
- for (const entry of ["ollama/gemma4:e4b", "ollama/gemma3:4b", "ollama/*"]) {
21
- assert.ok(fallbackSequence.includes(entry), `expected fallbackSequence to include ${entry}`);
20
+ assert.ok(fallbackSequence.length > 0);
21
+ for (const model of fallbackSequence) {
22
+ assert.match(model, /(?:-cloud|:cloud)$/);
22
23
  }
23
24
  });
24
- it("includes exactly one of the platform-specific mid-tier variants", () => {
25
+ it("uses the configured cloud fallback sequence", () => {
25
26
  const { fallbackSequence } = defaultModelRouterChoices();
26
- const macVariant = fallbackSequence.includes("ollama/gemma4:12b-mlx");
27
- const otherVariant = fallbackSequence.includes("ollama/gemma4:12b");
28
- // Exactly one of the two platform-specific entries is present — never both,
29
- // never neither — without hardcoding which platform CI happens to run on.
30
- assert.notEqual(macVariant, otherVariant);
27
+ assert.deepEqual(fallbackSequence, [
28
+ "ollama/gemma4:31b-cloud",
29
+ "ollama/deepseek-v4-flash:cloud",
30
+ "ollama/minimax-m3:cloud",
31
+ "ollama/kimi-k2.7-code:cloud",
32
+ ]);
31
33
  });
32
34
  });
33
35
  describe("scaffoldModelRouterConfig", () => {
@@ -83,6 +85,9 @@ describe("scaffoldModelRouterConfig", () => {
83
85
  assert.equal(typeof profile.model, "string");
84
86
  assert.equal(typeof profile.thinking, "string");
85
87
  }
88
+ for (const tier of ["high", "medium", "low"]) {
89
+ assert.equal(parsed.profiles.auto[tier].model, "ollama/gemma4:31b-cloud");
90
+ }
86
91
  });
87
92
  it("never overwrites an existing model-router.json (idempotent)", () => {
88
93
  const expectedPath = resolveVaultMindPaths(testDir).modelRouter;
@@ -81,6 +81,13 @@ describe("REST setup routes", () => {
81
81
  const { status } = await fetchJson(port, "GET", "/vm/status");
82
82
  assert.equal(status, 401);
83
83
  });
84
+ it("GET /vm/status returns the configured vault identity", async () => {
85
+ writeVaultConfig(vaultPath);
86
+ const { status, body } = await fetchJson(port, "GET", "/vm/status", { token: TEST_TOKEN });
87
+ assert.equal(status, 200);
88
+ const b = body;
89
+ assert.equal(b.vaultPath, vaultPath, "status must expose the resolved vault path so clients can recheck vault identity");
90
+ });
84
91
  it("POST /vm/setup scaffolds config and vault-named collection file", async () => {
85
92
  const { status, body } = await fetchJson(port, "POST", "/vm/setup", {
86
93
  body: { vault: vaultPath },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-vault-mind",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "description": "Passive Obsidian vault extension for pi. Watches @agent markers, dispatches forked subagents (Miner, Broadcaster, Heavy-Lifter), stores in LanceDB with vector + FTS + graph. Multi-agent 'Drop & Forget' workflow for the pi agent ecosystem.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",