lumencode 1.3.2 → 1.3.4

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/public/config.js CHANGED
@@ -7,6 +7,8 @@ export const API = {
7
7
  SESSIONS: '/api/sessions',
8
8
  STEP_STATS: '/api/step-stats',
9
9
  HOOKS: '/api/hooks',
10
+ SMART_REPORT_TOOLS: '/api/smart-report/tools',
11
+ SMART_REPORT: '/api/smart-report',
10
12
  };
11
13
 
12
14
  // 灰阶色板(按视觉权重从重到轻)
@@ -141,4 +143,6 @@ export const STORAGE = {
141
143
  CONFIG: 'ccusage-config',
142
144
  THEME: 'lc-theme',
143
145
  SIDEBAR_COLLAPSED: 'ccusage-sidebar-collapsed',
146
+ SMART_REPORT_AGENT: 'lc-smart-report-agent',
147
+ SMART_REPORT_STYLE: 'lc-smart-report-style',
144
148
  };
package/public/index.html CHANGED
@@ -562,7 +562,6 @@
562
562
  <div style="display:flex;border:1px solid var(--border);border-radius:6px;overflow:hidden;">
563
563
  <button class="period-btn" :class="reportLevel === 'detailed' ? 'active' : ''" @click="setReportLevel('detailed')" style="border-left:none">详细 Detail</button>
564
564
  <button class="period-btn" :class="reportLevel === 'brief' ? 'active' : ''" @click="setReportLevel('brief')">简略 Brief</button>
565
- <button class="period-btn" :class="reportLevel === 'boss' ? 'active' : ''" @click="setReportLevel('boss')">汇报 Boss</button>
566
565
  </div>
567
566
  <button class="btn btn-outline" @click="copyReport()" style="display:inline-flex;align-items:center;gap:6px;">
568
567
  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
@@ -630,7 +629,22 @@
630
629
 
631
630
  <!-- Report Content -->
632
631
  <div style="margin-top:48px;display:grid;grid-template-columns:5fr 2fr;gap:24px;">
633
- <div class="work-report-content" id="reportContent" x-html="reportHtml"></div>
632
+ <div class="work-report-content report-content-frame" id="reportContent">
633
+ <div class="report-content-toggle">
634
+ <button class="report-toggle-btn" :class="reportContentMode === 'source' ? 'active' : ''" @click="setReportContentMode('source')">原报告</button>
635
+ <button class="report-toggle-btn" :class="reportContentMode === 'smart' ? 'active' : ''" @click="setReportContentMode('smart')" :disabled="!smartReportMarkdown">
636
+ <span>智能报告</span>
637
+ <span class="report-toggle-dot" x-show="smartReportNeedsUpdate" x-cloak></span>
638
+ </button>
639
+ </div>
640
+ <div x-show="reportContentMode === 'source'" x-html="reportHtml"></div>
641
+ <div x-show="reportContentMode === 'smart'" x-cloak>
642
+ <div class="smart-report-update-notice" x-show="smartReportNeedsUpdate" x-cloak>
643
+ 当前统计数据或原始报告已变化,这份 AI 报告可能不是最新内容。建议点击右侧“重新生成”更新。
644
+ </div>
645
+ <div x-html="smartReportHtml"></div>
646
+ </div>
647
+ </div>
634
648
 
635
649
  <!-- Sticky Meta Panel -->
636
650
  <aside>
@@ -639,6 +653,51 @@
639
653
  <span class="label">SUMMARY · 摘要</span>
640
654
  <p style="font-size:13px;line-height:1.7;opacity:0.85;margin-top:12px;" x-html="reportSummary"></p>
641
655
  </div>
