glassbox-trace 0.6.0 → 0.6.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/dist/glassbox.html +9 -8
- package/package.json +1 -1
- package/src/trace-core.js +9 -8
package/dist/glassbox.html
CHANGED
|
@@ -402,7 +402,7 @@ kbd{font:11px var(--mono);border:1px solid var(--line);border-bottom-width:2px;b
|
|
|
402
402
|
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
|
|
403
403
|
'use strict';
|
|
404
404
|
|
|
405
|
-
const VERSION = '0.6.
|
|
405
|
+
const VERSION = '0.6.1';
|
|
406
406
|
|
|
407
407
|
// ---------------------------------------------------------------------------
|
|
408
408
|
// Rate card (USD per million tokens). Prefix-matched against model ids so dated
|
|
@@ -1544,19 +1544,20 @@ kbd{font:11px var(--mono);border:1px solid var(--line);border-bottom-width:2px;b
|
|
|
1544
1544
|
// Redaction — keep structure, timestamps, usage, tool names; blank every string.
|
|
1545
1545
|
// ---------------------------------------------------------------------------
|
|
1546
1546
|
const KEEP_KEYS = new Set(['type', 'subtype', 'role', 'name', 'id', 'tool_use_id', 'uuid', 'parentUuid', 'requestId', 'sessionId', 'session_id', 'agentId', 'timestamp', 'model', 'stop_reason', 'version', 'entrypoint', 'operation', 'trigger', 'status', 'level', 'userType', 'apiBlockIndex', 'isSidechain', 'isMeta', 'isCompactSummary', 'isApiErrorMessage', 'is_error', 'effort', 'permissionMode', 'promptSource', 'sourceToolAssistantUUID', 'promptId', 'leafUuid', 'toolUseID', 'agentType', 'toolUseId', 'spawnDepth']);
|
|
1547
|
-
|
|
1547
|
+
// Inside tool inputs and structured tool results every field is free-form, whatever it is called:
|
|
1548
|
+
// {"name": "Project Falcon"} is content, not structure. Only generated ids that link records survive there.
|
|
1549
|
+
const FREE_FORM_KEYS = new Set(['input', 'tool_input', 'toolUseResult']);
|
|
1550
|
+
const FREE_FORM_KEEP = new Set(['agentId', 'task_id', 'bash_id', 'tool_use_id', 'runId']);
|
|
1551
|
+
function redactValue(v, key, depth, freeForm) {
|
|
1548
1552
|
if (v == null) return v;
|
|
1549
1553
|
if (typeof v === 'string') {
|
|
1550
|
-
if (KEEP_KEYS.has(key)) return v;
|
|
1554
|
+
if ((freeForm ? FREE_FORM_KEEP : KEEP_KEYS).has(key)) return v;
|
|
1551
1555
|
return '«' + v.length + ' chars»';
|
|
1552
1556
|
}
|
|
1553
1557
|
if (typeof v !== 'object') return v; // numbers, booleans (usage stays)
|
|
1554
|
-
if (Array.isArray(v)) return v.map((x) => redactValue(x, key, depth + 1));
|
|
1558
|
+
if (Array.isArray(v)) return v.map((x) => redactValue(x, key, depth + 1, freeForm));
|
|
1555
1559
|
const out = {};
|
|
1556
|
-
for (const k of Object.keys(v))
|
|
1557
|
-
if (k === 'input' && key === undefined) { out[k] = redactValue(v[k], k, depth + 1); continue; }
|
|
1558
|
-
out[k] = redactValue(v[k], k, depth + 1);
|
|
1559
|
-
}
|
|
1560
|
+
for (const k of Object.keys(v)) out[k] = redactValue(v[k], k, depth + 1, freeForm || FREE_FORM_KEYS.has(k));
|
|
1560
1561
|
return out;
|
|
1561
1562
|
}
|
|
1562
1563
|
function redact(records) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glassbox-trace",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Other tools show what happened in a Claude Code session; Glassbox tells you what went wrong. Timeline, token and cost burn, auto-diagnostics with evidence and advice, session compare, live tail, a CLI and a Claude Code Stop hook that feeds the findings back to the agent.",
|
|
5
5
|
"main": "src/trace-core.js",
|
|
6
6
|
"scripts": {
|
package/src/trace-core.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
const VERSION = '0.6.
|
|
12
|
+
const VERSION = '0.6.1';
|
|
13
13
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
// Rate card (USD per million tokens). Prefix-matched against model ids so dated
|
|
@@ -1151,19 +1151,20 @@
|
|
|
1151
1151
|
// Redaction — keep structure, timestamps, usage, tool names; blank every string.
|
|
1152
1152
|
// ---------------------------------------------------------------------------
|
|
1153
1153
|
const KEEP_KEYS = new Set(['type', 'subtype', 'role', 'name', 'id', 'tool_use_id', 'uuid', 'parentUuid', 'requestId', 'sessionId', 'session_id', 'agentId', 'timestamp', 'model', 'stop_reason', 'version', 'entrypoint', 'operation', 'trigger', 'status', 'level', 'userType', 'apiBlockIndex', 'isSidechain', 'isMeta', 'isCompactSummary', 'isApiErrorMessage', 'is_error', 'effort', 'permissionMode', 'promptSource', 'sourceToolAssistantUUID', 'promptId', 'leafUuid', 'toolUseID', 'agentType', 'toolUseId', 'spawnDepth']);
|
|
1154
|
-
|
|
1154
|
+
// Inside tool inputs and structured tool results every field is free-form, whatever it is called:
|
|
1155
|
+
// {"name": "Project Falcon"} is content, not structure. Only generated ids that link records survive there.
|
|
1156
|
+
const FREE_FORM_KEYS = new Set(['input', 'tool_input', 'toolUseResult']);
|
|
1157
|
+
const FREE_FORM_KEEP = new Set(['agentId', 'task_id', 'bash_id', 'tool_use_id', 'runId']);
|
|
1158
|
+
function redactValue(v, key, depth, freeForm) {
|
|
1155
1159
|
if (v == null) return v;
|
|
1156
1160
|
if (typeof v === 'string') {
|
|
1157
|
-
if (KEEP_KEYS.has(key)) return v;
|
|
1161
|
+
if ((freeForm ? FREE_FORM_KEEP : KEEP_KEYS).has(key)) return v;
|
|
1158
1162
|
return '«' + v.length + ' chars»';
|
|
1159
1163
|
}
|
|
1160
1164
|
if (typeof v !== 'object') return v; // numbers, booleans (usage stays)
|
|
1161
|
-
if (Array.isArray(v)) return v.map((x) => redactValue(x, key, depth + 1));
|
|
1165
|
+
if (Array.isArray(v)) return v.map((x) => redactValue(x, key, depth + 1, freeForm));
|
|
1162
1166
|
const out = {};
|
|
1163
|
-
for (const k of Object.keys(v))
|
|
1164
|
-
if (k === 'input' && key === undefined) { out[k] = redactValue(v[k], k, depth + 1); continue; }
|
|
1165
|
-
out[k] = redactValue(v[k], k, depth + 1);
|
|
1166
|
-
}
|
|
1167
|
+
for (const k of Object.keys(v)) out[k] = redactValue(v[k], k, depth + 1, freeForm || FREE_FORM_KEYS.has(k));
|
|
1167
1168
|
return out;
|
|
1168
1169
|
}
|
|
1169
1170
|
function redact(records) {
|