@chainlesschain/personal-data-hub 0.4.25 → 0.4.26
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/__tests__/analysis-skills.test.js +71 -2
- package/__tests__/analysis.test.js +46 -0
- package/__tests__/social-douyin-im-direct-read.test.js +69 -3
- package/__tests__/social-douyin-salvage-collector.test.js +98 -0
- package/__tests__/social-douyin-salvage-mapper.test.js +90 -0
- package/__tests__/social-weibo-sqlite-device.test.js +174 -0
- package/__tests__/sqlite-leaf-salvage.test.js +97 -0
- package/lib/adapters/social-douyin/index.js +56 -2
- package/lib/adapters/social-douyin-adb/collector.js +100 -0
- package/lib/adapters/social-douyin-adb/im-db-parser.js +85 -0
- package/lib/adapters/social-douyin-adb/index.js +5 -0
- package/lib/adapters/social-douyin-adb/salvage-mapper.js +119 -0
- package/lib/adapters/social-weibo/index.js +110 -30
- package/lib/analysis-skills/index.js +3 -0
- package/lib/analysis-skills/overview.js +157 -0
- package/lib/analysis.js +50 -0
- package/lib/forensics/leaf-salvage.js +185 -0
- package/lib/prompt-builder.js +9 -0
- package/package.json +1 -1
package/lib/prompt-builder.js
CHANGED
|
@@ -40,6 +40,7 @@ const FACT_BLOCK_FOOTER = "END FACTS.";
|
|
|
40
40
|
const NO_FACTS_HINT = "(FACTS is empty — the vault has nothing matching this question. Say so honestly.)";
|
|
41
41
|
const TOTALS_HEADER = "TOTALS (authoritative entity counts from vault — use these for count questions, NOT FACTS length):";
|
|
42
42
|
const AMOUNT_SUM_HEADER = "AMOUNT_SUM (authoritative SQL total of amount-bearing events — use for spending questions, NOT FACTS sums):";
|
|
43
|
+
const CROSS_APP_HEADER = "CROSS_APP_OVERVIEW (跨 app 汇聚画像 — 各 app 活跃度/类型/消费/高频联系人,回答跨 app 与决策类问题时优先参考;为汇总信号,非逐条事实):";
|
|
43
44
|
|
|
44
45
|
// ─── Fact summarization ─────────────────────────────────────────────────
|
|
45
46
|
|
|
@@ -134,6 +135,10 @@ function buildPrompt(opts) {
|
|
|
134
135
|
opts.vaultTotals && typeof opts.vaultTotals === "object" ? opts.vaultTotals : null;
|
|
135
136
|
const amountSummary =
|
|
136
137
|
opts.amountSummary && typeof opts.amountSummary === "object" ? opts.amountSummary : null;
|
|
138
|
+
const crossAppOverview =
|
|
139
|
+
typeof opts.crossAppOverview === "string" && opts.crossAppOverview.length > 0
|
|
140
|
+
? opts.crossAppOverview
|
|
141
|
+
: null;
|
|
137
142
|
|
|
138
143
|
const trimmed = facts.slice(0, maxFacts);
|
|
139
144
|
const summaries = trimmed
|
|
@@ -170,6 +175,10 @@ function buildPrompt(opts) {
|
|
|
170
175
|
if (amountSummary && Number.isFinite(amountSummary.total) && amountSummary.count > 0) {
|
|
171
176
|
userContent += `\n${AMOUNT_SUM_HEADER}\n${JSON.stringify(amountSummary, null, 2)}\n`;
|
|
172
177
|
}
|
|
178
|
+
// CROSS_APP_OVERVIEW — 跨 app 汇聚画像,置于 FACTS 前(同 TOTALS)。
|
|
179
|
+
if (crossAppOverview) {
|
|
180
|
+
userContent += `\n${CROSS_APP_HEADER}\n${crossAppOverview}\n`;
|
|
181
|
+
}
|
|
173
182
|
userContent += `\n${FACT_BLOCK_HEADER}\n${factBody}\n${FACT_BLOCK_FOOTER}${truncatedNote}\n\nUSER QUESTION: ${question}`;
|
|
174
183
|
|
|
175
184
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlesschain/personal-data-hub",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.26",
|
|
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",
|