@phren/cli 0.1.35 → 0.1.36
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/capabilities/web-ui.js +1 -1
- package/dist/data/access.js +26 -1
- package/dist/generated/memory-ui-graph.browser.js +5688 -294
- package/dist/hooks.d.ts +9 -0
- package/dist/hooks.js +17 -1
- package/dist/init/init-configure.js +13 -0
- package/dist/link/doctor.js +14 -1
- package/dist/memory-ui-graph.runtime.js +5688 -294
- package/dist/ui/data.d.ts +5 -0
- package/dist/ui/data.js +46 -7
- package/dist/ui/graph-chrome.d.ts +1 -0
- package/dist/ui/graph-chrome.js +163 -0
- package/dist/ui/graph.js +1 -1
- package/dist/ui/page.js +3 -0
- package/dist/ui/scripts.js +126 -19
- package/dist/ui/server.js +34 -2
- package/package.json +3 -4
|
@@ -29,7 +29,7 @@ export const webUiManifest = {
|
|
|
29
29
|
"search.history": { implemented: false, reason: "No search history in web UI" },
|
|
30
30
|
// Graph
|
|
31
31
|
"graph.read": { implemented: true, handler: "memory-ui-server.ts:/api/graph" },
|
|
32
|
-
"graph.visualize": { implemented: true, handler: "memory-ui-graph-app.ts:graph tab (
|
|
32
|
+
"graph.visualize": { implemented: true, handler: "memory-ui-graph-app.ts:graph tab (GraphRAG-style store>project>finding cages, Three.js / 3d-force-graph, CSS2D labels)" },
|
|
33
33
|
"graph.link_findings": { implemented: false, reason: "No link findings action in web UI" },
|
|
34
34
|
// Config
|
|
35
35
|
"config.get": { implemented: true, handler: "memory-ui-server.ts:/api/settings (read)" },
|
package/dist/data/access.js
CHANGED
|
@@ -58,6 +58,20 @@ function collectFindingBulletLines(lines) {
|
|
|
58
58
|
}
|
|
59
59
|
return bulletLines;
|
|
60
60
|
}
|
|
61
|
+
/** Bullet content with metadata comments removed — what the user actually sees. */
|
|
62
|
+
function bulletContentKey(line) {
|
|
63
|
+
return line.replace(/<!--.*?-->/g, " ").replace(/\s+/g, " ").trim();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Multiple matches are only truly ambiguous when their CONTENT differs. When a
|
|
67
|
+
* store carries literal duplicate bullets (same text, same tag), acting on the
|
|
68
|
+
* first occurrence is what the caller means — refusing made duplicate findings
|
|
69
|
+
* uneditable/undeletable from every host UI.
|
|
70
|
+
*/
|
|
71
|
+
function resolveDuplicateMatches(matches) {
|
|
72
|
+
const first = bulletContentKey(matches[0].line);
|
|
73
|
+
return matches.every(({ line }) => bulletContentKey(line) === first) ? matches[0] : null;
|
|
74
|
+
}
|
|
61
75
|
function findMatchingFindingBullet(bulletLines, needle, match) {
|
|
62
76
|
const fidNeedle = needle.replace(/^fid:/, "");
|
|
63
77
|
const fidMatch = /^[a-z0-9]{8}$/.test(fidNeedle)
|
|
@@ -70,11 +84,17 @@ function findMatchingFindingBullet(bulletLines, needle, match) {
|
|
|
70
84
|
if (exactMatches.length === 1)
|
|
71
85
|
return { kind: "found", idx: exactMatches[0].i };
|
|
72
86
|
if (exactMatches.length > 1) {
|
|
87
|
+
const dup = resolveDuplicateMatches(exactMatches);
|
|
88
|
+
if (dup)
|
|
89
|
+
return { kind: "found", idx: dup.i };
|
|
73
90
|
return { kind: "ambiguous", error: `"${match}" is ambiguous (${exactMatches.length} exact matches). Use a more specific phrase.` };
|
|
74
91
|
}
|
|
75
92
|
if (partialMatches.length === 1)
|
|
76
93
|
return { kind: "found", idx: partialMatches[0].i };
|
|
77
94
|
if (partialMatches.length > 1) {
|
|
95
|
+
const dup = resolveDuplicateMatches(partialMatches);
|
|
96
|
+
if (dup)
|
|
97
|
+
return { kind: "found", idx: dup.i };
|
|
78
98
|
return { kind: "ambiguous", error: `"${match}" is ambiguous (${partialMatches.length} partial matches). Use a more specific phrase.` };
|
|
79
99
|
}
|
|
80
100
|
return { kind: "not_found" };
|
|
@@ -399,7 +419,12 @@ export function editFinding(phrenPath, project, oldText, newText) {
|
|
|
399
419
|
const existing = lines[idx];
|
|
400
420
|
const metaMatch = existing.match(/(<!--.*?-->)/g);
|
|
401
421
|
const metaSuffix = metaMatch ? " " + metaMatch.join(" ") : "";
|
|
402
|
-
|
|
422
|
+
// Preserve the bullet's [tag] prefix: host UIs display (and send back)
|
|
423
|
+
// tag-stripped text, and losing the tag silently demoted the finding to
|
|
424
|
+
// untagged. Keep the old tag unless the new text supplies its own.
|
|
425
|
+
const existingTag = existing.match(/^-\s*(\[[a-z][a-z0-9_-]*\])\s/)?.[1];
|
|
426
|
+
const tagPrefix = existingTag && !/^\[[a-z][a-z0-9_-]*\]/.test(newTextTrimmed) ? `${existingTag} ` : "";
|
|
427
|
+
lines[idx] = `- ${tagPrefix}${newTextTrimmed}${metaSuffix}`;
|
|
403
428
|
const normalized = lines.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
404
429
|
const tmp = findingsPath + ".tmp." + process.pid;
|
|
405
430
|
fs.writeFileSync(tmp, normalized);
|