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 +23 -0
- package/dist/src/model-router.js +10 -8
- package/dist/src/server.js +34 -12
- package/dist/test/model-router.test.js +14 -9
- package/dist/test/rest-setup.test.js +7 -0
- package/package.json +1 -1
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
|
package/dist/src/model-router.js
CHANGED
|
@@ -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:
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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:
|
|
59
|
-
medium: { model:
|
|
60
|
-
low: { model:
|
|
60
|
+
high: { model: primary, thinking: "medium" },
|
|
61
|
+
medium: { model: primary, thinking: "low" },
|
|
62
|
+
low: { model: primary, thinking: "off" },
|
|
61
63
|
},
|
|
62
64
|
},
|
|
63
65
|
};
|
package/dist/src/server.js
CHANGED
|
@@ -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
|
|
102
|
-
|
|
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"
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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
|
|
1081
|
-
|
|
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("
|
|
18
|
+
it("selects only explicit cloud fallbacks", () => {
|
|
19
19
|
const { fallbackSequence } = defaultModelRouterChoices();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
assert.ok(fallbackSequence.length > 0);
|
|
21
|
+
for (const model of fallbackSequence) {
|
|
22
|
+
assert.match(model, /(?:-cloud|:cloud)$/);
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
it("
|
|
25
|
+
it("uses the configured cloud fallback sequence", () => {
|
|
25
26
|
const { fallbackSequence } = defaultModelRouterChoices();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
"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",
|