656
+ <!-- Smart Report -->
657
+ <div class="card" style="padding:16px 20px;">
658
+ <div style="display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;">
659
+ <span class="label">SMART REPORT · 智能报告</span>
660
+ <span class="label" x-show="smartReportRecordMeta" x-text="smartReportRecordMeta"></span>
661
+ </div>
662
+ <p style="font-size:12px;line-height:1.6;opacity:0.7;margin-bottom:12px;">
663
+ 基于当前统计维度和工作汇报生成。智能体只接收受限统计上下文。
664
+ </p>
665
+ <div class="smart-agent-list">
666
+ <template x-for="agent in smartReportTools" :key="agent.name">
667
+ <button class="smart-agent-btn" :class="{ active: smartReportAgent === agent.name, unavailable: !agent.detected }" @click="setSmartReportAgent(agent.name)" :disabled="!agent.detected" :title="agent.detected ? agent.version : agent.error">
668
+ <span class="smart-agent-dot" :class="agent.detected ? 'available' : 'missing'"></span>
669
+ <span class="smart-agent-name" x-text="agent.displayName"></span>
670
+ <span class="smart-agent-status" x-text="agent.detected ? '可连接' : '未检测'"></span>
671
+ </button>
672
+ </template>
673
+ </div>
674
+ <button class="btn btn-primary" style="width:100%;justify-content:center;" @click="openSmartReportStyleModal()" :disabled="smartReportLoading || !smartReportAgent">
675
+ <span class="smart-report-spinner" x-show="smartReportLoading" x-cloak></span>
676
+ <span x-text="smartReportLoading ? '生成中...' : (smartReportMarkdown ? (smartReportNeedsUpdate ? '更新智能报告' : '重新生成') : '生成智能报告')"></span>
677
+ </button>
678
+ <div x-show="smartReportTools.length > 0 && !smartReportTools.some(agent => agent.detected)" x-cloak style="margin-top:12px;padding:10px 12px;border:1px solid var(--border);border-radius:6px;font-size:12px;line-height:1.6;opacity:0.75;">
679
+ 未检测到可用的本地智能体命令。请确认 Claude Code、Codex 或 OpenCode 已安装,并且对应命令在启动 LumenCode 的终端 PATH 中可用。
680
+ </div>
681
+ <div x-show="smartReportError" x-cloak style="margin-top:12px;padding:10px 12px;border:1px solid var(--dest);border-radius:6px;color:var(--dest);font-size:12px;" x-text="smartReportError"></div>
682
+ <div x-show="smartReportNeedsUpdate" x-cloak style="margin-top:12px;padding:10px 12px;border:1px solid var(--dest);border-radius:6px;color:var(--dest);font-size:12px;line-height:1.6;" x-text="smartReportUpdateMessage"></div>
683
+ <div class="smart-report-progress" x-show="smartReportLoading" x-cloak>
684
+ <div class="smart-report-progress-head">
685
+ <span x-text="smartReportStatusMessage || '正在调用本地智能体分析当前报告数据...'"></span>
686
+ <span class="font-mono" x-text="smartReportElapsedLabel"></span>
687
+ </div>
688
+ <div class="smart-report-progress-track" role="progressbar" aria-valuemin="0" aria-valuemax="100" :aria-valuenow="smartReportProgress" :aria-valuetext="smartReportProgress + '%'">
689
+ <span class="smart-report-progress-bar" :style="'width:' + smartReportProgress + '%'"></span>
690
+ </div>
691
+ <div class="smart-report-progress-foot">本地智能体生成时间受报告大小和模型响应影响,可刷新页面后继续查看。</div>
692
+ </div>
693
+ <div x-show="smartReportMarkdown" x-cloak style="margin-top:14px;display:flex;gap:8px;">
694
+ <button class="btn btn-outline" style="flex:1;justify-content:center;" @click="setReportContentMode('smart')">查看</button>
695
+ <button class="btn btn-outline" style="flex:1;justify-content:center;" @click="copySmartReport()">
696
+ <span x-text="smartReportCopied ? '已复制' : '复制'"></span>
697
+ </button>
698
+ <button class="btn btn-outline" @click="downloadSmartReport()">.md</button>
699
+ </div>
700
+ </div>
642
701
  <!-- Project Selector -->
643
702
  <div class="card" style="padding:16px 20px;" x-show="reportProjects.length > 1" x-cloak>
644
703
  <span class="label">PROJECTS · 项目</span>
@@ -677,6 +736,31 @@
677
736
  </div>
678
737
  </main>
679
738
 
