claude-code-watch 0.0.12 → 0.0.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/index.html +20 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-watch",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Web-based real-time monitor for Claude Code.",
5
5
  "main": "./src/server/server.js",
6
6
  "bin": {
package/public/index.html CHANGED
@@ -194,9 +194,11 @@ body {
194
194
  .stream-line.diag { color: var(--red); }
195
195
  .stream-line.debug { color: var(--gray); }
196
196
  .stream-line.marker { color: var(--dim); }
197
- .stream-line.agent-tag { font-weight: bold; }
197
+ .stream-line.agent-tag { font-weight: bold; display: flex; justify-content: space-between; align-items: baseline; white-space: nowrap; }
198
198
  .stream-line.agent-main { color: var(--blue); }
199
199
  .stream-line.agent-sub { color: var(--magenta); }
200
+ .stream-line.agent-tag .tag-label { flex-shrink: 0; }
201
+ .stream-line.agent-tag .timestamp { font-weight: normal; font-size: 0.85em; color: var(--dim); white-space: nowrap; }
200
202
  .stream-line.separator { color: var(--dim); }
201
203
 
202
204
  /* ── Footer ── */
@@ -894,14 +896,15 @@ function renderItem(item) {
894
896
  }
895
897
 
896
898
  const agentName = item.agentName || 'Main';
899
+ const tsHtml = item.timestamp ? `<span class="timestamp">${fmtTimestamp(item.timestamp)}</span>` : '';
897
900
 
898
901
  switch (item.type) {
899
902
  case 'thinking':
900
- lines.push({ cls: agentTagCls, text: agentName + sep + '🧠 Thinking' });
903
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + '🧠 Thinking')}</span>${tsHtml}`, html: true });
901
904
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line thinking', text: l });
902
905
  break;
903
906
  case 'tool_input':
904
- lines.push({ cls: agentTagCls, text: agentName + sep + `🔧 ${item.toolName || ''}` });
907
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + `🔧 ${item.toolName || ''}`)}</span>${tsHtml}`, html: true });
905
908
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line tool-input', text: l });
906
909
  break;
907
910
  case 'tool_output': {
@@ -911,33 +914,33 @@ function renderItem(item) {
911
914
  }
912
915
  let label = tn ? `📤 ${tn} result` : '📤 Output';
913
916
  if (item.durationMs > 0) label += ' ' + fmtDur(item.durationMs);
914
- lines.push({ cls: agentTagCls, text: agentName + sep + label });
917
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + label)}</span>${tsHtml}`, html: true });
915
918
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line tool-output', text: l });
916
919
  break;
917
920
  }
918
921
  case 'text':
919
- lines.push({ cls: agentTagCls, text: agentName + sep + '💬 Response' });
922
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + '💬 Response')}</span>${tsHtml}`, html: true });
920
923
  lines.push({ cls: 'stream-line text md-content', text: mdRender(item.content), html: true });
921
924
  break;
922
925
  case 'hook_output': {
923
926
  let label = '🪝 Hook';
924
927
  if (item.toolName) label += ' ' + item.toolName;
925
928
  if (item.durationMs > 0) label += ' ' + fmtDur(item.durationMs);
926
- lines.push({ cls: agentTagCls, text: agentName + sep + label });
929
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + label)}</span>${tsHtml}`, html: true });
927
930
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line hook', text: l });
928
931
  break;
929
932
  }
930
933
  case 'diagnostics': {
931
934
  let label = '⚠ Diagnostics';
932
935
  if (item.toolName) label += ' ' + item.toolName;
933
- lines.push({ cls: agentTagCls, text: agentName + sep + label });
936
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + label)}</span>${tsHtml}`, html: true });
934
937
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line diag', text: l });
935
938
  break;
936
939
  }
937
940
  case 'debug': {
938
941
  let label = '🔍 Debug';
939
942
  if (item.toolName) label += ' ' + item.toolName;
940
- lines.push({ cls: agentTagCls, text: agentName + sep + label });
943
+ lines.push({ cls: agentTagCls, text: `<span class="tag-label">${esc(agentName + sep + label)}</span>${tsHtml}`, html: true });
941
944
  for (const l of truncContent(item.content)) lines.push({ cls: 'stream-line debug', text: l });
942
945
  break;
943
946
  }
@@ -1272,6 +1275,15 @@ function fmtDur(ms) {
1272
1275
  return `(${(ms / 60000).toFixed(1)}m)`;
1273
1276
  }
1274
1277
 
1278
+ function fmtTimestamp(ts) {
1279
+ if (!ts) return '';
1280
+ const d = ts instanceof Date ? ts : new Date(ts);
1281
+ if (isNaN(d.getTime())) return '';
1282
+ const pad = (n, len) => String(n).padStart(len, '0');
1283
+ const ms = pad(d.getMilliseconds(), 3);
1284
+ return `${pad(d.getFullYear(),4)}-${pad(d.getMonth()+1,2)}-${pad(d.getDate(),2)} ${pad(d.getHours(),2)}:${pad(d.getMinutes(),2)}:${pad(d.getSeconds(),2)}.${ms}`;
1285
+ }
1286
+
1275
1287
  function fmtTok(n) {
1276
1288
  if (!n) return '0';
1277
1289
  if (n < 1000) return String(n);