@pencil-agent/nano-mem 0.0.1

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.
Files changed (93) hide show
  1. package/CLAUDE.md +258 -0
  2. package/README.md +146 -0
  3. package/dist/cli.d.ts +8 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +90 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config.d.ts +46 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +48 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/consolidation.d.ts +13 -0
  12. package/dist/consolidation.d.ts.map +1 -0
  13. package/dist/consolidation.js +111 -0
  14. package/dist/consolidation.js.map +1 -0
  15. package/dist/engine.d.ts +67 -0
  16. package/dist/engine.d.ts.map +1 -0
  17. package/dist/engine.js +492 -0
  18. package/dist/engine.js.map +1 -0
  19. package/dist/eviction.d.ts +16 -0
  20. package/dist/eviction.d.ts.map +1 -0
  21. package/dist/eviction.js +22 -0
  22. package/dist/eviction.js.map +1 -0
  23. package/dist/extension.d.ts +11 -0
  24. package/dist/extension.d.ts.map +1 -0
  25. package/dist/extension.js +264 -0
  26. package/dist/extension.js.map +1 -0
  27. package/dist/extraction.d.ts +10 -0
  28. package/dist/extraction.d.ts.map +1 -0
  29. package/dist/extraction.js +136 -0
  30. package/dist/extraction.js.map +1 -0
  31. package/dist/full-insights-html.d.ts +8 -0
  32. package/dist/full-insights-html.d.ts.map +1 -0
  33. package/dist/full-insights-html.js +311 -0
  34. package/dist/full-insights-html.js.map +1 -0
  35. package/dist/full-insights.d.ts +21 -0
  36. package/dist/full-insights.d.ts.map +1 -0
  37. package/dist/full-insights.js +327 -0
  38. package/dist/full-insights.js.map +1 -0
  39. package/dist/i18n.d.ts +50 -0
  40. package/dist/i18n.d.ts.map +1 -0
  41. package/dist/i18n.js +169 -0
  42. package/dist/i18n.js.map +1 -0
  43. package/dist/index.d.ts +18 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +14 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/insights-html.d.ts +8 -0
  48. package/dist/insights-html.d.ts.map +1 -0
  49. package/dist/insights-html.js +431 -0
  50. package/dist/insights-html.js.map +1 -0
  51. package/dist/linking.d.ts +11 -0
  52. package/dist/linking.d.ts.map +1 -0
  53. package/dist/linking.js +40 -0
  54. package/dist/linking.js.map +1 -0
  55. package/dist/privacy.d.ts +16 -0
  56. package/dist/privacy.d.ts.map +1 -0
  57. package/dist/privacy.js +52 -0
  58. package/dist/privacy.js.map +1 -0
  59. package/dist/scoring.d.ts +25 -0
  60. package/dist/scoring.d.ts.map +1 -0
  61. package/dist/scoring.js +63 -0
  62. package/dist/scoring.js.map +1 -0
  63. package/dist/store.d.ts +16 -0
  64. package/dist/store.d.ts.map +1 -0
  65. package/dist/store.js +68 -0
  66. package/dist/store.js.map +1 -0
  67. package/dist/types.d.ts +191 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +7 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/update.d.ts +14 -0
  72. package/dist/update.d.ts.map +1 -0
  73. package/dist/update.js +126 -0
  74. package/dist/update.js.map +1 -0
  75. package/package.json +60 -0
  76. package/src/cli.ts +99 -0
  77. package/src/config.ts +72 -0
  78. package/src/consolidation.ts +127 -0
  79. package/src/engine.ts +699 -0
  80. package/src/eviction.ts +30 -0
  81. package/src/extension.ts +290 -0
  82. package/src/extraction.ts +152 -0
  83. package/src/full-insights-html.ts +342 -0
  84. package/src/full-insights.ts +396 -0
  85. package/src/i18n.ts +233 -0
  86. package/src/index.ts +50 -0
  87. package/src/insights-html.ts +476 -0
  88. package/src/linking.ts +43 -0
  89. package/src/privacy.ts +52 -0
  90. package/src/scoring.ts +94 -0
  91. package/src/store.ts +84 -0
  92. package/src/types.ts +209 -0
  93. package/src/update.ts +141 -0
