@delt/claude-alarm 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/dashboard/index.html +34 -30
- package/package.json +1 -1
- package/src/dashboard/index.html +34 -30
|
@@ -1368,36 +1368,40 @@
|
|
|
1368
1368
|
// --- Permission relay ---
|
|
1369
1369
|
function formatPermPreview(toolName, raw) {
|
|
1370
1370
|
if (!raw) return '';
|
|
1371
|
-
// Try JSON parse
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1371
|
+
// Try JSON parse first, then fallback to regex extraction for truncated JSON
|
|
1372
|
+
let p = null;
|
|
1373
|
+
try { p = JSON.parse(raw); } catch {
|
|
1374
|
+
// Truncated JSON - try to extract known fields with regex
|
|
1375
|
+
const cmdMatch = raw.match(/"command"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1376
|
+
const fileMatch = raw.match(/"file_path"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1377
|
+
const patternMatch = raw.match(/"pattern"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1378
|
+
if (cmdMatch) return '$ ' + cmdMatch[1];
|
|
1379
|
+
if (fileMatch) return fileMatch[1];
|
|
1380
|
+
if (patternMatch) return patternMatch[1];
|
|
1381
|
+
return raw.slice(0, 300);
|
|
1382
|
+
}
|
|
1383
|
+
switch (toolName) {
|
|
1384
|
+
case 'Bash':
|
|
1385
|
+
return p.command ? '$ ' + p.command : raw;
|
|
1386
|
+
case 'Write':
|
|
1387
|
+
case 'Edit':
|
|
1388
|
+
if (p.file_path) {
|
|
1389
|
+
let s = p.file_path;
|
|
1390
|
+
if (p.new_string) s += '\n+ ' + p.new_string.slice(0, 200);
|
|
1391
|
+
else if (p.content) s += '\n' + p.content.slice(0, 200);
|
|
1392
|
+
return s;
|
|
1393
|
+
}
|
|
1394
|
+
return raw;
|
|
1395
|
+
case 'Read':
|
|
1396
|
+
return p.file_path || raw;
|
|
1397
|
+
case 'Glob':
|
|
1398
|
+
return p.pattern || raw;
|
|
1399
|
+
case 'Grep':
|
|
1400
|
+
return (p.pattern || '') + (p.path ? ' in ' + p.path : '');
|
|
1401
|
+
default:
|
|
1402
|
+
const entries = Object.entries(p);
|
|
1403
|
+
if (entries.length <= 3) return entries.map(([k, v]) => k + ': ' + String(v).slice(0, 100)).join('\n');
|
|
1404
|
+
return JSON.stringify(p, null, 1).slice(0, 200);
|
|
1401
1405
|
}
|
|
1402
1406
|
}
|
|
1403
1407
|
|
package/package.json
CHANGED
package/src/dashboard/index.html
CHANGED
|
@@ -1368,36 +1368,40 @@
|
|
|
1368
1368
|
// --- Permission relay ---
|
|
1369
1369
|
function formatPermPreview(toolName, raw) {
|
|
1370
1370
|
if (!raw) return '';
|
|
1371
|
-
// Try JSON parse
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1371
|
+
// Try JSON parse first, then fallback to regex extraction for truncated JSON
|
|
1372
|
+
let p = null;
|
|
1373
|
+
try { p = JSON.parse(raw); } catch {
|
|
1374
|
+
// Truncated JSON - try to extract known fields with regex
|
|
1375
|
+
const cmdMatch = raw.match(/"command"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1376
|
+
const fileMatch = raw.match(/"file_path"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1377
|
+
const patternMatch = raw.match(/"pattern"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
1378
|
+
if (cmdMatch) return '$ ' + cmdMatch[1];
|
|
1379
|
+
if (fileMatch) return fileMatch[1];
|
|
1380
|
+
if (patternMatch) return patternMatch[1];
|
|
1381
|
+
return raw.slice(0, 300);
|
|
1382
|
+
}
|
|
1383
|
+
switch (toolName) {
|
|
1384
|
+
case 'Bash':
|
|
1385
|
+
return p.command ? '$ ' + p.command : raw;
|
|
1386
|
+
case 'Write':
|
|
1387
|
+
case 'Edit':
|
|
1388
|
+
if (p.file_path) {
|
|
1389
|
+
let s = p.file_path;
|
|
1390
|
+
if (p.new_string) s += '\n+ ' + p.new_string.slice(0, 200);
|
|
1391
|
+
else if (p.content) s += '\n' + p.content.slice(0, 200);
|
|
1392
|
+
return s;
|
|
1393
|
+
}
|
|
1394
|
+
return raw;
|
|
1395
|
+
case 'Read':
|
|
1396
|
+
return p.file_path || raw;
|
|
1397
|
+
case 'Glob':
|
|
1398
|
+
return p.pattern || raw;
|
|
1399
|
+
case 'Grep':
|
|
1400
|
+
return (p.pattern || '') + (p.path ? ' in ' + p.path : '');
|
|
1401
|
+
default:
|
|
1402
|
+
const entries = Object.entries(p);
|
|
1403
|
+
if (entries.length <= 3) return entries.map(([k, v]) => k + ': ' + String(v).slice(0, 100)).join('\n');
|
|
1404
|
+
return JSON.stringify(p, null, 1).slice(0, 200);
|
|
1401
1405
|
}
|
|
1402
1406
|
}
|
|
1403
1407
|
|