739
+ <!-- ── Smart Report Style Modal ── -->
740
+ <div id="smart-report-style-modal" class="modal-overlay" x-show="smartReportStyleModalOpen" x-cloak>
741
+ <div class="modal-backdrop" @click="closeSmartReportStyleModal()"></div>
742
+ <div class="modal-panel" style="max-width:460px;">
743
+ <div class="modal-header">
744
+ <h3 style="font-size:15px;font-weight:500;">选择智能报告风格</h3>
745
+ <button class="rail-btn-icon" @click="closeSmartReportStyleModal()" style="color:var(--foreground);opacity:0.65;">
746
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
747
+ </button>
748
+ </div>
749
+ <div class="modal-body" style="padding:16px 24px;">
750
+ <div class="smart-report-style-options">
751
+ <button class="smart-report-style-option" :class="smartReportStyle === 'default' ? 'active' : ''" @click="confirmSmartReportStyle('default')">
752
+ <span class="smart-report-style-title">默认风格</span>
753
+ <span class="smart-report-style-desc">专业分析口径,强调数据摘要、工作亮点、关键洞察和风险建议。</span>
754
+ </button>
755
+ <button class="smart-report-style-option" :class="smartReportStyle === 'workhorse' ? 'active' : ''" @click="confirmSmartReportStyle('workhorse')">
756
+ <span class="smart-report-style-title">牛马</span>
757
+ <span class="smart-report-style-desc">面向领导汇报的表达倾向,突出工作投入、产出价值、风险兜底和下一步计划。</span>
758
+ </button>
759
+ </div>
760
+ </div>
761
+ </div>
762
+ </div>
763
+
680
764
  <!-- ── Hooks Confirm Modal ── -->
681
765
  <div id="hooksConfirmModal" class="modal-overlay" style="display:none;">
682
766
  <div class="modal-backdrop" @click="hideHooksConfirmModal()"></div>
@@ -855,4 +939,3 @@
855
939
  <script type="module" src="/app.js"></script>
856
940
  </body>
857
941
  </html>
858
-
package/public/style.css CHANGED
@@ -1181,6 +1181,208 @@ input, textarea { font-family: inherit; color: inherit; }
1181
1181
  opacity: 0.8;
1182
1182
  }
1183
1183
 
