@chatpanel/events 0.68.0 → 0.68.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.
- package/library.js +13 -3
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -244,11 +244,21 @@ export function wordCount(text) {
|
|
|
244
244
|
return t ? t.split(/\s+/).length : 0;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Header lines the warm text form carries under its title — `Date: …`, `Platform: meet` —
|
|
249
|
+
* which are metadata, not the preview a row wants. A row already shows the date; a snippet
|
|
250
|
+
* that repeats it says nothing. `You:` / a speaker's name are NOT in this set on purpose:
|
|
251
|
+
* those lines are the content.
|
|
252
|
+
*/
|
|
253
|
+
const META_LINE_RE = /^(Date|Platform|Model|Agent|Tags|Source|Kind|Created|Updated|Started|Ended|Duration|Participants|Attendees|URL|Link):\s/i;
|
|
254
|
+
|
|
247
255
|
/** A short preview for a list row, so a list renders without opening every body. */
|
|
248
256
|
export function snippetOf(text, max = 110) {
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
const lines = str(text).split('\n');
|
|
258
|
+
if (lines.length === 1) return lines[0].replace(/[#*_`>~]+/g, '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
259
|
+
let i = 1; // the first line is the title
|
|
260
|
+
while (i < lines.length && (!lines[i].trim() || META_LINE_RE.test(lines[i].trim()))) i += 1;
|
|
261
|
+
const rest = lines.slice(i).join('\n');
|
|
252
262
|
return rest.replace(/[#*_`>~]+/g, '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
253
263
|
}
|
|
254
264
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.1",
|
|
4
4
|
"description": "The canonical ChatPanel event-log and capability contracts \u2014 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",
|