@aiscene/aiserver 1.2.6 → 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 +3 -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 +5 -0
- package/dist/debug/websocket-server.d.ts.map +1 -1
- package/dist/debug/websocket-server.js +243 -16
- 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 +2 -2
|
@@ -25,6 +25,48 @@ async function sendResult(result) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* 从 executor 获取 agent 并调用 dump 方法获取完整 dump 数据
|
|
30
|
+
*/
|
|
31
|
+
function getAgentDump(executor) {
|
|
32
|
+
let dumpData = '';
|
|
33
|
+
let executionDumpData = undefined;
|
|
34
|
+
try {
|
|
35
|
+
// 优先尝试 getAgent 方法(ActionExecutor 有这个方法)
|
|
36
|
+
let agent = null;
|
|
37
|
+
if (typeof executor.getAgent === 'function') {
|
|
38
|
+
agent = executor.getAgent();
|
|
39
|
+
}
|
|
40
|
+
// 备选:直接从 executor 获取 agent 属性(通过 any 类型访问)
|
|
41
|
+
if (!agent) {
|
|
42
|
+
agent = executor.agent;
|
|
43
|
+
}
|
|
44
|
+
if (agent) {
|
|
45
|
+
// 调用 agent.dump() 或 agent.dumpDataString() 获取完整 dump
|
|
46
|
+
if (typeof agent.dump === 'function') {
|
|
47
|
+
dumpData = agent.dump({ inlineScreenshots: true }) || '';
|
|
48
|
+
}
|
|
49
|
+
else if (typeof agent.dumpDataString === 'function') {
|
|
50
|
+
dumpData = agent.dumpDataString({ inlineScreenshots: true }) || '';
|
|
51
|
+
}
|
|
52
|
+
// 尝试获取 structured execution dump
|
|
53
|
+
if (typeof agent.getExecutionDump === 'function') {
|
|
54
|
+
executionDumpData = agent.getExecutionDump();
|
|
55
|
+
}
|
|
56
|
+
else if (typeof agent.reportHTMLString === 'function') {
|
|
57
|
+
// 备选:获取 HTML 报告
|
|
58
|
+
const reportHTML = agent.reportHTMLString({ inlineScreenshots: true });
|
|
59
|
+
if (reportHTML) {
|
|
60
|
+
executionDumpData = { reportHTML };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (dumpError) {
|
|
66
|
+
console.error('[Worker] Failed to get dump data:', dumpError.message);
|
|
67
|
+
}
|
|
68
|
+
return { dump: dumpData, executionDump: executionDumpData };
|
|
69
|
+
}
|
|
28
70
|
async function runWorker() {
|
|
29
71
|
const config = JSON.parse(process.env.WORKER_CONFIG || '{}');
|
|
30
72
|
// 注册未捕获异常处理
|
|
@@ -40,11 +82,23 @@ async function runWorker() {
|
|
|
40
82
|
const executor = ExecutorFactory.create(config.type);
|
|
41
83
|
const result = await executor.execute(config);
|
|
42
84
|
console.log('[Worker] Execution completed, sending result...');
|
|
85
|
+
// AndroidExecutor.execute() 返回结果中已经包含 dump 数据
|
|
86
|
+
// 直接使用 result.dump,备选从 agent 获取
|
|
87
|
+
let dumpData = result.dump || '';
|
|
88
|
+
let executionDumpData = result.executionDump;
|
|
89
|
+
if (!dumpData) {
|
|
90
|
+
// 如果 result 中没有 dump,尝试从 agent 获取
|
|
91
|
+
const agentDump = getAgentDump(executor);
|
|
92
|
+
dumpData = agentDump.dump || dumpData;
|
|
93
|
+
executionDumpData = executionDumpData || agentDump.executionDump;
|
|
94
|
+
}
|
|
43
95
|
await sendResult({
|
|
44
96
|
success: result.success,
|
|
45
97
|
reportFile: result.reportFile,
|
|
46
98
|
logFile: result.logFile,
|
|
47
99
|
errorMessage: result.errorMessage,
|
|
100
|
+
dump: dumpData,
|
|
101
|
+
executionDump: executionDumpData,
|
|
48
102
|
});
|
|
49
103
|
console.log('[Worker] Exiting with code 0');
|
|
50
104
|
process.exit(0);
|
|
@@ -52,22 +106,41 @@ async function runWorker() {
|
|
|
52
106
|
catch (error) {
|
|
53
107
|
let errorMessage = 'Unknown error';
|
|
54
108
|
let reportFile;
|
|
109
|
+
let dumpData = '';
|
|
110
|
+
let executionDumpData = undefined;
|
|
55
111
|
if (error && typeof error === 'object') {
|
|
56
112
|
if ('message' in error)
|
|
57
113
|
errorMessage = error.message;
|
|
58
114
|
if ('reportFile' in error)
|
|
59
115
|
reportFile = error.reportFile;
|
|
116
|
+
if ('dump' in error)
|
|
117
|
+
dumpData = error.dump || '';
|
|
60
118
|
// 打印完整错误信息用于调试
|
|
61
119
|
console.error('[Worker] Execution error:', errorMessage);
|
|
62
120
|
if (error instanceof Error && error.stack) {
|
|
63
121
|
console.error('[Worker] Stack:', error.stack.split('\n').slice(0, 5).join('\n'));
|
|
64
122
|
}
|
|
65
123
|
}
|
|
124
|
+
// 异常时也尝试获取 dump 数据
|
|
125
|
+
try {
|
|
126
|
+
// 从 error 中尝试获取 executor
|
|
127
|
+
const executor = error?.executor || error?.agent;
|
|
128
|
+
if (executor) {
|
|
129
|
+
const result = getAgentDump(executor);
|
|
130
|
+
dumpData = dumpData || result.dump;
|
|
131
|
+
executionDumpData = executionDumpData || result.executionDump;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (dumpError) {
|
|
135
|
+
console.error('[Worker] Failed to get dump data on error:', dumpError.message);
|
|
136
|
+
}
|
|
66
137
|
console.log('[Worker] Sending error result...');
|
|
67
138
|
await sendResult({
|
|
68
139
|
success: false,
|
|
69
140
|
errorMessage,
|
|
70
141
|
reportFile,
|
|
142
|
+
dump: dumpData,
|
|
143
|
+
executionDump: executionDumpData,
|
|
71
144
|
});
|
|
72
145
|
console.log('[Worker] Exiting with code 0 (error handled)');
|
|
73
146
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-entry.js","sourceRoot":"","sources":["../../src/executor/worker-entry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-entry.js","sourceRoot":"","sources":["../../src/executor/worker-entry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,KAAK,UAAU,UAAU,CAAC,MAOzB;IACC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC9B,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;oBAC3D,OAAO,EAAE,CAAC,CAAC,QAAQ;gBACrB,CAAC,EAAE,IAAI,CAAC,CAAC;gBAET,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,IAAI,GAAG,EAAE,CAAC;wBACR,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;oBAC9D,CAAC;oBACD,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,C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AAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-page.d.ts","sourceRoot":"","sources":["../../src/web/debug-page.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"debug-page.d.ts","sourceRoot":"","sources":["../../src/web/debug-page.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAssDzC"}
|
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAosDR,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiscene/aiserver",
|
|
3
|
-
"version": "1.2.
|
|
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",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "tsc",
|
|
15
15
|
"start": "node dist/index.js",
|
|
16
16
|
"start:prod": "node dist/index.js",
|
|
17
|
-
"dev": "tsx watch src/index.ts",
|
|
17
|
+
"dev": "tsx watch src/index.ts --web-port 3005",
|
|
18
18
|
"lint": "eslint src/",
|
|
19
19
|
"format": "prettier --write src/"
|
|
20
20
|
},
|