1184
+ .report-content-frame {
1185
+ position: relative;
1186
+ padding-top: 76px;
1187
+ }
1188
+ .report-content-toggle {
1189
+ position: absolute;
1190
+ top: 24px;
1191
+ right: 24px;
1192
+ display: inline-flex;
1193
+ border: 1px solid var(--border);
1194
+ border-radius: 6px;
1195
+ overflow: hidden;
1196
+ background: var(--card);
1197
+ z-index: 1;
1198
+ }
1199
+ .report-toggle-btn {
1200
+ min-height: 30px;
1201
+ display: inline-flex;
1202
+ align-items: center;
1203
+ gap: 6px;
1204
+ padding: 6px 10px;
1205
+ border-left: 1px solid var(--border);
1206
+ font-size: 12px;
1207
+ color: var(--muted-foreground);
1208
+ transition: background 0.15s, color 0.15s;
1209
+ }
1210
+ .report-toggle-btn:first-child { border-left: none; }
1211
+ .report-toggle-btn:hover:not(:disabled) { background: var(--ink-8); color: var(--foreground); }
1212
+ .report-toggle-btn.active {
1213
+ background: var(--foreground);
1214
+ color: var(--background);
1215
+ }
1216
+ .report-toggle-btn:disabled {
1217
+ cursor: not-allowed;
1218
+ opacity: 0.45;
1219
+ }
1220
+ .report-toggle-dot {
1221
+ width: 6px;
1222
+ height: 6px;
1223
+ border-radius: 50%;
1224
+ background: var(--dest);
1225
+ }
1226
+ .smart-report-update-notice {
1227
+ margin-bottom: 18px;
1228
+ padding: 10px 12px;
1229
+ border: 1px solid var(--dest);
1230
+ border-radius: 6px;
1231
+ color: var(--dest);
1232
+ font-size: 13px;
1233
+ line-height: 1.6;
1234
+ background: color-mix(in srgb, var(--dest) 7%, transparent);
1235
+ }
1236
+
1237
+ .smart-agent-list {
1238
+ display: flex;
1239
+ flex-direction: column;
1240
+ gap: 8px;
1241
+ margin-bottom: 10px;
1242
+ }
1243
+ .smart-agent-btn {
1244
+ width: 100%;
1245
+ min-height: 34px;
1246
+ display: grid;
1247
+ grid-template-columns: 8px minmax(0, 1fr) auto;
1248
+ align-items: center;
1249
+ gap: 8px;
1250
+ padding: 8px 10px;
1251
+ border: 1px solid var(--border);
1252
+ border-radius: 6px;
1253
+ font-size: 12px;
1254
+ text-align: left;
1255
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
1256
+ }
1257
+ .smart-agent-btn:hover:not(:disabled) {
1258
+ background: var(--ink-8);
1259
+ }
1260
+ .smart-agent-btn.active {
1261
+ border-color: var(--foreground);
1262
+ background: var(--foreground);
1263
+ color: var(--background);
1264
+ }
1265
+ .smart-agent-btn.unavailable {
1266
+ cursor: not-allowed;
1267
+ opacity: 0.58;
1268
+ }
1269
+ .smart-agent-dot {
1270
+ width: 8px;
1271
+ height: 8px;
1272
+ border-radius: 50%;
1273
+ box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 10%, transparent);
1274
+ }
1275
+ .smart-agent-dot.available {
1276
+ background: #22c55e;
1277
+ }
1278
+ .smart-agent-dot.missing {
1279
+ background: var(--dest);
1280
+ }
1281
+ .smart-agent-name {
1282
+ min-width: 0;
1283
+ overflow: hidden;
1284
+ text-overflow: ellipsis;
1285
+ white-space: nowrap;
1286
+ }
1287
+ .smart-agent-status {
1288
+ font-size: 11px;
1289
+ opacity: 0.7;
1290
+ white-space: nowrap;
1291
+ }
1292
+ .smart-agent-btn.active .smart-agent-status {
1293
+ opacity: 0.82;
1294
+ }
1295
+ .smart-report-spinner {
1296
+ width: 12px;
1297
+ height: 12px;
1298
+ border: 2px solid currentColor;
1299
+ border-right-color: transparent;
1300
+ border-radius: 50%;
1301
+ animation: smart-report-spin 0.75s linear infinite;
1302
+ }
1303
+ @keyframes smart-report-spin {
1304
+ to { transform: rotate(360deg); }
1305
+ }
1306
+ .smart-report-progress {
1307
+ margin-top: 12px;
1308
+ padding: 12px;
1309
+ border: 1px solid var(--border);
1310
+ border-radius: 6px;
1311
+ background: var(--ink-4);
1312
+ }
1313
+ .smart-report-progress-head {
1314
+ display: flex;
1315
+ align-items: baseline;
1316
+ justify-content: space-between;
1317
+ gap: 12px;
1318
+ margin-bottom: 10px;
1319
+ font-size: 12px;
1320
+ line-height: 1.5;
1321
+ }
1322
+ .smart-report-progress-head .font-mono {
1323
+ flex: 0 0 auto;
1324
+ font-size: 11px;
1325
+ opacity: 0.62;
1326
+ }
1327
+ .smart-report-progress-track {
1328
+ position: relative;
1329
+ height: 7px;
1330
+ overflow: hidden;
1331
+ border-radius: 999px;
1332
+ background: color-mix(in srgb, var(--foreground) 10%, transparent);
1333
+ }
1334
+ .smart-report-progress-bar {
1335
+ position: absolute;
1336
+ inset: 0 auto 0 0;
1337
+ width: 0;
1338
+ border-radius: inherit;
1339
+ background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
1340
+ transition: width 0.7s ease;
1341
+ }
1342
+ .smart-report-progress-foot {
1343
+ margin-top: 9px;
1344
+ font-size: 11px;
1345
+ line-height: 1.5;
1346
+ opacity: 0.58;
1347
+ }
1348
+ .smart-report-style-options {
1349
+ display: grid;
1350
+ gap: 10px;
1351
+ }
1352
+ .smart-report-style-option {
1353
+ width: 100%;
1354
+ display: flex;
1355
+ flex-direction: column;
1356
+ gap: 6px;
1357
+ padding: 12px 14px;
1358
+ border: 1px solid var(--border);
1359
+ border-radius: 6px;
1360
+ background: transparent;
1361
+ color: var(--foreground);
1362
+ text-align: left;
1363
+ cursor: pointer;
1364
+ transition: background 0.15s, border-color 0.15s;
1365
+ }
1366
+ .smart-report-style-option:hover,
1367
+ .smart-report-style-option.active {
1368
+ border-color: var(--foreground);
1369
+ background: var(--ink-8);
1370
+ }
1371
+ .smart-report-style-title {
1372
+ font-size: 13px;
1373
+ font-weight: 500;
1374
+ }
1375
+ .smart-report-style-desc {
1376
+ font-size: 12px;
1377
+ line-height: 1.6;
1378
+ opacity: 0.68;
1379
+ }
1380
+ @media (prefers-reduced-motion: reduce) {
1381
+ .smart-report-progress-bar {
1382
+ transition: none;
1383
+ }
1384
+ }
1385
+
1184
1386
  /* ── Toast ── */
1185
1387
  .toast {
1186
1388
  position: fixed;