@@ -0,0 +1,311 @@
1
+ /**
2
+ * [INPUT]: FullInsightsReport, locale
3
+ * [OUTPUT]: Standalone HTML report with Remix Icon and charts
4
+ * [POS]: Pure renderer for full insights report
5
+ */
6
+ import { PROMPTS } from "./i18n.js";
7
+ function escapeHtml(str) {
8
+ return str
9
+ .replace(/&/g, "&")
10
+ .replace(/</g, "&lt;")
11
+ .replace(/>/g, "&gt;")
12
+ .replace(/"/g, "&quot;")
13
+ .replace(/'/g, "&#039;");
14
+ }
15
+ function formatDate(iso, locale) {
16
+ const d = new Date(iso);
17
+ if (Number.isNaN(d.getTime()))
18
+ return iso;
19
+ return d.toLocaleString(locale === "zh" ? "zh-CN" : "en-US");
20
+ }
21
+ const CHART_COLORS = {
22
+ tools: "#0891b2",
23
+ languages: "#10b981",
24
+ errors: "#dc2626",
25
+ };
26
+ function renderBarRows(chart) {
27
+ if (!chart.rows.length)
28
+ return "";
29
+ const max = Math.max(...chart.rows.map((r) => r.value), 1);
30
+ const color = CHART_COLORS[chart.id] ?? "#2563eb";
31
+ return chart.rows
32
+ .map((row) => `<div class="bar-row">
33
+ <div class="bar-label" title="${escapeHtml(row.label)}">${escapeHtml(row.label)}</div>
34
+ <div class="bar-track"><div class="bar-fill" style="width:${Math.max(8, Math.round((row.value / max) * 100))}%;background:${color}"></div></div>
35
+ <div class="bar-value">${row.value}</div>
36
+ </div>`)
37
+ .join("");
38
+ }
39
+ export function renderFullInsightsHtml(report, locale) {
40
+ const p = PROMPTS[locale] ?? PROMPTS.en;
41
+ const lang = locale === "zh" ? "zh-CN" : "en";
42
+ const sections = [];
43
+ // TOC links (only for sections we might render)
44
+ const tocLinks = [
45
+ '<a href="#section-glance"><i class="ri-dashboard-line"></i> ' + escapeHtml(p.fullInsightsAtAGlance) + "</a>",
46
+ '<a href="#section-work"><i class="ri-briefcase-4-line"></i> ' + escapeHtml(p.fullInsightsWorkOn) + "</a>",
47
+ ];
48
+ if (report.charts.length)
49
+ tocLinks.push('<a href="#section-charts"><i class="ri-bar-chart-box-line"></i> Charts</a>');
50
+ if (report.wins.length)
51
+ tocLinks.push('<a href="#section-wins"><i class="ri-trophy-line"></i> ' + escapeHtml(p.fullInsightsWins) + "</a>");
52
+ if (report.frictions.length)
53
+ tocLinks.push('<a href="#section-frictions"><i class="ri-error-warning-line"></i> ' + escapeHtml(p.fullInsightsFrictions) + "</a>");
54
+ if (report.recommendations.length)
55
+ tocLinks.push('<a href="#section-recommendations"><i class="ri-checkbox-circle-line"></i> ' + escapeHtml(p.fullInsightsRecommendations) + "</a>");
56
+ if (report.featuresToTry.length)
57
+ tocLinks.push('<a href="#section-features"><i class="ri-magic-line"></i> ' + escapeHtml(p.fullInsightsFeaturesToTry) + "</a>");
58
+ if (report.usagePatterns.length)
59
+ tocLinks.push('<a href="#section-patterns"><i class="ri-flow-chart"></i> ' + escapeHtml(p.fullInsightsUsagePatterns) + "</a>");
60
+ // Stats row
61
+ const statItems = [
62
+ { value: report.stats.totalSessions, label: "Sessions", icon: "ri-chat-3-line" },
63
+ { value: report.stats.episodes, label: "Episodes", icon: "ri-folder-line" },
64
+ { value: report.stats.knowledge, label: "Knowledge", icon: "ri-book-open-line" },
65
+ { value: report.stats.lessons, label: "Lessons", icon: "ri-lightbulb-line" },
66
+ { value: report.stats.work, label: "Work", icon: "ri-briefcase-line" },
67
+ { value: report.stats.facets, label: "Patterns/Struggles", icon: "ri-pie-chart-line" },
68
+ ];
69
+ const statsHtml = `<section class="stats-row">
70
+ ${statItems.map((s) => `<div class="stat"><i class="${s.icon} stat-icon"></i><div class="stat-value">${s.value}</div><div class="stat-label">${escapeHtml(s.label)}</div></div>`).join("\n")}
71
+ </section>`;
72
+ // At a Glance
73
+ const glanceHtml = `<section id="section-glance" class="at-a-glance">
74
+ <h2 class="glance-title"><i class="ri-dashboard-line"></i> ${escapeHtml(p.fullInsightsAtAGlance)}</h2>
75
+ <div class="glance-grid">
76
+ <article class="glance-card"><h3><i class="ri-checkbox-circle-line"></i> What's working</h3><p>${escapeHtml(report.atAGlance.working)}</p></article>
77
+ <article class="glance-card warn"><h3><i class="ri-error-warning-line"></i> What's hindering</h3><p>${escapeHtml(report.atAGlance.hindering)}</p></article>
78
+ <article class="glance-card"><h3><i class="ri-lightbulb-line"></i> Quick wins</h3><p>${escapeHtml(report.atAGlance.quickWins)}</p></article>
79
+ <article class="glance-card"><h3><i class="ri-rocket-line"></i> Ambitious</h3><p>${escapeHtml(report.atAGlance.ambitious)}</p></article>
80
+ </div>
81
+ </section>`;
82
+ // What You Work On
83
+ let workHtml = "";
84
+ if (report.projectAreas.length) {
85
+ workHtml = `<section id="section-work" class="section">
86
+ <h2><i class="ri-briefcase-4-line"></i> ${escapeHtml(p.fullInsightsWorkOn)}</h2>
87
+ <div class="project-list">
88
+ ${report.projectAreas
89
+ .map((a) => ` <article class="project-area">
90
+ <div class="area-header">
91
+ <span class="area-name">${escapeHtml(a.name)}</span>
92
+ <span class="area-count">~${a.sessionCount} ${escapeHtml(p.fullInsightsSubtitleSessions)}</span>
93
+ </div>
94
+ <p class="area-desc">${escapeHtml(a.description)}</p>
95
+ </article>`)
96
+ .join("\n")}
97
+ </div>
98
+ </section>`;
99
+ }
100
+ // Charts
101
+ let chartsHtml = "";
102
+ if (report.charts.length) {
103
+ chartsHtml = `<section id="section-charts" class="section">
104
+ <h2><i class="ri-bar-chart-box-line"></i> ${locale === "zh" ? "分布" : "Distribution"}</h2>
105
+ <div class="charts-row">
106
+ ${report.charts.map((chart) => ` <div class="chart-card">
107
+ <div class="chart-title">${escapeHtml(chart.title)}</div>
108
+ ${renderBarRows(chart)}
109
+ </div>`).join("\n")}
110
+ </div>
111
+ </section>`;
112
+ }
113
+ // Wins
114
+ let winsHtml = "";
115
+ if (report.wins.length) {
116
+ winsHtml = `<section id="section-wins" class="section">
117
+ <h2><i class="ri-trophy-line"></i> ${escapeHtml(p.fullInsightsWins)}</h2>
118
+ <div class="wins-list">
119
+ ${report.wins.map((w) => ` <article class="big-win"><div class="big-win-title">${escapeHtml(w.title)}</div><div class="big-win-desc">${escapeHtml(w.description)}</div></article>`).join("\n")}
120
+ </div>
121
+ </section>`;
122
+ }
123
+ // Frictions
124
+ let frictionsHtml = "";
125
+ if (report.frictions.length) {
126
+ frictionsHtml = `<section id="section-frictions" class="section">
127
+ <h2><i class="ri-error-warning-line"></i> ${escapeHtml(p.fullInsightsFrictions)}</h2>
128
+ <div class="friction-list">
129
+ ${report.frictions
130
+ .map((f) => ` <article class="friction-category">
131
+ <div class="friction-title">${escapeHtml(f.title)}</div>
132
+ <div class="friction-desc">${escapeHtml(f.description)}</div>
133
+ ${f.examples?.length ? `<ul class="friction-examples">${f.examples.map((e) => `<li>${escapeHtml(e)}</li>`).join("")}</ul>` : ""}
134
+ </article>`)
135
+ .join("\n")}
136
+ </div>
137
+ </section>`;
138
+ }
139
+ // Recommendations
140
+ let recHtml = "";
141
+ if (report.recommendations.length) {
142
+ recHtml = `<section id="section-recommendations" class="section">
143
+ <h2><i class="ri-checkbox-circle-line"></i> ${escapeHtml(p.fullInsightsRecommendations)}</h2>
144
+ <ul class="recommend-list">
145
+ ${report.recommendations.map((r) => ` <li>${escapeHtml(r)}</li>`).join("\n")}
146
+ </ul>
147
+ </section>`;
148
+ }
149
+ // Features to Try
150
+ let featuresHtml = "";
151
+ if (report.featuresToTry.length) {
152
+ featuresHtml = `<section id="section-features" class="section">
153
+ <h2><i class="ri-magic-line"></i> ${escapeHtml(p.fullInsightsFeaturesToTry)}</h2>
154
+ <div class="features-section">
155
+ ${report.featuresToTry
156
+ .map((f, i) => ` <article class="feature-card">
157
+ <div class="feature-title">${escapeHtml(f.title)}</div>
158
+ <div class="feature-oneliner">${escapeHtml(f.oneLiner)}</div>
159
+ <div class="feature-why">${escapeHtml(f.whyForYou)}</div>
160
+ ${f.exampleCode ? `<div class="feature-code"><code data-copy="feature-code-${i}">${escapeHtml(f.exampleCode)}</code><button type="button" class="copy-btn" data-copy-target="feature-code-${i}">${escapeHtml(p.fullInsightsCopy)}</button></div>` : ""}
161
+ </article>`)
162
+ .join("\n")}
163
+ </div>
164
+ </section>`;
165
+ }
166
+ // Usage Patterns
167
+ let patternsHtml = "";
168
+ if (report.usagePatterns.length) {
169
+ patternsHtml = `<section id="section-patterns" class="section">
170
+ <h2><i class="ri-flow-chart"></i> ${escapeHtml(p.fullInsightsUsagePatterns)}</h2>
171
+ <div class="patterns-section">
172
+ ${report.usagePatterns
173
+ .map((u, i) => ` <article class="pattern-card">
174
+ <div class="pattern-title">${escapeHtml(u.title)}</div>
175
+ <div class="pattern-summary">${escapeHtml(u.summary)}</div>
176
+ <div class="pattern-detail">${escapeHtml(u.detail)}</div>
177
+ ${u.pastePrompt ? `<div class="copyable-prompt-section"><div class="prompt-label">${escapeHtml(p.fullInsightsCopy)}</div><div class="copyable-prompt-row"><code class="copyable-prompt" data-copy="pattern-prompt-${i}">${escapeHtml(u.pastePrompt)}</code><button type="button" class="copy-btn" data-copy-target="pattern-prompt-${i}">${escapeHtml(p.fullInsightsCopy)}</button></div></div>` : ""}
178
+ </article>`)
179
+ .join("\n")}
180
+ </div>
181
+ </section>`;
182
+ }
183
+ // Behavioral patterns (raw list if any)
184
+ let rawPatternsHtml = "";
185
+ if (report.patterns.length) {
186
+ rawPatternsHtml = `<section class="section">
187
+ <h2><i class="ri-pie-chart-line"></i> ${escapeHtml(p.insightsSectionPatterns)}</h2>
188
+ <ul class="pattern-list">
189
+ ${report.patterns.slice(0, 8).map((pa) => ` <li><strong>${escapeHtml(pa.trigger)}</strong> → ${escapeHtml(pa.behavior)}</li>`).join("\n")}
190
+ </ul>
191
+ </section>`;
192
+ }
193
+ const css = `
194
+ *{box-sizing:border-box;margin:0;padding:0}
195
+ body{font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;background:#f8fafc;color:#334155;line-height:1.65;padding:48px 24px}
196
+ .container{max-width:800px;margin:0 auto}
197
+ h1{font-size:32px;font-weight:700;color:#0f172a;margin-bottom:8px}
198
+ h2{font-size:20px;font-weight:600;color:#0f172a;margin-top:32px;margin-bottom:16px}
199
+ h2.glance-title{font-size:16px;margin-top:0;color:#92400e}
200
+ h2 .ri{vertical-align:middle;margin-right:6px}
201
+ .subtitle{color:#64748b;font-size:15px;margin-bottom:24px}
202
+ .nav-toc{display:flex;flex-wrap:wrap;gap:8px;margin:24px 0 32px;padding:16px;background:#fff;border-radius:8px;border:1px solid #e2e8f0}
203
+ .nav-toc a{font-size:12px;color:#64748b;text-decoration:none;padding:6px 12px;border-radius:6px;background:#f1f5f9;transition:all .15s}
204
+ .nav-toc a:hover{background:#e2e8f0;color:#334155}
205
+ .nav-toc .ri{margin-right:4px;vertical-align:middle}
206
+ .stats-row{display:flex;gap:24px;margin-bottom:32px;padding:20px 0;border-top:1px solid #e2e8f0;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}
207
+ .stat{text-align:center}
208
+ .stat-icon{font-size:20px;color:#64748b;display:block;margin-bottom:4px}
209
+ .stat-value{font-size:24px;font-weight:700;color:#0f172a}
210
+ .stat-label{font-size:11px;color:#64748b;text-transform:uppercase}
211
+ .at-a-glance{background:linear-gradient(135deg,#fef3c7 0%,#fde68a 100%);border:1px solid #f59e0b;border-radius:12px;padding:20px 24px;margin-bottom:32px}
212
+ .glance-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
213
+ .glance-card{background:rgba(255,255,255,.6);border:1px solid rgba(245,158,11,.3);border-radius:8px;padding:14px}
214
+ .glance-card.warn{background:rgba(254,226,226,.7);border-color:#fca5a5}
215
+ .glance-card h3{font-size:13px;font-weight:600;color:#92400e;margin-bottom:8px}
216
+ .glance-card p{font-size:13px;color:#78350f;line-height:1.5;margin:0}
217
+ .section{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:20px;margin-bottom:24px}
218
+ .project-list,.wins-list,.friction-list{display:flex;flex-direction:column;gap:12px}
219
+ .project-area{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:16px}
220
+ .area-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
221
+ .area-name{font-weight:600;font-size:15px;color:#0f172a}
222
+ .area-count{font-size:12px;color:#64748b;background:#f1f5f9;padding:2px 8px;border-radius:4px}
223
+ .area-desc{font-size:14px;color:#475569;line-height:1.5}
224
+ .charts-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:24px}
225
+ .chart-card{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:16px}
226
+ .chart-title{font-size:12px;font-weight:600;color:#64748b;text-transform:uppercase;margin-bottom:12px}
227
+ .bar-row{display:flex;align-items:center;margin-bottom:6px}
228
+ .bar-label{width:100px;font-size:11px;color:#475569;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
229
+ .bar-track{flex:1;height:6px;background:#f1f5f9;border-radius:3px;margin:0 8px}
230
+ .bar-fill{height:100%;border-radius:3px}
231
+ .bar-value{width:28px;font-size:11px;font-weight:500;color:#64748b;text-align:right}
232
+ .big-win{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px}
233
+ .big-win-title{font-weight:600;font-size:15px;color:#166534;margin-bottom:8px}
234
+ .big-win-desc{font-size:14px;color:#15803d;line-height:1.5}
235
+ .friction-category{background:#fef2f2;border:1px solid #fca5a5;border-radius:8px;padding:16px}
236
+ .friction-title{font-weight:600;font-size:15px;color:#991b1b;margin-bottom:6px}
237
+ .friction-desc{font-size:13px;color:#7f1d1d;margin-bottom:10px}
238
+ .friction-examples{margin:0 0 0 20px;font-size:13px;color:#334155}
239
+ .recommend-list{margin:0;padding-left:20px}
240
+ .recommend-list li{margin-bottom:8px;font-size:14px;color:#334155}
241
+ .features-section,.patterns-section{display:flex;flex-direction:column;gap:12px}
242
+ .feature-card{background:#f0fdf4;border:1px solid #86efac;border-radius:8px;padding:16px}
243
+ .pattern-card{background:#f0f9ff;border:1px solid #7dd3fc;border-radius:8px;padding:16px}
244
+ .feature-title,.pattern-title{font-weight:600;font-size:15px;color:#0f172a;margin-bottom:6px}
245
+ .feature-oneliner,.pattern-summary{font-size:14px;color:#475569;margin-bottom:8px}
246
+ .feature-why,.pattern-detail{font-size:13px;color:#334155;line-height:1.5}
247
+ .feature-code{background:#f8fafc;padding:12px;border-radius:6px;margin-top:12px;border:1px solid #e2e8f0;display:flex;align-items:flex-start;gap:8px}
248
+ .feature-code code{flex:1;font-family:monospace;font-size:12px;white-space:pre-wrap}
249
+ .copyable-prompt-section{margin-top:12px;padding-top:12px;border-top:1px solid #e2e8f0}
250
+ .copyable-prompt-row{display:flex;align-items:flex-start;gap:8px}
251
+ .copyable-prompt{flex:1;background:#f8fafc;padding:10px 12px;border-radius:4px;font-family:monospace;font-size:12px;color:#334155;border:1px solid #e2e8f0;white-space:pre-wrap;line-height:1.5}
252
+ .prompt-label{font-size:11px;font-weight:600;text-transform:uppercase;color:#64748b;margin-bottom:6px}
253
+ .copy-btn{background:#e2e8f0;border:none;border-radius:4px;padding:4px 8px;font-size:11px;cursor:pointer;color:#475569;flex-shrink:0}
254
+ .copy-btn:hover{background:#cbd5e1}
255
+ .pattern-list{margin:0;padding-left:20px}
256
+ .pattern-list li{margin-bottom:6px;font-size:14px;color:#334155}
257
+ footer{margin-top:32px;text-align:center;font-size:12px;color:#94a3b8}
258
+ @media (max-width:640px){.charts-row{grid-template-columns:1fr}.stats-row{justify-content:center}}
259
+ `;
260
+ const copyScript = `
261
+ document.querySelectorAll('.copy-btn').forEach(function(btn){
262
+ btn.addEventListener('click', function(){
263
+ var id = this.getAttribute('data-copy-target');
264
+ var el = id ? document.querySelector('[data-copy="' + id + '"]') : null;
265
+ if (el) {
266
+ navigator.clipboard.writeText(el.textContent).then(function(){
267
+ var t = btn.textContent;
268
+ btn.textContent = '${escapeHtml(p.fullInsightsCopied)}';
269
+ setTimeout(function(){ btn.textContent = t; }, 2000);
270
+ });
271
+ }
272
+ });
273
+ });
274
+ `;
275
+ return `<!DOCTYPE html>
276
+ <html lang="${lang}">
277
+ <head>
278
+ <meta charset="utf-8" />
279
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
280
+ <title>${escapeHtml(p.fullInsightsTitle)}</title>
281
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
282
+ <link href="https://cdn.jsdelivr.net/npm/remixicon@4.9.0/fonts/remixicon.css" rel="stylesheet" />
283
+ <style>${css}</style>
284
+ </head>
285
+ <body>
286
+ <div class="container">
287
+ <h1><i class="ri-file-list-3-line"></i> ${escapeHtml(p.fullInsightsTitle)}</h1>
288
+ <p class="subtitle">${report.stats.totalSessions} ${escapeHtml(p.fullInsightsSubtitleSessions)} | ${escapeHtml(p.insightsGeneratedAt)}: ${escapeHtml(formatDate(report.generatedAt, locale))}</p>
289
+
290
+ <nav class="nav-toc">
291
+ ${tocLinks.map((link) => " " + link).join("\n")}
292
+ </nav>
293
+
294
+ ${statsHtml}
295
+ ${glanceHtml}
296
+ ${workHtml}
297
+ ${chartsHtml}
298
+ ${winsHtml}
299
+ ${frictionsHtml}
300
+ ${recHtml}
301
+ ${featuresHtml}
302
+ ${patternsHtml}
303
+ ${rawPatternsHtml}
304
+
305
+ <footer>${escapeHtml(p.fullInsightsGeneratedBy)} · ${escapeHtml(formatDate(report.generatedAt, locale))}</footer>
306
+ </div>
307
+ <script>${copyScript}</script>
308
+ </body>
309
+ </html>`;
310
+ }
311
+ //# sourceMappingURL=full-insights-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full-insights-html.js","sourceRoot":"","sources":["../src/full-insights-html.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,SAAS,UAAU,CAAC,GAAW;IAC9B,OAAO,GAAG;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3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,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;;YAE/F,UAAU;;QAEd,CAAC;AACT,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * [INPUT]: exportAll() result, optional LlmFn, locale
3
+ * [OUTPUT]: FullInsightsReport — stats, charts, narrative (LLM or rule fallback)
4
+ * [POS]: Aggregation + optional LLM for full insights report
5
+ */
6
+ import type { Episode, FullInsightsReport, LlmFn, MemoryEntry, WorkEntry } from "./types.js";
7
+ export interface ExportAllResult {
8
+ knowledge: MemoryEntry[];
9
+ lessons: MemoryEntry[];
10
+ preferences: MemoryEntry[];
11
+ facets: MemoryEntry[];
12
+ work: WorkEntry[];
13
+ episodes: Episode[];
14
+ meta: {
15
+ totalSessions: number;
16
+ lastConsolidation?: string;
17
+ version: number;
18
+ };
19
+ }
20
+ export declare function buildFullInsightsReport(all: ExportAllResult, llmFn: LlmFn | undefined, locale: string): Promise<FullInsightsReport>;
21
+ //# sourceMappingURL=full-insights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full-insights.d.ts","sourceRoot":"","sources":["../src/full-insights.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACX,OAAO,EAKP,kBAAkB,EAIlB,KAAK,EACL,WAAW,EAGX,SAAS,EACT,MAAM,YAAY,CAAC;AAiBpB,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7E;AAyPD,wBAAsB,uBAAuB,CAC5C,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,CA+F7B"}