cc-viewer 1.0.8 → 1.0.9

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.
@@ -0,0 +1 @@
1
+ body{margin:0;background-color:#0d0d0d}*{scrollbar-width:thin;scrollbar-color:#3a3a3a #0d0d0d}*::-webkit-scrollbar{width:6px;height:6px}*::-webkit-scrollbar-track{background:#0d0d0d}*::-webkit-scrollbar-thumb{background:#3a3a3a;border-radius:3px}*::-webkit-scrollbar-thumb:hover{background:#555}.diff-view{background:#1a1a2e;border:1px solid #2a2a3e;border-radius:8px;padding:8px 12px}.diff-line-del{background:#ef444426;color:#fca5a5;padding:0 4px}.diff-line-add{background:#22c55e26;color:#86efac;padding:0 4px}.code-highlight{color:#e6edf3}.hl-keyword{color:#ff7b72}.hl-string{color:#a5d6ff}.hl-comment{color:#8b949e;font-style:italic}.hl-number{color:#79c0ff}.hl-linenum{color:#484f58;-webkit-user-select:none;user-select:none}.chat-md pre{background:#0d1117;border:1px solid #2a2a2a;border-radius:6px;padding:12px;overflow-x:auto;font-size:13px;line-height:1.5}.chat-md code{background:#1a1a2e;padding:2px 6px;border-radius:4px;font-size:13px;color:#e5e7eb}.chat-md pre code{background:none;padding:0}.chat-md p{margin:6px 0}.chat-md ul,.chat-md ol{padding-left:20px;margin:6px 0}.chat-md li{margin:2px 0}.chat-md h1,.chat-md h2,.chat-md h3{margin:12px 0 6px;color:#fff}.chat-md h1{font-size:1.3em}.chat-md h2{font-size:1.15em}.chat-md h3{font-size:1.05em}.chat-md blockquote{border-left:3px solid #3b82f6;margin:8px 0;padding:4px 12px;color:#9ca3af}.chat-md table{border-collapse:collapse;margin:8px 0;font-size:13px}.chat-md th,.chat-md td{border:1px solid #2a2a2a;padding:6px 10px}.chat-md th{background:#1a1a1a;color:#fff}.chat-md a{color:#60a5fa}.chat-md hr{border:none;border-top:1px solid #2a2a2a;margin:12px 0}.chat-md strong{color:#f1f5f9}.chat-md em{color:#cbd5e1}._headerBar_wnllt_2{display:flex;align-items:center;justify-content:space-between;width:100%;height:100%}._titleText_wnllt_11{color:#fff;font-size:18px;cursor:pointer}._titleArrow_wnllt_17{font-size:12px;margin-left:4px}._tokenStatsTag_wnllt_23{border-radius:12px;cursor:pointer;background:#2a2a2a;border:1px solid #3a3a3a;color:#ccc}._tokenStatsIcon_wnllt_31{margin-right:4px}._liveTag_wnllt_36{border-radius:12px}._liveTagText_wnllt_40{margin-left:4px}._countdownStrong_wnllt_45{font-variant-numeric:tabular-nums}._langSelector_wnllt_50,._settingsBtn_wnllt_61{color:#888;font-size:12px;cursor:pointer;-webkit-user-select:none;user-select:none;border:1px solid #555;border-radius:4px;padding:2px 8px}._settingsBtn_wnllt_61:hover{color:#bbb;border-color:#777}._settingsItem_wnllt_77{display:flex;justify-content:space-between;align-items:center;padding:12px 0}._settingsLabel_wnllt_84{font-size:14px}._tokenStatsEmpty_wnllt_89{padding:8px 4px;color:#999;font-size:13px}._tokenStatsContainer_wnllt_96{min-width:240px}._modelCard_wnllt_101{border:1px solid #333;border-radius:6px;padding:8px 10px}._modelCardSpaced_wnllt_107{margin-bottom:10px}._modelName_wnllt_113{font-size:13px;font-weight:600;color:#e5e5e5;margin-bottom:8px;padding-bottom:4px;border-bottom:1px solid #333}._statsTable_wnllt_123{width:100%;border-collapse:collapse}._th_wnllt_128{padding:2px 12px;font-size:12px;font-family:monospace;white-space:nowrap;color:#888;font-weight:400;text-align:right}._td_wnllt_138{padding:2px 12px;font-size:12px;font-family:monospace;white-space:nowrap;color:#e5e5e5;text-align:right}._label_wnllt_147{padding:2px 12px;font-size:12px;font-family:monospace;white-space:nowrap;color:#aaa;font-weight:400;text-align:left}._rowBorder_wnllt_157{border-bottom:1px solid #2a2a2a}._promptExportBar_wnllt_162{margin-bottom:12px}._promptScrollArea_wnllt_166{max-height:500px;overflow:auto}._promptEmpty_wnllt_171{color:#999;padding:12px}._promptTimestamp_wnllt_177{color:#666;font-size:12px;margin:12px 0 4px;padding-bottom:6px}._textPromptCard_wnllt_185{margin:4px 0;background:#141414;border-radius:6px;border:1px solid #303030;padding:10px 14px}._preText_wnllt_194{white-space:pre-wrap;word-break:break-word;font-size:13px;line-height:1.6;color:#d9d9d9;margin:4px 0}._systemCollapse_wnllt_204{margin:4px 0;background:#1a1a1a;border:1px solid #303030;border-radius:6px}._systemLabel_wnllt_211{color:#888;font-size:12px}._preSys_wnllt_216{white-space:pre-wrap;word-break:break-word;font-size:12px;line-height:1.5;color:#999;margin:0}._centerEmpty_1eo6z_1{display:flex;align-items:center;justify-content:center;height:100%}._scrollContainer_1eo6z_8{overflow:auto;height:100%}._listItem_1eo6z_13{cursor:pointer;padding:8px 12px;border-left:3px solid transparent;border-bottom:1px solid #1f1f1f;transition:background .15s}._listItem_1eo6z_13:hover{background:#151515}._listItemActive_1eo6z_25{background:#1a2332;border-left-color:#3b82f6}._listItemActive_1eo6z_25:hover{background:#1a2332}._itemContent_1eo6z_34{width:100%;min-width:0}._itemHeader_1eo6z_39{display:flex;align-items:center;gap:6px;margin-bottom:4px;font-size:12px}._tagNoMargin_1eo6z_47{margin:0;font-size:12px}._modelName_1eo6z_52{font-size:12px}._time_1eo6z_56{font-size:12px;color:#6b7280;margin-left:auto}._detailRow_1eo6z_62{display:flex;gap:8px;font-size:12px;align-items:center}._urlText_1eo6z_69{color:#555;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}._duration_1eo6z_78{color:#6b7280;flex-shrink:0}._statusOk_1eo6z_83{color:#10b981;flex-shrink:0}._statusErr_1eo6z_88{color:#ef4444;flex-shrink:0}._statusDefault_1eo6z_93{color:#9ca3af;flex-shrink:0}._usageBox_1eo6z_98{background:#111;border-radius:4px;padding:3px 6px;margin-top:4px;font-size:12px;color:#6b7280;line-height:1.6}._GzYRV{line-height:1.2;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}._3eOF8{margin-right:5px;font-weight:700}._3eOF8+._3eOF8{margin-left:-5px}._1MFti{cursor:pointer}._f10Tu{font-size:1.2em;margin-right:5px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._1UmXx:after{content:"▸"}._1LId0:after{content:"▾"}._1pNG9{margin-right:5px}._1pNG9:after{content:"...";font-size:.8em}._2IvMF{background:#eee}._2bkNM{margin:0;padding:0 10px}._1BXBN{margin:0;padding:0}._1MGIk{font-weight:600;margin-right:5px;color:#000}._3uHL6{color:#000}._2T6PJ,._1Gho6{color:#df113a}._vGjyY{color:#2a3f3c}._1bQdo{color:#0b75f5}._3zQKs{color:#469038}._1xvuR{color:#43413d}._oLqym,._2AXVT,._2KJWg{color:#000}._11RoI{background:#002b36}._17H2C,._3QHg2,._3fDAz{color:#fdf6e3}._2bSDX{font-weight:bolder;margin-right:5px;color:#fdf6e3}._gsbQL{color:#fdf6e3}._LaAZe,._GTKgm{color:#81b5ac}._Chy1W{color:#cb4b16}._2bveF{color:#d33682}._2vRm-{color:#ae81ff}._1prJR{color:#268bd2}._container_1h2lr_1{background:#0d1117;border-radius:6px;border:1px solid #2a2a2a;padding:12px;font-size:13px;font-family:monospace;overflow:auto}._container_1iit6_1{height:100%;overflow:auto;padding:0 16px}._emptyState_1iit6_7{display:flex;align-items:center;justify-content:center;height:100%}._urlSection_1iit6_14{padding:12px 0;border-bottom:1px solid #1f1f1f;display:flex;align-items:flex-start}._urlLeft_1iit6_21{flex:1;min-width:0}._tokenStatsBox_1iit6_26{flex-shrink:0;padding-left:12px;display:flex;align-items:center}._tokenGrid_1iit6_33{display:flex;border:1px solid #303030;border-radius:6px;overflow:hidden;min-width:360px;font-size:11px;line-height:1.6}._tokenRows_1iit6_43{flex:1}._tokenRow_1iit6_43{display:flex}._tokenRowBorder_1iit6_51{border-top:1px solid #303030}._tokenLabel_1iit6_55{color:#888;padding:4px 8px;white-space:nowrap;font-weight:600}._tokenTd_1iit6_62{flex:1;color:#d1d5db;text-align:right;padding:4px 8px;font-family:monospace;white-space:nowrap}._tokenHitRate_1iit6_71{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#d1d5db;padding:4px 8px;font-family:monospace;white-space:nowrap;border-left:1px solid #303030;min-width:100px}._tokenHitRateLabel_1iit6_84{color:#888;font-size:10px;font-family:sans-serif}._tokenRowBorder_1iit6_51 td{border-top:1px solid #303030}._urlText_1iit6_94{color:#d1d5db;font-size:13px;margin-bottom:8px;word-break:break-all}._metaText_1iit6_101,._headersContainer_1iit6_105{font-size:12px}._headerRow_1iit6_109{display:flex;padding:4px 0;border-bottom:1px solid #1f1f1f}._headerKey_1iit6_115{min-width:200px;flex-shrink:0}._headerValue_1iit6_120{word-break:break-all;margin-left:8px}._streamingBox_1iit6_125{padding:20px;background:#1a1a1a;border-radius:6px;border:1px solid #2a2a2a}._bodyToolbar_1iit6_132{display:flex;gap:8px;margin-bottom:8px}._rawTextPre_1iit6_138{background:#0d1117;border:1px solid #2a2a2a;border-radius:6px;padding:12px;font-size:12px;color:#e5e7eb;overflow:auto;max-height:600px;white-space:pre-wrap;word-break:break-all}._tabContent_1iit6_151{padding:12px 0}._collapseSpacing_1iit6_155{margin-bottom:16px}._bodyLabel_1iit6_159{margin:0}._bodyHeader_1iit6_163{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}._diffSection_1iit6_170{margin-bottom:16px}._diffToggle_1iit6_174{display:inline-block;margin-bottom:8px;cursor:pointer}._diffIcon_1iit6_180{font-size:12px;margin-left:4px}._wrapper_1o255_1{margin:6px 0}._header_1o255_5{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}._filePath_1o255_12{color:#a78bfa;font-size:12px;font-weight:600}._toggle_1o255_18{color:#6b7280;font-size:11px;cursor:pointer;-webkit-user-select:none;user-select:none}._code_1o255_25{margin:0;font-size:12px;line-height:1.5;overflow:auto}._plainResult_1uh60_1{background:#111;border-radius:6px;font-size:12px}._plainTitle_1uh60_7{font-size:11px}._plainPre_1uh60_11{color:#d1d5db;margin:0;white-space:pre-wrap;word-break:break-all;font-size:12px;padding:8px 12px}._codeResult_1uh60_20{background:#0d1117;border-radius:6px;border:1px solid #1e2a3a;overflow:hidden}._codeHeader_1uh60_27{display:flex;justify-content:space-between;align-items:center;padding:4px 10px;background:#161b22;border-bottom:1px solid #1e2a3a}._codeTitle_1uh60_36{font-size:11px;color:#8b949e}._codeToggle_1uh60_41{font-size:11px;color:#484f58;cursor:pointer;-webkit-user-select:none;user-select:none}._codePre_1uh60_48{margin:0;padding:8px 12px;font-size:12px;line-height:1.5;overflow:auto;max-height:500px}._markdownBody_1uh60_57{padding:8px 12px;font-size:13px;line-height:1.6;overflow:auto;max-height:500px}._avatar_1yei4_3{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}._avatarImg_1yei4_13{width:32px;height:32px;border-radius:50%;flex-shrink:0;object-fit:cover}._bubble_1yei4_21{border-radius:8px;padding:10px 14px;max-width:100%;font-size:14px;line-height:1.6;word-break:break-word}._messageRow_1yei4_32{display:flex;gap:10px;padding:8px 0}._messageRowEnd_1yei4_38{display:flex;gap:10px;padding:8px 0;justify-content:flex-end}._contentCol_1yei4_47{min-width:0;flex:1}._contentColLimited_1yei4_52{min-width:0;max-width:80%;width:fit-content}._labelRow_1yei4_60{display:flex;justify-content:space-between;align-items:center;margin-bottom:2px}._labelText_1yei4_67{font-size:11px}._timeText_1yei4_71{font-size:10px;color:#6b7280;flex-shrink:0;margin-left:8px}._timeTextNoMargin_1yei4_78{font-size:10px;color:#6b7280;flex-shrink:0}._labelTextRight_1yei4_84{font-size:11px;margin-left:auto}._bubbleUser_1yei4_91{background:#1668dc;color:#e5e7eb}._bubbleAssistant_1yei4_97{background:#141414;color:#e5e7eb}._bubblePlan_1yei4_103{background:#141428;border:5px solid #1668dc;font-size:12px;color:#e5e7eb}._bubbleSubAgent_1yei4_111{background:#1a1a2e;color:#e5e7eb}._bubbleSelection_1yei4_117{background:#1a3a1a;color:#e5e7eb}._systemTagLabel_1yei4_125{font-size:12px}._systemTagPre_1yei4_129{font-size:12px;color:#9ca3af;white-space:pre-wrap;word-break:break-all;margin:0}._collapseMargin_1yei4_137{margin:4px 0}._collapseNoMargin_1yei4_141{margin:0}._thinkingLabel_1yei4_147{font-size:12px}._toolBox_1yei4_153{background:#1a1a2e;border:1px solid #2a2a3e;border-radius:8px;padding:8px 12px;margin:6px 0;font-size:12px}._toolLabel_1yei4_162{color:#a78bfa}._codePre_1yei4_168{font-size:12px;margin:4px 0 0;white-space:pre-wrap;word-break:break-all;background:#0d1117;border-radius:4px;padding:6px 8px}._pathTag_1yei4_180{color:#7dd3fc;font-size:11px}._descSpan_1yei4_187{color:#6b7280;font-weight:400}._secondarySpan_1yei4_192{color:#6b7280}._patternSpan_1yei4_196{color:#fbbf24}._kvContainer_1yei4_202{margin-top:4px;font-size:11px}._kvItem_1yei4_207{margin:2px 0}._kvKey_1yei4_211{color:#7dd3fc}._kvValue_1yei4_215{color:#9ca3af}._toolResult_1yei4_221{background:#111827;border:1px solid #1e293b;border-radius:6px;padding:6px 10px;margin:2px 0 6px;font-size:11px}._toolResultLabel_1yei4_230{font-size:11px}._compactLabel_1yei4_236{font-size:12px;color:#93c5fd}._compactPre_1yei4_241{font-size:12px;color:#d1d5db;white-space:pre-wrap;word-break:break-all;margin:0}._optionList_1yei4_251{padding-left:8px}._optionDesc_1yei4_255{color:#555;margin-left:6px;font-weight:400}._questionText_1yei4_263{font-size:13px;color:#ccc;margin-bottom:4px}._questionSpacing_1yei4_269{margin-bottom:10px}._option_1yei4_251{font-size:12px;padding:1px 0}._centerEmpty_1j3v3_1{display:flex;align-items:center;justify-content:center;height:100%}._container_1j3v3_8{height:100%;overflow:auto;padding:16px 24px;display:flex;flex-direction:column}._sessionDividerText_1j3v3_16{font-size:11px;color:#555}._lastResponseLabel_1j3v3_21{font-size:11px}._resizer_yamj2_1{width:6px;cursor:col-resize;background:#1f1f1f;flex-shrink:0;transition:background .2s}._resizer_yamj2_1:hover{background:#3b82f6}._layout_11p5u_1{height:100vh;overflow:hidden}._header_11p5u_6{background:#111;border-bottom:1px solid #1f1f1f;padding:0 24px;height:60px;line-height:60px}._content_11p5u_14{flex:1;overflow:hidden}._mainContainer_11p5u_19{display:flex;height:100%}._leftPanel_11p5u_24{flex-shrink:0;border-right:1px solid #1f1f1f;display:flex;flex-direction:column;background:#0a0a0a}._leftPanelHeader_11p5u_32{padding:10px 16px;border-bottom:1px solid #1f1f1f;font-size:13px;color:#9ca3af;font-weight:500;display:flex;justify-content:space-between;align-items:center}._leftPanelCount_11p5u_43{font-size:12px;color:#555;font-weight:400}._leftPanelBody_11p5u_49{flex:1;overflow:hidden}._rightPanel_11p5u_54{flex:1;overflow:hidden;background:#0d0d0d}._modalActions_11p5u_60{margin-bottom:12px}._spinCenter_11p5u_64{text-align:center;padding:40px}._emptyCenter_11p5u_69{text-align:center;color:#999;padding:40px}._logListItem_11p5u_75{cursor:pointer;padding:8px 12px}._logItemRow_11p5u_80{display:flex;align-items:center;width:100%;justify-content:space-between}._logFileIcon_11p5u_87{margin-right:8px;color:#3b82f6}._folderIcon_11p5u_92{margin-right:8px}._logTag_11p5u_96{margin-left:8px}
package/dist/index.html CHANGED
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Claude Code Viewer</title>
7
7
 
8
- <script type="module" crossorigin src="/assets/index-Ck7EN__K.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-B9lsVJB8.css">
8
+ <script type="module" crossorigin src="/assets/index-DQK_3R38.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-q9WR6TTz.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/i18n.js CHANGED
@@ -4,22 +4,15 @@ import { dirname, join } from 'node:path';
4
4
 
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
 
7
- const SUPPORTED_LANGS = [
8
- 'zh', 'en', 'zh-TW', 'ko', 'de', 'es', 'fr', 'it', 'da', 'ja',
9
- 'pl', 'ru', 'ar', 'no', 'pt-BR', 'th', 'tr', 'uk',
10
- ];
11
-
12
- function loadLocale(lang) {
13
- try {
14
- return JSON.parse(readFileSync(join(__dirname, 'locales', `${lang}.json`), 'utf-8'));
15
- } catch {
16
- return {};
17
- }
18
- }
7
+ const i18nData = JSON.parse(readFileSync(join(__dirname, 'locales', 'i18n.json'), 'utf-8'));
19
8
 
9
+ // 将 { key: { lang: text } } 转换为 { lang: { key: text } }
20
10
  const locales = {};
21
- for (const lang of SUPPORTED_LANGS) {
22
- locales[lang] = loadLocale(lang);
11
+ for (const [key, translations] of Object.entries(i18nData)) {
12
+ for (const [lang, text] of Object.entries(translations)) {
13
+ if (!locales[lang]) locales[lang] = {};
14
+ locales[lang][key] = text;
15
+ }
23
16
  }
24
17
 
25
18
  let currentLang = 'zh';
package/interceptor.js CHANGED
@@ -22,12 +22,12 @@ function generateNewLogFilePath() {
22
22
  let cwd;
23
23
  try { cwd = process.cwd(); } catch { cwd = homedir(); }
24
24
  const projectName = basename(cwd).replace(/[^a-zA-Z0-9_\-\.]/g, '_');
25
- const dir = join(homedir(), '.claude', 'cc-viewer');
25
+ const dir = join(homedir(), '.claude', 'cc-viewer', projectName);
26
26
  try { mkdirSync(dir, { recursive: true }); } catch {}
27
27
  return { filePath: join(dir, `${projectName}_${ts}.jsonl`), dir, projectName };
28
28
  }
29
29
 
30
- // 查找同项目最近的日志文件,检查最后一条响应是否在1小时内
30
+ // 查找同项目最近的日志文件
31
31
  function findRecentLog(dir, projectName) {
32
32
  try {
33
33
  const files = readdirSync(dir)
@@ -35,22 +35,7 @@ function findRecentLog(dir, projectName) {
35
35
  .sort()
36
36
  .reverse();
37
37
  if (files.length === 0) return null;
38
- const latestFile = join(dir, files[0]);
39
- const content = readFileSync(latestFile, 'utf-8');
40
- const entries = content.split('\n---\n').filter(s => s.trim());
41
- // 从后往前找最后一条有 response 的记录
42
- for (let i = entries.length - 1; i >= 0; i--) {
43
- try {
44
- const entry = JSON.parse(entries[i]);
45
- if (entry.response) {
46
- const ts = new Date(entry.timestamp).getTime();
47
- if (Date.now() - ts < 3600000) {
48
- return latestFile;
49
- }
50
- return null;
51
- }
52
- } catch {}
53
- }
38
+ return join(dir, files[0]);
54
39
  } catch {}
55
40
  return null;
56
41
  }
@@ -138,7 +123,7 @@ const _initPromise = (async () => {
138
123
  } catch {}
139
124
  })();
140
125
 
141
- export { LOG_FILE, _initPromise, _resumeState, _choicePromise, resolveResumeChoice };
126
+ export { LOG_FILE, _initPromise, _resumeState, _choicePromise, resolveResumeChoice, _projectName };
142
127
 
143
128
  const MAX_LOG_SIZE = 200 * 1024 * 1024; // 200MB
144
129