@chatpanel/events 0.53.0 → 0.54.0
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/knowledge.js +16 -7
- package/package.json +1 -1
package/knowledge.js
CHANGED
|
@@ -120,18 +120,27 @@ const isoDay = (ms) => (ms ? new Date(ms).toISOString().slice(0, 10) : '');
|
|
|
120
120
|
* (design §7.6 — no second retrieval stack), so it has to render to text like one.
|
|
121
121
|
*/
|
|
122
122
|
export function briefToText(brief) {
|
|
123
|
-
if (!brief) return '';
|
|
123
|
+
if (!brief?.subject?.name) return '';
|
|
124
|
+
// Every collection is read DEFENSIVELY. This used to assume the shape its own deriver
|
|
125
|
+
// produces, which was true while the only caller was that deriver — and stopped being true
|
|
126
|
+
// the moment briefs started arriving from a backup file, where a field can be absent
|
|
127
|
+
// because it was written by an older build. A missing `records` threw and took the whole
|
|
128
|
+
// restore's brief section with it.
|
|
124
129
|
const L = [`BRIEF: ${brief.subject.name}`];
|
|
125
|
-
|
|
126
|
-
L.push(`
|
|
130
|
+
const aliases = brief.subject.aliases;
|
|
131
|
+
if (Array.isArray(aliases) && aliases.length) L.push(`Also known as: ${aliases.join(', ')}`);
|
|
132
|
+
L.push(`Kind: ${brief.kind || 'topic'}`);
|
|
127
133
|
L.push('');
|
|
128
|
-
for (const c of brief.claims) {
|
|
134
|
+
for (const c of brief.claims || []) {
|
|
135
|
+
if (!c?.text) continue;
|
|
129
136
|
L.push(`- ${c.supersededBy ? '[superseded] ' : ''}${c.text}`);
|
|
130
|
-
|
|
137
|
+
const refs = Array.isArray(c.refs) ? c.refs : [];
|
|
138
|
+
if (refs.length) L.push(` (${refs.map((r) => `${r.kind}:${r.id}`).join(', ')})`);
|
|
131
139
|
}
|
|
132
|
-
|
|
140
|
+
const records = Array.isArray(brief.records) ? brief.records : [];
|
|
141
|
+
if (records.length) {
|
|
133
142
|
L.push('', 'RECORDS:');
|
|
134
|
-
for (const r of
|
|
143
|
+
for (const r of records.slice(-40).reverse()) L.push(`- ${r.type}: ${r.title || 'untitled'}`);
|
|
135
144
|
}
|
|
136
145
|
return L.join('\n').slice(0, MAX_BRIEF_CHARS);
|
|
137
146
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "The canonical ChatPanel event-log and capability contracts — typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|