@chainlesschain/personal-data-hub 0.3.8 → 0.3.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.
|
@@ -38,20 +38,40 @@ describe("summarizeFact", () => {
|
|
|
38
38
|
expect(s).not.toHaveProperty("extra");
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
it("packs person names + relation; omits source
|
|
41
|
+
it("packs person names + relation + identifiers + notes; omits source", () => {
|
|
42
|
+
// 2026-05-27 — identifiers (phone/wechatId/email) MUST reach the LLM,
|
|
43
|
+
// otherwise "妈手机号是多少" can never be answered even when vault has
|
|
44
|
+
// the phone. notes too — they're user-written context. source/ingestedAt
|
|
45
|
+
// are framing metadata, not user data, so still stripped.
|
|
42
46
|
const p = summarizePerson({
|
|
43
47
|
id: "p1",
|
|
44
48
|
type: "person",
|
|
45
49
|
subtype: "contact",
|
|
46
50
|
names: ["妈妈", "陈某某"],
|
|
47
51
|
relation: "母亲",
|
|
48
|
-
identifiers: { phone: ["13800001111"] },
|
|
52
|
+
identifiers: { phone: ["13800001111"], wechatId: "wxid_abc" },
|
|
53
|
+
notes: "best mom ever",
|
|
49
54
|
ingestedAt: 1,
|
|
50
55
|
source: { adapter: "x", adapterVersion: "0.1.0", capturedAt: 1, capturedBy: "api" },
|
|
51
56
|
});
|
|
52
57
|
expect(p.names).toEqual(["妈妈", "陈某某"]);
|
|
53
58
|
expect(p.relation).toBe("母亲");
|
|
59
|
+
expect(p.identifiers).toEqual({ phone: ["13800001111"], wechatId: "wxid_abc" });
|
|
60
|
+
expect(p.notes).toBe("best mom ever");
|
|
61
|
+
expect(p).not.toHaveProperty("source");
|
|
62
|
+
expect(p).not.toHaveProperty("ingestedAt");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("omits identifiers / notes fields when absent on the person row", () => {
|
|
66
|
+
const p = summarizePerson({
|
|
67
|
+
id: "p2",
|
|
68
|
+
type: "person",
|
|
69
|
+
subtype: "contact",
|
|
70
|
+
names: ["路人甲"],
|
|
71
|
+
});
|
|
54
72
|
expect(p).not.toHaveProperty("identifiers");
|
|
73
|
+
expect(p).not.toHaveProperty("notes");
|
|
74
|
+
expect(p).not.toHaveProperty("relation");
|
|
55
75
|
});
|
|
56
76
|
|
|
57
77
|
it("returns null for non-object / unknown types just yields minimal shape", () => {
|
package/lib/prompt-builder.js
CHANGED
|
@@ -67,12 +67,20 @@ function summarizeEvent(e) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function summarizePerson(p) {
|
|
70
|
+
// 2026-05-27 — include identifiers (phone / wechatId / email / etc.) +
|
|
71
|
+
// notes in the LLM-facing summary. Without this, asking "妈手机号是多少"
|
|
72
|
+
// ships only names+relation to the LLM and it can't possibly answer.
|
|
73
|
+
// Person rows are dense — keep all identifying fields. The LLM sees this
|
|
74
|
+
// verbatim under FACTS so user-visible privacy is the same as the user
|
|
75
|
+
// querying their own vault (which is the whole point of PDH).
|
|
70
76
|
return {
|
|
71
77
|
id: p.id,
|
|
72
78
|
type: "person",
|
|
73
79
|
subtype: p.subtype,
|
|
74
80
|
names: p.names,
|
|
75
81
|
...(p.relation ? { relation: p.relation } : {}),
|
|
82
|
+
...(p.identifiers ? { identifiers: p.identifiers } : {}),
|
|
83
|
+
...(p.notes ? { notes: p.notes } : {}),
|
|
76
84
|
};
|
|
77
85
|
}
|
|
78
86
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlesschain/personal-data-hub",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "Personal Data Hub — UnifiedSchema + validators + KG ingest helpers for the data-back-to-the-individual middleware",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "lib/index.js",
|