1. 目录 mcn-work-shop -> mcn-workshop(空间分组名取会话 cwd 的目录名,只改字符串无效,必须真改名) 2. 全仓替换 mcn-work-shop -> mcn-workshop:37 文件 121 处;历史日志按沿革句规矩保留当时目录名 3. 任务进度可见:/api/run/status 产出 已运行时长/工具调用/最近动作/停滞判定(读会话日志尾部),前端新增右下角常驻面板,四处任务入口接入 4. 会话归属目录配置化:新增 config.sessionCwd(留空=工作台自身目录),现指向 D://AI技能//mcn-workshop,使任务显示为命名分组而非「未分组任务」 5. 修前端轮询静默缺陷:连续 3 次查询失败即提示服务断开(原逻辑静默空转到 15 分钟超时,用户零感知)
57 lines
3.1 KiB
JavaScript
57 lines
3.1 KiB
JavaScript
// 验证「账号周榜」5 个数值列加宽(.th-wide min-width:110px)
|
||
// 只读测量,零副作用
|
||
const list = await fetch('http://localhost:9223/json').then((r) => r.json());
|
||
let page = list.find((t) => t.type === 'page' && t.url.includes('#/ranking'));
|
||
if (!page) page = list.find((t) => t.type === 'page' && t.url.includes('localhost:8899'));
|
||
if (!page) { console.log('ERR: no workbuddy page open'); process.exit(1); }
|
||
const ws = new WebSocket(page.webSocketDebuggerUrl);
|
||
let id = 0; const pending = new Map();
|
||
const send = (method, params = {}) => new Promise((res, rej) => { const i = ++id; pending.set(i, { res, rej }); ws.send(JSON.stringify({ id: i, method, params })); });
|
||
ws.onmessage = (e) => { const m = JSON.parse(e.data); if (m.id && pending.has(m.id)) { const p = pending.get(m.id); pending.delete(m.id); m.error ? p.rej(new Error(m.error.message)) : p.res(m.result); } };
|
||
await new Promise((r) => (ws.onopen = r));
|
||
const ev = async (expr) => { const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true }); if (r.exceptionDetails) return { __err: (r.exceptionDetails.exception?.description || r.exceptionDetails.text).slice(0, 300) }; return r.result.value; };
|
||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||
await send('Page.enable'); await send('Runtime.enable');
|
||
|
||
// 1) 导航到周榜页(若不在)并刷新加载最新 CSS
|
||
if (!page.url.includes('#/ranking')) {
|
||
await send('Page.navigate', { url: 'http://localhost:8899/#/ranking' });
|
||
await sleep(2000);
|
||
}
|
||
await send('Page.reload', { ignoreCache: true });
|
||
await sleep(3000);
|
||
|
||
// 2) 测量表头各列宽度
|
||
const cols = await ev(`(() => {
|
||
const ths = [...document.querySelectorAll('.table th')];
|
||
const wideKeys = ['comprehensiveScore', 'newFans', 'newLikes', 'newComments', 'newShares'];
|
||
const rowCount = document.querySelectorAll('.table tbody tr').length;
|
||
const result = ths.map((th) => {
|
||
const rect = th.getBoundingClientRect();
|
||
return { key: th.dataset.sort || '', label: th.textContent.trim().slice(0, 8), wide: th.classList.contains('th-wide'), w: Math.round(rect.width) };
|
||
});
|
||
return { rowCount, result };
|
||
})()`);
|
||
console.log('行数:', cols.rowCount);
|
||
console.log('表头列宽:');
|
||
for (const c of cols.result) {
|
||
const mark = c.wide ? ' [th-wide]' : '';
|
||
const match = c.wide ? (c.w >= 110 ? ' >=110 ✓' : ' <110 ✗') : '';
|
||
console.log(' ' + (c.key || c.label).padEnd(22) + ' width=' + String(c.w).padStart(4) + mark + match);
|
||
}
|
||
const wideCols = cols.result.filter((c) => c.wide);
|
||
const allOk = wideCols.length === 5 && wideCols.every((c) => c.w >= 110);
|
||
|
||
// 3) 记录 CSS 规则是否生效
|
||
const cssCheck = await ev(`(() => {
|
||
const sheet = [...document.styleSheets].map((s) => s.href || 'inline').join(',');
|
||
const th = document.querySelector('.table th.th-wide');
|
||
const cs = th ? getComputedStyle(th) : null;
|
||
return { sheet, minWidth: cs ? cs.minWidth : 'n/a' };
|
||
})()`);
|
||
console.log('样式源:', cssCheck.sheet.slice(0, 160));
|
||
console.log('computed min-width:', cssCheck.minWidth);
|
||
|
||
ws.close();
|
||
console.log(allOk ? 'PASS: 5 列均已加宽(>=110px)' : 'CHECK: 存在未达标的列');
|