claude-code-watch 0.1.1 → 0.1.3
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/public/index.html +19 -3
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -407,6 +407,7 @@ body {
|
|
|
407
407
|
<button class="btn btn-icon accent" onclick="soloSelected()" data-tooltip="独显:只看选中项,再点恢复全显">⊙</button>
|
|
408
408
|
<button class="btn btn-icon danger" onclick="removeSelectedSession()" data-tooltip="移除:隐藏选中会话(24h)">✕</button>
|
|
409
409
|
<button class="btn btn-icon on" id="btn-activity" onclick="toggleActivity()" data-tooltip="活动:显示/隐藏操作摘要">💬</button>
|
|
410
|
+
<button class="btn btn-icon on" id="btn-token-display" onclick="toggleTokenDisplay()" data-tooltip="上下文:Token数 ↔ 百分比切换">T</button>
|
|
410
411
|
<span style="flex:1"></span>
|
|
411
412
|
<span id="tree-cursor-info" style="font-size:10px;color:var(--dim)"></span>
|
|
412
413
|
</div>
|
|
@@ -512,6 +513,7 @@ let showText = true;
|
|
|
512
513
|
let showHook = true;
|
|
513
514
|
let showUserPrompt = true;
|
|
514
515
|
let showActivity = true;
|
|
516
|
+
let showTokenCount = true;
|
|
515
517
|
let autoDiscovery = true;
|
|
516
518
|
let appVersion = '';
|
|
517
519
|
|
|
@@ -1078,7 +1080,11 @@ function getNodeHTML(node, idx) {
|
|
|
1078
1080
|
if (ctx && ctx.contextWindow > 0 && ctx.inputTokens > 0) {
|
|
1079
1081
|
const pct = Math.round(ctx.inputTokens / ctx.contextWindow * 100);
|
|
1080
1082
|
const cls = pct > 80 ? 'danger' : pct > 50 ? 'warn' : '';
|
|
1081
|
-
|
|
1083
|
+
if (showTokenCount) {
|
|
1084
|
+
ctxPct = `<span class="ctx-pct ${cls}">${fmtTok(ctx.inputTokens)}</span>`;
|
|
1085
|
+
} else {
|
|
1086
|
+
ctxPct = `<span class="ctx-pct ${cls}">${pct}%</span>`;
|
|
1087
|
+
}
|
|
1082
1088
|
}
|
|
1083
1089
|
const activeDot = ctx && (Date.now() - ctx.lastActivity < 120000) ? '<span class="active-dot on">🟢</span>' : '<span class="active-dot off">⚪</span>';
|
|
1084
1090
|
const actIcon = node.type === 'main' ? '🗣' : '⚡';
|
|
@@ -1375,6 +1381,10 @@ function refreshButtons() {
|
|
|
1375
1381
|
document.getElementById('btn-hook').classList.toggle('on', showHook);
|
|
1376
1382
|
document.getElementById('btn-user-prompt').classList.toggle('on', showUserPrompt);
|
|
1377
1383
|
document.getElementById('btn-activity').classList.toggle('on', showActivity);
|
|
1384
|
+
const btnTokenDisplay = document.getElementById('btn-token-display');
|
|
1385
|
+
btnTokenDisplay.classList.toggle('on', true);
|
|
1386
|
+
btnTokenDisplay.textContent = showTokenCount ? 'T' : '%';
|
|
1387
|
+
btnTokenDisplay.setAttribute('data-tooltip', showTokenCount ? '上下文:Token数 ↔ 百分比切换' : '上下文:百分比 ↔ Token数切换');
|
|
1378
1388
|
document.getElementById('btn-autoscroll').classList.toggle('on', autoScroll);
|
|
1379
1389
|
document.getElementById('btn-tree-toggle').classList.toggle('on', showTree);
|
|
1380
1390
|
document.getElementById('btn-autodisco').classList.toggle('on', autoDiscovery);
|
|
@@ -1614,6 +1624,12 @@ function toggleHook() { showHook = !showHook; needsFullRender = true;
|
|
|
1614
1624
|
function toggleUserPrompt() { showUserPrompt = !showUserPrompt; needsFullRender = true;
|
|
1615
1625
|
visibleDirty = true; renderStream(); refreshButtons(); }
|
|
1616
1626
|
function toggleActivity() { showActivity = !showActivity; rebuildNodes(); scheduleRender(); refreshButtons(); }
|
|
1627
|
+
function toggleTokenDisplay() {
|
|
1628
|
+
showTokenCount = !showTokenCount;
|
|
1629
|
+
treeDirty = true;
|
|
1630
|
+
scheduleRender();
|
|
1631
|
+
refreshButtons();
|
|
1632
|
+
}
|
|
1617
1633
|
function toggleAutoScroll() { autoScroll = !autoScroll; if (autoScroll) streamEl.scrollTop = streamEl.scrollHeight; renderAll(); }
|
|
1618
1634
|
function toggleTree() { showTree = !showTree; document.getElementById('tree-panel').classList.toggle('hidden', !showTree); }
|
|
1619
1635
|
function toggleAutoDiscovery() { sendCmd('toggleAutoDiscovery'); }
|
|
@@ -1786,8 +1802,8 @@ function fmtTimestamp(ts) {
|
|
|
1786
1802
|
function fmtTok(n) {
|
|
1787
1803
|
if (!n) return '0';
|
|
1788
1804
|
if (n < 1000) return String(n);
|
|
1789
|
-
if (n < 1000000) return (n / 1000).toFixed(
|
|
1790
|
-
return (n / 1000000).toFixed(
|
|
1805
|
+
if (n < 1000000) return (n / 1000).toFixed(2) + 'k';
|
|
1806
|
+
return (n / 1000000).toFixed(2) + 'm';
|
|
1791
1807
|
}
|
|
1792
1808
|
|
|
1793
1809
|
function renderAll() {
|