@eigenpal/docx-editor-代理服务器
Word-like API供AI代理审查DOCX文档. 读取,评论,建议跟踪更改,接受/拒绝. 无头,服务器友好,浏览器友好. 上面建有您的 AI 文档特性的库 .
快速启动
npm install @eigenpal/docx-editor-agents
import { readFile, writeFile } from 'node:fs/promises';
import { DocxReviewer } from '@eigenpal/docx-editor-agents';
const buffer = await readFile('contract.docx');
const reviewer = await DocxReviewer.fromBuffer(buffer, 'AI Reviewer');
reviewer.addComment(5, 'This cap seems too low.');
reviewer.replace(5, '$50k', '$500k');
await writeFile('contract.reviewed.docx', new Uint8Array(await reviewer.toBuffer()));
这就是静态审查路径: 投入CI机器人,排队工人,或者Lambda. 不需要编辑 ~50克贝.
软件包
| 软件包 | 说明 |
|---|---|
@eigenpal/docx-editor-react | |
@eigenpal/docx-editor-vue | |
@eigenpal/docx-editor-core | 框架-不可知核:OOXML 解析器,序列器,布局引擎,ProseMirror schema. 取决于此, 如果您要叉出反应或 Vue 适配器 . |
@eigenpal/docx-editor-i18n | 两个适配器消耗的共享地块串和类型. |
@eigenpal/docx-editor-agents | 代理SDK和聊天UI:框架-不可知桥,MCP服务器,AI SDK适配器,外加React UI. |
伪造适配器? 取出叉子细. 取决于
@eigenpal/docx-editor-core直接如此解析器,序列器, 和渲染自动修复您的建筑中的地块, 不回转每个上游变化的手.
实时编辑器桥
连接AI工具进入运行 <DocxEditor> 这样 add_comment, (中文(简体) ), suggest_change, (中文(简体) ), find_text 等在用户编辑器中现场显示.
// React
import { useAgentChat } from '@eigenpal/docx-editor-agents/react';
const { executeToolCall, toolSchemas } = useAgentChat({ editorRef, author: 'Assistant' });
// Vue
import { useAgentBridge } from '@eigenpal/docx-editor-agents/vue';
const { executeToolCall, toolSchemas } = useAgentBridge({ editorRef, author: 'Assistant' });
都一样 EditorRefLike 合同来源 /bridge,相同的工具目录,和相同的 AgentMessage[] 聊天形状。 对于其他框架,直接通过下列途径建造桥梁: createEditorBridge 从 @eigenpal/docx-editor-agents/bridge。 。 。 .
MCP 服务器
交通-不可知核. 用你自己的认证、存储和运输(HTTP-SSE、WebSocket、队列工人、任何东西)包起来.
import { McpServer, createReviewerBridge, DocxReviewer } from '@eigenpal/docx-editor-agents';
app.post('/api/mcp', requireAuth, async (req, res) => {
const buffer = await loadDocxForUser(req.user, req.params.docId);
const reviewer = await DocxReviewer.fromBuffer(buffer, req.user.name);
const server = new McpServer(createReviewerBridge(reviewer), {
name: 'acme-review',
version: '1.0.0',
});
res.json(server.handle(JSON.parse(req.body))); // sync, transport-free, never throws
await saveDocxForUser(req.user, req.params.docId, await reviewer.toBuffer());
});
内置代理工具(read_document, (中文(简体) ), read_selection, (中文(简体) ), read_page, (中文(简体) ), read_pages, (中文(简体) ), find_text, (中文(简体) ), read_comments, (中文(简体) ), read_changes, (中文(简体) ), add_comment, (中文(简体) ), suggest_change, (中文(简体) ), apply_formatting, (中文(简体) ), set_paragraph_style, (中文(简体) ), insert_break, (中文(简体) ), reply_comment, (中文(简体) ), resolve_comment, (中文(简体) ), scroll通过 MCP 自动曝光 tools/list 财务报告和审定财务报表 tools/call. MCP spec 版本 : 2025-06-18。 。 。 .
本地stdio MCP bin是一文档一配置(Claude Desktop在启动时加载其列表),不符合多文档产品. 使用您自己的认证和存储器自控服务器 .
子路径
| 子路径 | 使用时间 |
|---|---|
@eigenpal/docx-editor-agents | 服务器侧审查, 库胶水 |
@eigenpal/docx-editor-agents/bridge | 将 AI 工具连接到运行中的编辑器适配器 |
@eigenpal/docx-editor-agents/server | 后端路线需要没有MCP运输的代理工具 |
@eigenpal/docx-editor-agents/mcp | 建造 MCP 服务器( 任何运输) |
@eigenpal/docx-editor-agents/ai-sdk/server | 服务器侧流与 Vercel 聊天 ai 软件包 |
@eigenpal/docx-editor-agents/react | 反应应用程序接线 <DocxEditor> 给代理人 |
@eigenpal/docx-editor-agents/ai-sdk/react | 在桥上反弹聊天 |
@eigenpal/docx-editor-agents/vue | Vue apps 接线 <DocxEditor> 给代理人 |
@eigenpal/docx-editor-agents/ai-sdk/vue | 在桥上聊天 |
每个亚道树摇晃独立. Vue 和 AI SDK 同伴通过 peerDependenciesMeta。 。 。 .
单词 API 对等
桥与Office.js Word API模式相仿:定位一个稳定的手柄(paraId),先是变异. 合同在编译时按类型执行:
import type { WordCompatBridge } from '@eigenpal/docx-editor-agents';
EditorBridge 静态需要满足 WordCompatBridge。丢弃一种将地图映射到 Word API 呼叫和打字间隔的方法.
捐款
欢迎捐款。 见 捐款额 用于设置,测试,以及一次性CLA签名.
商业支助
[TIP] 问题还是习惯特征? 电子邮件 docx-编辑器@eigenpal.com。 。 。 .