@eigenpal/docx-editor-agents

中文文档
1.9.0发布于 2026/06/21Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 20.6万

Agent SDK and chat UI for the DOCX editor — framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI (and Vue UI in 1.x)

此软件包已被标记为弃用

deprecated

原始使用文档
文档目录8 节
  1. Quick Start
  2. Packages
  3. Live editor bridge
  4. MCP server
  5. Subpaths
  6. Word API parity
  7. Contributing
  8. Commercial Support

DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side.

npm version npm downloads license Demo Documentation

@eigenpal/docx-editor-agents

Word-like API for AI agents to review DOCX documents. Read, comment, suggest tracked changes, accept/reject. Headless, server-friendly, browser-friendly. The library you build your AI document features on top of.

Quick Start

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()));

That's the static-review path: drop into a CI bot, queue worker, or Lambda. No editor needed. ~50 KB.

Packages

PackageDescription
@eigenpal/docx-editor-react   React adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-vue   Vue 3 adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-coreFramework-agnostic core: OOXML parser, serializer, layout engine, ProseMirror schema. Depend on this if you fork the React or Vue adapter.
@eigenpal/docx-editor-i18nShared locale strings and types consumed by both adapters.
@eigenpal/docx-editor-agentsAgent SDK and chat UI: framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI.

Forking the adapter? Keep your fork thin. Depend on @eigenpal/docx-editor-core directly so parser, serializer, and rendering fixes land in your build automatically, without backporting each upstream change by hand.

Live editor bridge

Wire AI tools into a running <DocxEditor> so add_comment, suggest_change, find_text etc. show up live in the user's editor.

// 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' });

Both share the same EditorRefLike contract from /bridge, the same tool catalog, and the same AgentMessage[] chat shape. For other frameworks, build the bridge directly via createEditorBridge from @eigenpal/docx-editor-agents/bridge.

MCP server

Transport-agnostic core. Wrap it with your own auth, storage, and transport (HTTP-SSE, WebSocket, queue worker, anything).

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());
});

The built-in agent tools (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) are exposed automatically via MCP tools/list and tools/call. MCP spec version: 2025-06-18.

A local stdio MCP bin is one-document-per-config (Claude Desktop loads its list at startup), which doesn't fit a multi-doc product. Host the server yourself with your own auth and storage.

Subpaths

SubpathUse when
@eigenpal/docx-editor-agentsServer-side review, library glue
@eigenpal/docx-editor-agents/bridgeWiring AI tools into a running editor adapter
@eigenpal/docx-editor-agents/serverBackend routes needing agent tooling without the MCP transport
@eigenpal/docx-editor-agents/mcpBuilding an MCP server (any transport)
@eigenpal/docx-editor-agents/ai-sdk/serverServer-side streaming chat with the Vercel ai package
@eigenpal/docx-editor-agents/reactReact apps wiring <DocxEditor> to an agent
@eigenpal/docx-editor-agents/ai-sdk/reactReact chat UI over the bridge
@eigenpal/docx-editor-agents/vueVue apps wiring <DocxEditor> to an agent
@eigenpal/docx-editor-agents/ai-sdk/vueVue chat UI over the bridge

Each subpath tree-shakes independently. Vue and AI SDK peers are optional via peerDependenciesMeta.

Word API parity

The bridge mirrors the Office.js Word API pattern: locate a stable handle (paraId) first, then mutate. The contract is type-enforced at compile time:

import type { WordCompatBridge } from '@eigenpal/docx-editor-agents';

EditorBridge is statically required to satisfy WordCompatBridge. Drop a method that maps to a Word API call and typecheck breaks.

Contributing

Contributions welcome. See CONTRIBUTING.md for setup, tests, and the one-time CLA signature.

Commercial Support

[!TIP] Questions or custom features? Email [email protected].

版本与发布记录

@eigenpal/docx-editor-agents 共发布 41 个版本,首次发布于 2026/03/18;过去 12 个月发布了 41 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.9.0latest2026/06/214 个月前
1.8.32026/06/204 个月前
1.8.22026/06/194 个月前
1.8.12026/06/194 个月前
1.8.02026/06/194 个月前
1.7.02026/06/184 个月前

关于 @eigenpal/docx-editor-agents 的常见问题

@eigenpal/docx-editor-agents 是什么?

Agent SDK and chat UI for the DOCX editor — framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI (and Vue UI in 1.x)注意:该包已被作者标记为弃用——deprecated

如何安装 @eigenpal/docx-editor-agents?

在项目目录运行 npm install @eigenpal/docx-editor-agents,或使用 pnpm add / yarn add / bun add。

@eigenpal/docx-editor-agents 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eigenpal/docx-editor-agents 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eigenpal/docx-editor-agents 可以商用吗?

@eigenpal/docx-editor-agents 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eigenpal/docx-editor-agents 的下载量有多少?

根据 npm 官方下载统计,@eigenpal/docx-editor-agents 在 2026/10/13 – 2026/11/11 这 30 天内被下载 205,895 次,日均约 6,863 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eigenpal/docx-editor-agents 还在维护吗?

最新版本 1.9.0 发布于 2026/06/21(4 个月前);至今共发布 41 个版本,其中过去 12 个月发布了 41 个;首次发布于 2026/03/18。作者已将其标记为弃用,新项目建议寻找替代方案。