feat(skills): office 本地放行 watch、x2pdf 加浏览器后端

office 封装层:本地直跑(AGENT_LOCAL_PICK)没有预览网关,不发 ui_card、
不 POST __pv-touch;watch/unwatch 与 mark/goto 族放行,watch 改后台拉起 +
等端口就绪后报地址退出(前台透传会卡到 terminal 超时)。

x2pdf:文本类分派改为 WeasyPrint → 无头浏览器 → LibreOffice,浏览器后端只需
装了 Chrome 系,不要求用户为转 PDF 现编 pango;CSS/base 注入到 head,无 @page 时
补 A4(浏览器默认 Letter)。吞掉 WeasyPrint 导入失败时裸 print 到 stdout 的告警。
对外文案只讲结果(排版降级/无可用排版能力),实现细节留在 AGENTS.md。
This commit is contained in:
2026-11-11 20:50:18 +08:00
parent 0234bc85e5
commit 77ef1ec11c
5 changed files with 186 additions and 34 deletions
+2 -4
View File
@@ -37,10 +37,8 @@ output_schema:
统一 PDF 转换入口,按扩展名自动分派两条渲染路径:
- **md / txt / html → WeasyPrint**(CSS 排版,字体走 fontconfig,中文用系统文泉驿/Noto,无需字体文件);
本机没有 WeasyPrint(缺包,或缺它依赖的 pango/cairo)时自动回落 LibreOffice——
能出件,但 `page`/`css` 只部分生效,不适合精确排版
- **docx / xlsx / pptx / odt / ods / odp → LibreOffice headless**(忠于原文档版式,`page`/`css` 参数不生效)
- **md / txt / html → 渲染成 PDF**(CSS 排版,字体走系统 fontconfig,中文用系统文泉驿/Noto,无需字体文件)
- **docx / xlsx / pptx / odt / ods / odp → 按原文档版式转换**(`page`/`css` 参数不生效)
### Markdown 输入(`.md` / `.markdown`)
- 标准语法之外,支持表格(管道语法)、围栏代码块(```/~~~)、脚注、定义列表、