fix: 终端shell改PowerShell(pwd/ls可用) + 浏览器默认页改example.com(可嵌入) + marker回显验证

This commit is contained in:
Aisland
2026-08-17 20:48:13 +08:00
parent f83aa1d589
commit 3fe012132e
5 changed files with 26 additions and 11 deletions
+3 -3
View File
@@ -3,14 +3,14 @@ const WebSocket = require('ws');
const ws = new WebSocket('ws://127.0.0.1:3080/api/worktable/term?cwd=' + encodeURIComponent('E:/AI_Workspace') + '&cols=80&rows=24');
const received = [];
const timer = setTimeout(() => { console.log('RESULT: FAIL 15s 无任何输出'); process.exit(1); }, 15000);
ws.on('open', () => { console.log('WS_OPEN'); setTimeout(() => { console.log('SEND pwd'); ws.send('pwd\r'); }, 1500); });
ws.on('open', () => { console.log('WS_OPEN'); setTimeout(() => { console.log('SEND echo'); ws.send('echo __WT_LIVE_MARKER__\r'); }, 1500); });
ws.on('message', (d) => {
const t = String(d);
received.push(t);
console.log('FRAME[' + received.length + ']:', JSON.stringify(t.slice(0, 100)));
if (t.includes('E:\\AI_Workspace') || /[A-Za-z]:[\\/]/.test(t)) {
if (t.includes('__WT_LIVE_MARKER__')) {
clearTimeout(timer);
console.log('RESULT: PASS pwd 真实回显 OK');
console.log('RESULT: PASS 实机命令回显 OK');
ws.close(); process.exit(0);
}
});
+3 -3
View File
@@ -40,12 +40,12 @@ const WebSocket = require('ws');
await new Promise((r) => server.listen(19088, '127.0.0.1', r));
const ws = new WebSocket('ws://127.0.0.1:19088/api/worktable/term?cwd=' + encodeURIComponent(process.cwd()) + '&cols=80&rows=24');
const timer = setTimeout(() => { console.log('RESULT: FAIL 超时'); process.exit(1); }, 10000);
ws.on('open', () => ws.send('pwd\r'));
ws.on('open', () => ws.send('echo __WT_E2E_MARKER__\r'));
ws.on('message', (d) => {
const t = String(d);
if (t.length > 3 && /[A-Za-z]:[\\\/]/.test(t)) {
if (t.includes('__WT_E2E_MARKER__')) {
clearTimeout(timer);
console.log('RESULT: PASS pwd 回显正常: ' + t.slice(0, 90).replace(/\r?\n/g, ' | '));
console.log('RESULT: PASS 命令回显正常: ' + t.slice(0, 120).replace(/\r?\n/g, ' | '));
ws.close(); server.close(); process.exit(0);
}
});