@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.
- package/dist/core/types.d.ts +1 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/debug/types.d.ts +1 -0
- package/dist/debug/types.d.ts.map +1 -1
- package/dist/debug/websocket-server.d.ts.map +1 -1
- package/dist/debug/websocket-server.js +148 -13
- package/dist/debug/websocket-server.js.map +1 -1
- package/dist/executor/action-executor.d.ts +5 -0
- package/dist/executor/action-executor.d.ts.map +1 -1
- package/dist/executor/action-executor.js +134 -59
- package/dist/executor/action-executor.js.map +1 -1
- package/dist/executor/code-executor.d.ts.map +1 -1
- package/dist/executor/code-executor.js +8 -1
- package/dist/executor/code-executor.js.map +1 -1
- package/dist/executor/code-instrument.d.ts.map +1 -1
- package/dist/executor/code-instrument.js +3 -10
- package/dist/executor/code-instrument.js.map +1 -1
- package/dist/executor/worker-entry.js +73 -0
- package/dist/executor/worker-entry.js.map +1 -1
- package/dist/web/debug-page.d.ts.map +1 -1
- package/dist/web/debug-page.js +40 -19
- package/dist/web/debug-page.js.map +1 -1
- package/package.json +1 -1
package/dist/web/debug-page.js
CHANGED
|
@@ -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
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
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
|
|
824
|
-
if(!
|
|
825
|
-
const finished =
|
|
826
|
-
const total =
|
|
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
|
-
|
|
834
|
-
|
|
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 =
|
|
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' ? '✓' : status === 'running' ? '●' : status === 'failed' ? '✗' : '●';
|
|
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
|
|
872
|
-
if(index < 0 || index >=
|
|
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
|
|
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
|
|
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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