@aiscene/aiserver 1.2.7 → 1.2.8

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.
@@ -429,9 +429,10 @@ const debugState = {
429
429
  selectedFolderId: null,
430
430
  // 历史
431
431
  history: [],
432
- // 实时报告
432
+ // 实时报告 - 存储每次收到的 dump 结果数组
433
433
  reportData: null, // { dump, sessionId, deviceId }
434
- executions: [], // 解析后的执行步骤
434
+ executions: [], // 解析后的执行步骤(当前选中的 dump)
435
+ executionHistory: [], // 历史 dump 列表 [{ id, name, tasks, timestamp, dump }]
435
436
  activeStepIndex: -1,
436
437
  reportPanelVisible: false,
437
438
  };
@@ -713,6 +714,7 @@ function clearTerminal() {
713
714
  debugState.reportPath = '';
714
715
  debugState.reportData = null;
715
716
  debugState.executions = [];
717
+ debugState.executionHistory = []; // 清空历史记录
716
718
  debugState.activeStepIndex = -1;
717
719
  const reportBody = document.getElementById('debug-report-body');
718
720
  if(reportBody) {
@@ -758,17 +760,30 @@ function updateReportDump(dumpStr, sessionId) {
758
760
  try { dump = JSON.parse(dump); } catch(e) { return; }
759
761
  }
760
762
 
761
- const executions = dump.executions || [];
762
763
  debugState.reportData = { dump, sessionId };
763
- debugState.executions = executions;
764
764
 
765
- // 自动选中最新步骤
766
- if(executions.length > 0 && debugState.activeStepIndex === -1) {
767
- debugState.activeStepIndex = executions.length - 1;
768
- } else if(executions.length > (debugState.executions.length || 0)) {
769
- debugState.activeStepIndex = executions.length - 1;
765
+ // 添加到历史记录
766
+ const dumpEntry = {
767
+ id: dump.id || 'dump-' + Date.now(),
768
+ name: dump.name || '执行步骤',
769
+ tasks: dump.tasks || [],
770
+ timestamp: Date.now(),
771
+ dump: dump,
772
+ };
773
+
774
+ // 检查是否已存在相同 id,避免重复添加
775
+ const existingIndex = debugState.executionHistory.findIndex(e => e.id === dumpEntry.id);
776
+ if(existingIndex >= 0) {
777
+ // 更新现有记录
778
+ debugState.executionHistory[existingIndex] = dumpEntry;
779
+ } else {
780
+ // 添加新记录
781
+ debugState.executionHistory.push(dumpEntry);
770
782
  }
771
783
 
784
+ // 自动选中最新步骤(历史记录的最后一项)
785
+ debugState.activeStepIndex = debugState.executionHistory.length - 1;
786
+
772
787
  renderReportTimeline();
773
788
  renderStepDetail();
774
789
  renderReportProgress();
@@ -820,28 +835,32 @@ function formatTimestamp(ts) {
820
835
 
821
836
  function renderReportProgress() {
822
837
  const el = document.getElementById('report-progress');
823
- const executions = debugState.executions || [];
824
- if(!executions.length) { el.innerHTML = ''; return; }
825
- const finished = executions.filter(e => getExecutionStatus(e) === 'finished').length;
826
- const total = executions.length;
838
+ const history = debugState.executionHistory || [];
839
+ if(!history.length) { el.innerHTML = ''; return; }
840
+ const finished = history.filter(e => getExecutionStatus(e) === 'finished').length;
841
+ const total = history.length;
827
842
  const pct = Math.round((finished / total) * 100);
828
843
  el.innerHTML = '<div class="rrd-progress-bar"><div class="rrd-progress-fill" style="width:' + pct + '%"></div></div><span>' + finished + '/' + total + '</span>';
829
844
  }
830
845
 
831
846
  function renderReportTimeline() {
832
847
  const container = document.getElementById('report-timeline');
833
- const executions = debugState.executions || [];
834
- if(!executions.length) {
848
+ // 使用 executionHistory 渲染所有历史记录
849
+ const history = debugState.executionHistory || [];
850
+ if(!history.length) {
835
851
  container.innerHTML = '<div class="rrd-empty">等待执行步骤...</div>';
836
852
  return;
837
853
  }
838
- container.innerHTML = executions.map((exec, i) => {
854
+ container.innerHTML = history.map((entry, i) => {
855
+ const exec = entry;
839
856
  const status = getExecutionStatus(exec);
840
857
  const typeCat = getTaskTypeCategory(exec);
841
858
  const typeLabel = getTaskTypeLabel(exec);
842
859
  const isActive = i === debugState.activeStepIndex;
843
860
  const totalCost = (exec.tasks || []).reduce((s, t) => s + (t.timing && t.timing.cost || 0), 0);
844
861
  const dotIcon = status === 'finished' ? '&#10003;' : status === 'running' ? '&#9679;' : status === 'failed' ? '&#10007;' : '&#9679;';
862
+ // 显示时间戳
863
+ const timeStr = entry.timestamp ? new Date(entry.timestamp).toLocaleTimeString() : '';
845
864
  return '<div class="rtl-step' + (isActive ? ' active' : '') + '" onclick="selectReportStep(' + i + ')">' +
846
865
  '<div class="rtl-step-dot status-' + status + '">' + dotIcon + '</div>' +
847
866
  '<div class="rtl-step-info">' +
@@ -850,6 +869,7 @@ function renderReportTimeline() {
850
869
  '<span class="rtl-step-type type-' + typeCat + '">' + typeLabel + '</span>' +
851
870
  (totalCost > 0 ? '<span>' + formatDuration(totalCost) + '</span>' : '') +
852
871
  (exec.tasks && exec.tasks.length > 1 ? '<span>' + exec.tasks.length + '子任务</span>' : '') +
872
+ (timeStr ? '<span>' + timeStr + '</span>' : '') +
853
873
  '</div>' +
854
874
  '</div>' +
855
875
  '</div>';
@@ -868,12 +888,13 @@ function selectReportStep(index) {
868
888
  function renderStepDetail() {
869
889
  const container = document.getElementById('report-detail');
870
890
  const index = debugState.activeStepIndex;
871
- const executions = debugState.executions || [];
872
- if(index < 0 || index >= executions.length) {
891
+ const history = debugState.executionHistory || [];
892
+ if(index < 0 || index >= history.length) {
873
893
  container.innerHTML = '<div class="rrd-empty">请选择一个步骤查看详情</div>';
874
894
  return;
875
895
  }
876
- const exec = executions[index];
896
+ const entry = history[index];
897
+ const exec = entry; // entry 就是 execution 格式 { name, tasks, id, logTime, timestamp, dump }
877
898
  const firstTask = exec.tasks && exec.tasks[0];
878
899
  const lastTask = exec.tasks && exec.tasks[exec.tasks.length - 1];
879
900
  const totalCost = (exec.tasks || []).reduce((s, t) => s + (t.timing && t.timing.cost || 0), 0);
@@ -1 +1 @@
1
- {"version":3,"file":"debug-page.js","sourceRoot":"","sources":["../../src/web/debug-page.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAosDR,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiscene/aiserver",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "AI automation server with device management, task scheduling, and debug capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",