seewo-kit: 拦截多实例/授课界面丢内容,导出校验截图新旧,新增 diagnose_courseware
- closeForWrite: 同课件多窗口、停在 Display 界面时直接拒绝写入(force 才放行),不再先切界面再比对导致静默丢改动 - runEdit: 写前写后给页面文件做指纹,返回 changedPages;没有变化时给 warnings - syncShell / sync_courseware: 授课界面拒绝强制切回备课,新增 force - export_slides: 每次先删文件、先 goto_slide、校验 mtime 防旧帧;连续两页超时中止并提示重启希沃 - infoOf(): structuredContent 缺失时回退解析文本 JSON,内存页数检查不再悄悄失效 - 新增 diagnose_courseware(工具数 27 → 28)
This commit is contained in:
+25
-2
@@ -8,8 +8,10 @@
|
||||
* 启动方式(OpenCode 配置):
|
||||
* "seewokit": { "type": "local", "command": ["node", "D:\\Documents\\Default Project\\seewo-anim\\kit\\server.mjs"] }
|
||||
*
|
||||
* 写操作内部会:关课件(不保存) → 自动备份 → 改缓存文件 → 更新索引/DB → 重新打开。
|
||||
* 写操作内部会:预检(多实例 / 停在授课界面 / 内存与磁盘页数不一致 → 直接拒绝)→ 关课件(不保存)
|
||||
* → 自动备份 → 改缓存文件 → 更新索引/DB → 重新打开 → 回报实际改动的页数和告警。
|
||||
* 前提:目标课件的未同步改动必须已经同步(内存页数/大小与磁盘不一致时会拒绝,除非 force=true)。
|
||||
* 想先看能不能安全写,用 diagnose_courseware。
|
||||
*/
|
||||
import { createInterface } from 'node:readline';
|
||||
import {
|
||||
@@ -20,6 +22,7 @@ import {
|
||||
diffCourseware, preflightCourseware, undoLastEdit,
|
||||
batchReplaceText, batchSetTextStyle, batchInspect,
|
||||
layoutElements, setSlideTransition, exportSlides, styleTextRange,
|
||||
diagnoseCourseware,
|
||||
} from './core.mjs';
|
||||
|
||||
const log = (...a) => console.error('[seewo-kit]', ...a);
|
||||
@@ -341,11 +344,13 @@ const TOOLS = [
|
||||
name: 'sync_courseware',
|
||||
description:
|
||||
'只做云同步,不改内容:课件没开会先打开,然后做一次无害改动(加页+删页)让希沃认为「有更新」,再上传。\n'
|
||||
+ '用于把本地 Revision 脏状态清干净,或把本地改动推上云。返回同步结果与 isSynced。',
|
||||
+ '用于把本地 Revision 脏状态清干净,或把本地改动推上云。返回同步结果与 isSynced。\n'
|
||||
+ '课件停在授课界面时会拒绝(切回备课会丢该界面的改动),确认不要了可传 force=true。',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
courseware: { type: 'string', description: '课件名片段或 LocalId' },
|
||||
force: { type: 'boolean', default: false, description: '授课界面也强行切回备课再同步(会丢弃该界面的改动)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -385,6 +390,23 @@ const TOOLS = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'diagnose_courseware',
|
||||
description:
|
||||
'写操作前的诊断(只读,除 checkRender=true 时会截一张图)。'
|
||||
+ '一次查清:打开了几个希沃窗口、在备课还是授课界面、内存页数/大小与磁盘是否一致、有没有未同步改动、'
|
||||
+ '截图渲染线程是否还活着、最近备份。'
|
||||
+ 'safeToWrite=false 时不要写课件——最常见的原因是「同一个课件开了多个窗口」或「停在授课界面」,这两种都会让改动互相覆盖或直接丢失。',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
courseware: { type: 'string', description: '课件名片段或 LocalId' },
|
||||
checkRender: { type: 'boolean', default: false, description: '是否顺手测一次截图接口(检测渲染线程是否卡死)' },
|
||||
renderPage: { type: 'integer', minimum: 1, default: 1, description: 'checkRender=true 时截哪一页' },
|
||||
timeoutSec: { type: 'integer', minimum: 10, default: 45, description: '截图超时秒数' },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'undo_last_edit',
|
||||
description:
|
||||
@@ -631,6 +653,7 @@ const HANDLERS = {
|
||||
remove_local_courseware: removeLocalCourseware,
|
||||
diff_courseware: diffCourseware,
|
||||
preflight_courseware: preflightCourseware,
|
||||
diagnose_courseware: diagnoseCourseware,
|
||||
undo_last_edit: undoLastEdit,
|
||||
batch_replace_text: batchReplaceText,
|
||||
batch_set_text_style: batchSetTextStyle,
|
||||
|
||||
Reference in New Issue
Block a user