knowmind 0.1.26 → 0.1.28

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,26 @@
1
1
  # Knowmind CLI — Änderungen
2
2
 
3
+ ## 0.1.28 (2026-07-16)
4
+
5
+ **`search`/`stats`/`health` tolerant gegen Präfixe im Tool-Text**
6
+ - Server-Versionen vom 16.07. stellten dem Recall-JSON zeitweise einen
7
+ Präsenz-Marker voran; `knowmind search` stürzte mit „Unexpected token ●"
8
+ ab. Der Client parst Tool-Antworten jetzt tolerant (ab der ersten
9
+ öffnenden Klammer). Serverseitig wurde der Marker ebenfalls entfernt.
10
+
11
+ ## 0.1.27 (2026-07-16)
12
+
13
+ **Windows: `login` erzeugte eine unlesbare config.json (P0)**
14
+ - Der NTFS-Lockdown vergab Datei-Rechte mit Vererbungsflags `(OI)(CI)` — auf
15
+ Dateien sind solche ACEs wirkungslos (Inherit-Only). Ergebnis: direkt nach
16
+ erfolgreichem `knowmind login` war die Config für alle Konten gesperrt und
17
+ jeder Folgebefehl endete mit „Kein Token konfiguriert", obwohl icacls Exit 0
18
+ meldete. Jetzt bekommen Dateien `:F` ohne Vererbungsflags, Ordner weiterhin
19
+ `:(OI)(CI)F`. Gefunden im E2E-Kundendurchlauf auf Windows 11 (Deutsch).
20
+ - Betroffen: jede Neuanmeldung unter Windows seit Einführung des Lockdowns.
21
+ Abhilfe für Betroffene: einmal `knowmind login --token …` mit 0.1.27
22
+ wiederholen (überschreibt die Config mit korrekten Rechten).
23
+
3
24
  ## 0.1.25 (2026-06-23)
4
25
 
5
26
  **Geführtes Onboarding nach `install`/`init`**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowmind",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
5
  "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
6
  "type": "module",
@@ -58,4 +58,4 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  }
61
- }
61
+ }
package/src/client.js CHANGED
@@ -27,6 +27,29 @@ async function rpc(method, params, options = {}) {
27
27
  return data.result;
28
28
  }
29
29
 
30
+ /**
31
+ * Tool-Text tolerant parsen: Server-Versionen vom 16.07.2026 stellten dem
32
+ * JSON zeitweise einen Präsenz-Marker („● knowmind · N Treffer") voran.
33
+ * Erst direkt parsen, sonst ab der ersten öffnenden Klammer.
34
+ */
35
+ function parseToolJson(text) {
36
+ try {
37
+ return JSON.parse(text);
38
+ } catch (err) {
39
+ for (const ch of ["{", "["]) {
40
+ const i = text.indexOf(ch);
41
+ if (i >= 0) {
42
+ try {
43
+ return JSON.parse(text.slice(i));
44
+ } catch {
45
+ /* nächster Kandidat */
46
+ }
47
+ }
48
+ }
49
+ throw err;
50
+ }
51
+ }
52
+
30
53
  export async function recall(query, { k = 5, hops = 2 } = {}) {
31
54
  const res = await rpc("tools/call", {
32
55
  name: "knowmind_recall",
@@ -35,17 +58,17 @@ export async function recall(query, { k = 5, hops = 2 } = {}) {
35
58
  // MCP-Antwort: { content: [{ type: "text", text: "<JSON>" }] }
36
59
  const text = res.content?.[0]?.text;
37
60
  if (!text) return null;
38
- return JSON.parse(text);
61
+ return parseToolJson(text);
39
62
  }
40
63
 
41
64
  export async function stats() {
42
65
  const res = await rpc("tools/call", { name: "knowmind_stats", arguments: {} });
43
- return JSON.parse(res.content?.[0]?.text ?? "{}");
66
+ return parseToolJson(res.content?.[0]?.text ?? "{}");
44
67
  }
45
68
 
46
69
  export async function health() {
47
70
  const res = await rpc("tools/call", { name: "knowmind_health", arguments: {} });
48
- return JSON.parse(res.content?.[0]?.text ?? "{}");
71
+ return parseToolJson(res.content?.[0]?.text ?? "{}");
49
72
  }
50
73
 
51
74
  /**
package/src/config.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * - Beim Start löschen wir Backup-Files (`config.json.bak*`,
15
15
  * `config.json.sc-backup`), die frühere Versionen hinterlassen haben.
16
16
  */
17
- import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, unlinkSync } from "node:fs";
17
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, unlinkSync, statSync } from "node:fs";
18
18
  import { homedir, userInfo, platform } from "node:os";
19
19
  import { join } from "node:path";
20
20
  import { spawnSync } from "node:child_process";
@@ -69,15 +69,21 @@ function _lockdown(target) {
69
69
  if (platform() !== "win32") return;
70
70
  try {
71
71
  const user = userInfo().username;
72
+ // (OI)(CI) gilt NUR für Ordner. Auf einer Datei erzeugen Vererbungsflags
73
+ // Inherit-Only-ACEs, die für die Datei selbst nicht greifen — Ergebnis
74
+ // wäre eine für ALLE (inkl. Besitzer) unlesbare config.json, obwohl
75
+ // icacls Exit 0 meldet. (E2E-Befund 2026-07-16: jeder frische
76
+ // `knowmind login` unter Windows machte die CLI unbrauchbar.)
77
+ const suffix = statSync(target).isDirectory() ? ":(OI)(CI)F" : ":F";
72
78
  // /reset alleine reicht nicht — die geerbten Berechtigungen müssen weg.
73
79
  spawnSync("icacls", [target, "/inheritance:r"], { stdio: "ignore" });
74
- spawnSync("icacls", [target, "/grant:r", `${user}:(OI)(CI)F`], { stdio: "ignore" });
75
- spawnSync("icacls", [target, "/grant:r", "SYSTEM:(OI)(CI)F"], { stdio: "ignore" });
76
- spawnSync("icacls", [target, "/grant:r", "Administratoren:(OI)(CI)F"], {
80
+ spawnSync("icacls", [target, "/grant:r", `${user}${suffix}`], { stdio: "ignore" });
81
+ spawnSync("icacls", [target, "/grant:r", `SYSTEM${suffix}`], { stdio: "ignore" });
82
+ spawnSync("icacls", [target, "/grant:r", `Administratoren${suffix}`], {
77
83
  stdio: "ignore",
78
84
  });
79
85
  // EN-Variante als Fallback (icacls akzeptiert beide nur in jeweiliger Locale)
80
- spawnSync("icacls", [target, "/grant:r", "Administrators:(OI)(CI)F"], {
86
+ spawnSync("icacls", [target, "/grant:r", `Administrators${suffix}`], {
81
87
  stdio: "ignore",
82
88
  });
83
89
  } catch {