@chatpanel/events 0.13.0 → 0.14.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/package.json +1 -1
- package/trajectory.js +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
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",
|
package/trajectory.js
CHANGED
|
@@ -44,7 +44,7 @@ export function displayName(call) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/** Entry kinds, in the order they conventionally appear. Used for grouping and colour. */
|
|
47
|
-
export const ENTRY_KINDS = Object.freeze(['system', 'user', 'context', 'route', 'tool', 'result', 'reasoning', 'assistant']);
|
|
47
|
+
export const ENTRY_KINDS = Object.freeze(['system', 'user', 'context', 'route', 'privacy', 'tool', 'result', 'reasoning', 'assistant']);
|
|
48
48
|
|
|
49
49
|
const short = (s, n = 120) => {
|
|
50
50
|
const t = String(s ?? '').replace(/\s+/g, ' ').trim();
|
|
@@ -92,6 +92,27 @@ export function buildTrajectory(events) {
|
|
|
92
92
|
});
|
|
93
93
|
break;
|
|
94
94
|
|
|
95
|
+
// WHAT LEFT THE DEVICE, AND IN WHAT SHAPE. A trajectory that shows the prompt, the
|
|
96
|
+
// tools and the answer but not the redaction cannot answer the question the product
|
|
97
|
+
// exists to answer — "what did the model actually see?". Counts by entity type only;
|
|
98
|
+
// the values are never in the event (see the privacy.redacted contract).
|
|
99
|
+
case 'privacy.redacted': {
|
|
100
|
+
const counts = p.counts || {};
|
|
101
|
+
const total = Object.values(counts).reduce((n, v) => n + (Number(v) || 0), 0);
|
|
102
|
+
if (!total) break;
|
|
103
|
+
const byType = Object.entries(counts)
|
|
104
|
+
.sort((a, b) => b[1] - a[1])
|
|
105
|
+
.map(([type, n]) => `${n} ${type.toLowerCase().replace(/_/g, ' ')}`)
|
|
106
|
+
.join(' · ');
|
|
107
|
+
entries.push({
|
|
108
|
+
kind: 'privacy', at: e.at,
|
|
109
|
+
title: `Redacted ${total} value${total === 1 ? '' : 's'} before sending`,
|
|
110
|
+
detail: byType,
|
|
111
|
+
data: { counts },
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
|
|
95
116
|
case 'assistant.prompted':
|
|
96
117
|
entries.push({ kind: 'system', at: e.at, title: 'Prompt', detail: `${p.chars || 0} chars`, ref: p.ref, expandsToMessages: true });
|
|
97
118
|
break;
|