pi-vault-mind 0.12.2 → 0.12.9

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/dist/src/index.js CHANGED
@@ -13,7 +13,7 @@ import { registerIntakeTool } from "./intake.js";
13
13
  import { startServer, stopServer } from "./server.js";
14
14
  import { clearEngineStatus, clearWatcherStatus, registerStatusCapture, setEngineStatus, } from "./status.js";
15
15
  import { registerTools } from "./tools.js";
16
- import { EXT_ROOT, loadConfig } from "./utils.js";
16
+ import { EXT_ROOT, findConfig, loadConfig } from "./utils.js";
17
17
  import { registerVaultTools } from "./vault-tools.js";
18
18
  import { registerAllExtensionTools } from "./vm-handlers.js";
19
19
  import { startWatcher, stopWatcher, subscribeJobCompleted } from "./watcher.js";
@@ -37,12 +37,26 @@ export default function (pi) {
37
37
  * during extension loading — the runtime must be initialized first. */
38
38
  pi.on("session_start", async (_event, ctx) => {
39
39
  updateActiveCollectionWidget(ctx);
40
- /* Only enable ACM when vault is fully configured (setup has been run).
41
- * Fresh vaults should run /vm setup first ACM before setup is noise. */
40
+ /* Only enable ACM when THIS vault has been configured (setup has been run).
41
+ * Check the PROJECT config onlynot the merged global+project config.
42
+ * The global config may have remoteUrl/localUrl from other vaults, which
43
+ * would incorrectly trigger ACM on a fresh vault. */
44
+ const paths = findConfig(ctx.cwd);
45
+ const projectCfg = paths.project
46
+ ? (() => {
47
+ try {
48
+ return JSON.parse(fs.readFileSync(paths.project, "utf-8"));
49
+ }
50
+ catch {
51
+ return {};
52
+ }
53
+ })()
54
+ : {};
55
+ const projectEmbed = projectCfg.vaultMind?.embedding;
56
+ const isSetup = !!(projectEmbed?.remoteUrl || projectEmbed?.localUrl);
42
57
  const sessionCfg = loadConfig(ctx.cwd);
43
58
  const piCtxCfg = sessionCfg.extensionCompatibility?.["pi-context"];
44
- const isConfigured = !!(sessionCfg.vaultMind?.embedding?.remoteUrl || sessionCfg.vaultMind?.embedding?.localUrl);
45
- if (isConfigured && piCtxCfg?.enabled && piCtxCfg?.autoEnableAcm !== false) {
59
+ if (isSetup && piCtxCfg?.enabled && piCtxCfg?.autoEnableAcm !== false) {
46
60
  enableACM(pi);
47
61
  }
48
62
  /* register shortcut */
@@ -325,6 +325,20 @@ const probeModalModels = async (baseUrl, cfg) => {
325
325
  };
326
326
  export const setupWizard = async (ctx, cliArgs) => {
327
327
  const existingGlobal = fs.existsSync(getGlobalConfigPath());
328
+ // Check if THIS vault has already been configured (not just any global config)
329
+ const { project: existingProject } = findConfig(ctx.cwd);
330
+ const existingVaultCfg = existingProject
331
+ ? (() => {
332
+ try {
333
+ return JSON.parse(fs.readFileSync(existingProject, "utf-8"));
334
+ }
335
+ catch {
336
+ return {};
337
+ }
338
+ })()
339
+ : {};
340
+ const vaultAlreadyConfigured = !!(existingVaultCfg.vaultMind?.embedding?.remoteUrl ||
341
+ existingVaultCfg.vaultMind?.embedding?.localUrl);
328
342
  const detectedVaultPath = detectVaultFromCwd(ctx.cwd);
329
343
  // ── Non-interactive / CLI mode ──────────────────────────────────────────
330
344
  if (cliArgs && (cliArgs.vault || cliArgs.remoteUrl || cliArgs.localUrl || cliArgs.workspace)) {
@@ -397,8 +411,9 @@ export const setupWizard = async (ctx, cliArgs) => {
397
411
  ctx.ui.notify("Interactive setup requires a TUI session. Use CLI args for headless mode.", "error");
398
412
  return;
399
413
  }
400
- // If global config exists, offer status or re-setup
401
- if (existingGlobal) {
414
+ // Only offer View/Reconfigure if THIS vault has already been set up.
415
+ // Global config existence is irrelevant — we're fully vault-scoped.
416
+ if (vaultAlreadyConfigured) {
402
417
  const choice = await ctx.ui.select("pi-vault-mind Setup", [
403
418
  "View current config",
404
419
  "Reconfigure",
@@ -407,8 +422,8 @@ export const setupWizard = async (ctx, cliArgs) => {
407
422
  if (!choice || choice === "Exit")
408
423
  return;
409
424
  if (choice === "View current config") {
410
- const cfg = JSON.parse(fs.readFileSync(getGlobalConfigPath(), "utf-8"));
411
- ctx.ui.notify(JSON.stringify(cfg, null, 2), "info");
425
+ const cfg = loadConfig(ctx.cwd);
426
+ ctx.ui.notify(JSON.stringify(cfg.vaultMind ?? cfg, null, 2), "info");
412
427
  return;
413
428
  }
414
429
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-vault-mind",
3
- "version": "0.12.2",
3
+ "version": "0.12.9",
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",
@@ -28,6 +28,7 @@ rm -rf "$VAULT/collections"
28
28
  rm -f "$VAULT/_sync_state.json"
29
29
  rm -rf "$VAULT/.vault-mind"
30
30
  rm -f "$VAULT/.obsidian/plugins/vault-mind/data.json"
31
+ rm -f "$HOME/.pi/agent/vault-mind.config.json" # remove global config — vault-scoped only
31
32
 
32
33
  # Update plugin to latest build (if in the pi-vault-mind repo)
33
34
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"