wps-multitool-mcp 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bridge/cancellable.d.ts +36 -0
- package/dist/bridge/cancellable.d.ts.map +1 -0
- package/dist/bridge/cancellable.js +155 -0
- package/dist/bridge/cancellable.js.map +1 -0
- package/dist/bridge/index.d.ts +37 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +383 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/ps-child.d.ts +155 -0
- package/dist/bridge/ps-child.d.ts.map +1 -0
- package/dist/bridge/ps-child.js +578 -0
- package/dist/bridge/ps-child.js.map +1 -0
- package/dist/cli/install.d.ts +58 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +301 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/client/action-routes.d.ts +32 -0
- package/dist/client/action-routes.d.ts.map +1 -0
- package/dist/client/action-routes.generated.d.ts +10 -0
- package/dist/client/action-routes.generated.d.ts.map +1 -0
- package/dist/client/action-routes.generated.js +327 -0
- package/dist/client/action-routes.generated.js.map +1 -0
- package/dist/client/action-routes.js +57 -0
- package/dist/client/action-routes.js.map +1 -0
- package/dist/client/ps-daemon.d.ts +95 -0
- package/dist/client/ps-daemon.d.ts.map +1 -0
- package/dist/client/ps-daemon.js +424 -0
- package/dist/client/ps-daemon.js.map +1 -0
- package/dist/client/wps-client.d.ts +69 -0
- package/dist/client/wps-client.d.ts.map +1 -0
- package/dist/client/wps-client.js +442 -0
- package/dist/client/wps-client.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-identity.d.ts +23 -0
- package/dist/runtime-identity.d.ts.map +1 -0
- package/dist/runtime-identity.js +26 -0
- package/dist/runtime-identity.js.map +1 -0
- package/dist/server/auto-snapshot.d.ts +58 -0
- package/dist/server/auto-snapshot.d.ts.map +1 -0
- package/dist/server/auto-snapshot.js +150 -0
- package/dist/server/auto-snapshot.js.map +1 -0
- package/dist/server/cancel-context.d.ts +30 -0
- package/dist/server/cancel-context.d.ts.map +1 -0
- package/dist/server/cancel-context.js +38 -0
- package/dist/server/cancel-context.js.map +1 -0
- package/dist/server/mcp-server.d.ts +74 -0
- package/dist/server/mcp-server.d.ts.map +1 -0
- package/dist/server/mcp-server.js +592 -0
- package/dist/server/mcp-server.js.map +1 -0
- package/dist/server/server-info.d.ts +21 -0
- package/dist/server/server-info.d.ts.map +1 -0
- package/dist/server/server-info.js +56 -0
- package/dist/server/server-info.js.map +1 -0
- package/dist/server/tool-aliases.generated.d.ts +41 -0
- package/dist/server/tool-aliases.generated.d.ts.map +1 -0
- package/dist/server/tool-aliases.generated.js +88 -0
- package/dist/server/tool-aliases.generated.js.map +1 -0
- package/dist/server/tool-annotations.d.ts +55 -0
- package/dist/server/tool-annotations.d.ts.map +1 -0
- package/dist/server/tool-annotations.generated.d.ts +14 -0
- package/dist/server/tool-annotations.generated.d.ts.map +1 -0
- package/dist/server/tool-annotations.generated.js +302 -0
- package/dist/server/tool-annotations.generated.js.map +1 -0
- package/dist/server/tool-annotations.js +192 -0
- package/dist/server/tool-annotations.js.map +1 -0
- package/dist/server/tool-group-events.d.ts +23 -0
- package/dist/server/tool-group-events.d.ts.map +1 -0
- package/dist/server/tool-group-events.js +44 -0
- package/dist/server/tool-group-events.js.map +1 -0
- package/dist/server/tool-metadata.d.ts +68 -0
- package/dist/server/tool-metadata.d.ts.map +1 -0
- package/dist/server/tool-metadata.js +834 -0
- package/dist/server/tool-metadata.js.map +1 -0
- package/dist/server/tool-registry.d.ts +186 -0
- package/dist/server/tool-registry.d.ts.map +1 -0
- package/dist/server/tool-registry.js +615 -0
- package/dist/server/tool-registry.js.map +1 -0
- package/dist/server/tool-tiers.d.ts +58 -0
- package/dist/server/tool-tiers.d.ts.map +1 -0
- package/dist/server/tool-tiers.js +128 -0
- package/dist/server/tool-tiers.js.map +1 -0
- package/dist/server/tool-verification.d.ts +35 -0
- package/dist/server/tool-verification.d.ts.map +1 -0
- package/dist/server/tool-verification.generated.d.ts +17 -0
- package/dist/server/tool-verification.generated.d.ts.map +1 -0
- package/dist/server/tool-verification.generated.js +293 -0
- package/dist/server/tool-verification.generated.js.map +1 -0
- package/dist/server/tool-verification.js +43 -0
- package/dist/server/tool-verification.js.map +1 -0
- package/dist/tools/common/batch.d.ts +33 -0
- package/dist/tools/common/batch.d.ts.map +1 -0
- package/dist/tools/common/batch.js +273 -0
- package/dist/tools/common/batch.js.map +1 -0
- package/dist/tools/common/convert.d.ts +41 -0
- package/dist/tools/common/convert.d.ts.map +1 -0
- package/dist/tools/common/convert.js +299 -0
- package/dist/tools/common/convert.js.map +1 -0
- package/dist/tools/common/general.d.ts +36 -0
- package/dist/tools/common/general.d.ts.map +1 -0
- package/dist/tools/common/general.js +582 -0
- package/dist/tools/common/general.js.map +1 -0
- package/dist/tools/common/index.d.ts +38 -0
- package/dist/tools/common/index.d.ts.map +1 -0
- package/dist/tools/common/index.js +116 -0
- package/dist/tools/common/index.js.map +1 -0
- package/dist/tools/common/intent.d.ts +48 -0
- package/dist/tools/common/intent.d.ts.map +1 -0
- package/dist/tools/common/intent.js +221 -0
- package/dist/tools/common/intent.js.map +1 -0
- package/dist/tools/common/repair.d.ts +29 -0
- package/dist/tools/common/repair.d.ts.map +1 -0
- package/dist/tools/common/repair.js +140 -0
- package/dist/tools/common/repair.js.map +1 -0
- package/dist/tools/common/snapshot.d.ts +77 -0
- package/dist/tools/common/snapshot.d.ts.map +1 -0
- package/dist/tools/common/snapshot.js +497 -0
- package/dist/tools/common/snapshot.js.map +1 -0
- package/dist/tools/common/status.d.ts +27 -0
- package/dist/tools/common/status.d.ts.map +1 -0
- package/dist/tools/common/status.js +139 -0
- package/dist/tools/common/status.js.map +1 -0
- package/dist/tools/common/toolgroups.d.ts +38 -0
- package/dist/tools/common/toolgroups.d.ts.map +1 -0
- package/dist/tools/common/toolgroups.js +254 -0
- package/dist/tools/common/toolgroups.js.map +1 -0
- package/dist/tools/excel/chart.d.ts +86 -0
- package/dist/tools/excel/chart.d.ts.map +1 -0
- package/dist/tools/excel/chart.js +659 -0
- package/dist/tools/excel/chart.js.map +1 -0
- package/dist/tools/excel/comment-protect.d.ts +58 -0
- package/dist/tools/excel/comment-protect.d.ts.map +1 -0
- package/dist/tools/excel/comment-protect.js +274 -0
- package/dist/tools/excel/comment-protect.js.map +1 -0
- package/dist/tools/excel/data-advanced.d.ts +47 -0
- package/dist/tools/excel/data-advanced.d.ts.map +1 -0
- package/dist/tools/excel/data-advanced.js +263 -0
- package/dist/tools/excel/data-advanced.js.map +1 -0
- package/dist/tools/excel/data.d.ts +86 -0
- package/dist/tools/excel/data.d.ts.map +1 -0
- package/dist/tools/excel/data.js +606 -0
- package/dist/tools/excel/data.js.map +1 -0
- package/dist/tools/excel/format.d.ts +42 -0
- package/dist/tools/excel/format.d.ts.map +1 -0
- package/dist/tools/excel/format.js +717 -0
- package/dist/tools/excel/format.js.map +1 -0
- package/dist/tools/excel/formula.d.ts +55 -0
- package/dist/tools/excel/formula.d.ts.map +1 -0
- package/dist/tools/excel/formula.js +316 -0
- package/dist/tools/excel/formula.js.map +1 -0
- package/dist/tools/excel/index.d.ts +44 -0
- package/dist/tools/excel/index.d.ts.map +1 -0
- package/dist/tools/excel/index.js +241 -0
- package/dist/tools/excel/index.js.map +1 -0
- package/dist/tools/excel/pivot.d.ts +39 -0
- package/dist/tools/excel/pivot.d.ts.map +1 -0
- package/dist/tools/excel/pivot.js +455 -0
- package/dist/tools/excel/pivot.js.map +1 -0
- package/dist/tools/excel/row-column.d.ts +64 -0
- package/dist/tools/excel/row-column.d.ts.map +1 -0
- package/dist/tools/excel/row-column.js +299 -0
- package/dist/tools/excel/row-column.js.map +1 -0
- package/dist/tools/excel/sheet-gaps.d.ts +50 -0
- package/dist/tools/excel/sheet-gaps.d.ts.map +1 -0
- package/dist/tools/excel/sheet-gaps.js +373 -0
- package/dist/tools/excel/sheet-gaps.js.map +1 -0
- package/dist/tools/excel/sheet.d.ts +102 -0
- package/dist/tools/excel/sheet.d.ts.map +1 -0
- package/dist/tools/excel/sheet.js +827 -0
- package/dist/tools/excel/sheet.js.map +1 -0
- package/dist/tools/excel/workbook.d.ts +62 -0
- package/dist/tools/excel/workbook.d.ts.map +1 -0
- package/dist/tools/excel/workbook.js +371 -0
- package/dist/tools/excel/workbook.js.map +1 -0
- package/dist/tools/index.d.ts +48 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +113 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/ppt/animation.d.ts +36 -0
- package/dist/tools/ppt/animation.d.ts.map +1 -0
- package/dist/tools/ppt/animation.js +190 -0
- package/dist/tools/ppt/animation.js.map +1 -0
- package/dist/tools/ppt/background.d.ts +54 -0
- package/dist/tools/ppt/background.d.ts.map +1 -0
- package/dist/tools/ppt/background.js +389 -0
- package/dist/tools/ppt/background.js.map +1 -0
- package/dist/tools/ppt/beautify-advanced.d.ts +66 -0
- package/dist/tools/ppt/beautify-advanced.d.ts.map +1 -0
- package/dist/tools/ppt/beautify-advanced.js +600 -0
- package/dist/tools/ppt/beautify-advanced.js.map +1 -0
- package/dist/tools/ppt/chart-flow.d.ts +58 -0
- package/dist/tools/ppt/chart-flow.d.ts.map +1 -0
- package/dist/tools/ppt/chart-flow.js +523 -0
- package/dist/tools/ppt/chart-flow.js.map +1 -0
- package/dist/tools/ppt/data-viz.d.ts +64 -0
- package/dist/tools/ppt/data-viz.d.ts.map +1 -0
- package/dist/tools/ppt/data-viz.js +514 -0
- package/dist/tools/ppt/data-viz.js.map +1 -0
- package/dist/tools/ppt/image.d.ts +30 -0
- package/dist/tools/ppt/image.d.ts.map +1 -0
- package/dist/tools/ppt/image.js +447 -0
- package/dist/tools/ppt/image.js.map +1 -0
- package/dist/tools/ppt/index.d.ts +72 -0
- package/dist/tools/ppt/index.d.ts.map +1 -0
- package/dist/tools/ppt/index.js +320 -0
- package/dist/tools/ppt/index.js.map +1 -0
- package/dist/tools/ppt/misc.d.ts +93 -0
- package/dist/tools/ppt/misc.d.ts.map +1 -0
- package/dist/tools/ppt/misc.js +817 -0
- package/dist/tools/ppt/misc.js.map +1 -0
- package/dist/tools/ppt/presentation.d.ts +72 -0
- package/dist/tools/ppt/presentation.d.ts.map +1 -0
- package/dist/tools/ppt/presentation.js +694 -0
- package/dist/tools/ppt/presentation.js.map +1 -0
- package/dist/tools/ppt/shape-basic.d.ts +46 -0
- package/dist/tools/ppt/shape-basic.d.ts.map +1 -0
- package/dist/tools/ppt/shape-basic.js +756 -0
- package/dist/tools/ppt/shape-basic.js.map +1 -0
- package/dist/tools/ppt/slide-ops.d.ts +73 -0
- package/dist/tools/ppt/slide-ops.d.ts.map +1 -0
- package/dist/tools/ppt/slide-ops.js +1740 -0
- package/dist/tools/ppt/slide-ops.js.map +1 -0
- package/dist/tools/ppt/slide.d.ts +51 -0
- package/dist/tools/ppt/slide.d.ts.map +1 -0
- package/dist/tools/ppt/slide.js +484 -0
- package/dist/tools/ppt/slide.js.map +1 -0
- package/dist/tools/ppt/table.d.ts +58 -0
- package/dist/tools/ppt/table.d.ts.map +1 -0
- package/dist/tools/ppt/table.js +514 -0
- package/dist/tools/ppt/table.js.map +1 -0
- package/dist/tools/ppt/textbox.d.ts +47 -0
- package/dist/tools/ppt/textbox.d.ts.map +1 -0
- package/dist/tools/ppt/textbox.js +249 -0
- package/dist/tools/ppt/textbox.js.map +1 -0
- package/dist/tools/word/academic.d.ts +50 -0
- package/dist/tools/word/academic.d.ts.map +1 -0
- package/dist/tools/word/academic.js +500 -0
- package/dist/tools/word/academic.js.map +1 -0
- package/dist/tools/word/content.d.ts +97 -0
- package/dist/tools/word/content.d.ts.map +1 -0
- package/dist/tools/word/content.js +843 -0
- package/dist/tools/word/content.js.map +1 -0
- package/dist/tools/word/document.d.ts +65 -0
- package/dist/tools/word/document.d.ts.map +1 -0
- package/dist/tools/word/document.js +576 -0
- package/dist/tools/word/document.js.map +1 -0
- package/dist/tools/word/format.d.ts +50 -0
- package/dist/tools/word/format.d.ts.map +1 -0
- package/dist/tools/word/format.js +462 -0
- package/dist/tools/word/format.js.map +1 -0
- package/dist/tools/word/gaps.d.ts +58 -0
- package/dist/tools/word/gaps.d.ts.map +1 -0
- package/dist/tools/word/gaps.js +431 -0
- package/dist/tools/word/gaps.js.map +1 -0
- package/dist/tools/word/index.d.ts +34 -0
- package/dist/tools/word/index.d.ts.map +1 -0
- package/dist/tools/word/index.js +122 -0
- package/dist/tools/word/index.js.map +1 -0
- package/dist/tools/word/professional.d.ts +48 -0
- package/dist/tools/word/professional.d.ts.map +1 -0
- package/dist/tools/word/professional.js +657 -0
- package/dist/tools/word/professional.js.map +1 -0
- package/dist/tools/word/proofread.d.ts +25 -0
- package/dist/tools/word/proofread.d.ts.map +1 -0
- package/dist/tools/word/proofread.js +718 -0
- package/dist/tools/word/proofread.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/tools.d.ts +174 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +45 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/wps.d.ts +190 -0
- package/dist/types/wps.d.ts.map +1 -0
- package/dist/types/wps.js +23 -0
- package/dist/types/wps.js.map +1 -0
- package/dist/utils/error.d.ts +147 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +417 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/logger.d.ts +56 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +155 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/version.d.ts +22 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +101 -0
- package/dist/version.js.map +1 -0
- package/package.json +66 -6
- package/scripts/wps-com.ps1 +8255 -0
- package/scripts/wps-comd.ps1 +123 -0
- package/skills/wps-multitool/SKILL.md +129 -0
- package/skills/wps-multitool/references/errors.md +62 -0
- package/skills/wps-multitool/references/recipes.md +83 -0
- package/skills/wps-multitool/references/routing.md +88 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Input: Word 格式化参数
|
|
4
|
+
* Output: 样式与字体设置结果
|
|
5
|
+
* Pos: Word 格式化工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
|
|
6
|
+
* Word格式化Tools - 排版格式化模块
|
|
7
|
+
* 处理文档样式、字体、目录等格式化需求
|
|
8
|
+
*
|
|
9
|
+
* 包含:
|
|
10
|
+
* - wps_word_apply_style: 应用样式到选中区域
|
|
11
|
+
* - wps_word_set_font: 设置字体格式
|
|
12
|
+
* - wps_word_generate_toc: 生成目录
|
|
13
|
+
* - wps_word_insert_bookmark: 插入书签
|
|
14
|
+
* - wps_word_set_page_setup: 设置页面布局
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.formatTools = exports.setPageSetupHandler = exports.setPageSetupDefinition = exports.insertBookmarkHandler = exports.insertBookmarkDefinition = exports.generateTocHandler = exports.generateTocDefinition = exports.setFontHandler = exports.setFontDefinition = exports.applyStyleHandler = exports.applyStyleDefinition = void 0;
|
|
18
|
+
const uuid_1 = require("uuid");
|
|
19
|
+
const tools_1 = require("../../types/tools");
|
|
20
|
+
const wps_client_1 = require("../../client/wps-client");
|
|
21
|
+
const wps_1 = require("../../types/wps");
|
|
22
|
+
/**
|
|
23
|
+
* 应用样式到选中区域
|
|
24
|
+
* 快速应用Word内置样式,比如标题1、标题2、正文等
|
|
25
|
+
*/
|
|
26
|
+
exports.applyStyleDefinition = {
|
|
27
|
+
name: 'wps_word_apply_style',
|
|
28
|
+
description: `应用Word样式到当前选中区域或指定范围。
|
|
29
|
+
|
|
30
|
+
支持的常用样式:
|
|
31
|
+
- 标题1、标题2、标题3...(或 Heading 1, Heading 2...)
|
|
32
|
+
- 正文、正文首行缩进
|
|
33
|
+
- 引用、强调
|
|
34
|
+
- 列表段落
|
|
35
|
+
|
|
36
|
+
使用场景:
|
|
37
|
+
- "把这段设成标题1"
|
|
38
|
+
- "应用正文样式"`,
|
|
39
|
+
category: tools_1.ToolCategory.DOCUMENT,
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
style_name: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: '样式名称,如 "标题 1"、"正文"、"Heading 1"',
|
|
46
|
+
},
|
|
47
|
+
range: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
description: '指定范围,不填则应用到当前选中区域',
|
|
50
|
+
properties: {
|
|
51
|
+
start: {
|
|
52
|
+
type: 'number',
|
|
53
|
+
description: '起始位置(字符索引)',
|
|
54
|
+
},
|
|
55
|
+
end: {
|
|
56
|
+
type: 'number',
|
|
57
|
+
description: '结束位置(字符索引)',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: ['style_name'],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const applyStyleHandler = async (args) => {
|
|
66
|
+
const { style_name, range } = args;
|
|
67
|
+
try {
|
|
68
|
+
const response = await wps_client_1.wpsClient.executeMethod('applyStyle', { styleName: style_name, range }, wps_1.WpsAppType.WRITER);
|
|
69
|
+
if (response.success && response.data) {
|
|
70
|
+
return {
|
|
71
|
+
id: (0, uuid_1.v4)(),
|
|
72
|
+
success: true,
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: `样式应用成功!\n样式: ${style_name}\n影响的文本: ${response.data.affectedText}`,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return {
|
|
83
|
+
id: (0, uuid_1.v4)(),
|
|
84
|
+
success: false,
|
|
85
|
+
content: [{ type: 'text', text: `应用样式失败: ${response.error}` }],
|
|
86
|
+
error: response.error,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
92
|
+
return {
|
|
93
|
+
id: (0, uuid_1.v4)(),
|
|
94
|
+
success: false,
|
|
95
|
+
content: [{ type: 'text', text: `应用样式出错: ${errMsg}` }],
|
|
96
|
+
error: errMsg,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.applyStyleHandler = applyStyleHandler;
|
|
101
|
+
/**
|
|
102
|
+
* 设置字体格式
|
|
103
|
+
*/
|
|
104
|
+
exports.setFontDefinition = {
|
|
105
|
+
name: 'wps_word_set_font',
|
|
106
|
+
description: `设置字体格式,包括字体名称、字号、加粗、斜体、颜色等。
|
|
107
|
+
|
|
108
|
+
使用场景:
|
|
109
|
+
- "把标题改成微软雅黑24号加粗"
|
|
110
|
+
- "把这段文字改成红色"
|
|
111
|
+
- "全文字体改成宋体小四"`,
|
|
112
|
+
category: tools_1.ToolCategory.DOCUMENT,
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
font_name: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
description: '字体名称,如 "微软雅黑"、"宋体"、"Arial"',
|
|
119
|
+
},
|
|
120
|
+
font_size: {
|
|
121
|
+
type: 'number',
|
|
122
|
+
description: '字号,如 12、14、24',
|
|
123
|
+
},
|
|
124
|
+
bold: {
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
description: '是否加粗',
|
|
127
|
+
},
|
|
128
|
+
italic: {
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
description: '是否斜体',
|
|
131
|
+
},
|
|
132
|
+
underline: {
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
description: '是否下划线',
|
|
135
|
+
},
|
|
136
|
+
color: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: '字体颜色,支持颜色名称(red/blue/green)或十六进制(#FF0000)',
|
|
139
|
+
},
|
|
140
|
+
range: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: '应用范围,可选值: "selection"(当前选中), "all"(全文)。默认selection',
|
|
143
|
+
enum: ['selection', 'all'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
required: [],
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
const setFontHandler = async (args) => {
|
|
150
|
+
const { font_name, font_size, bold, italic, underline, color, range } = args;
|
|
151
|
+
// 至少要设置一个属性吧
|
|
152
|
+
if (!font_name && !font_size && bold === undefined && italic === undefined &&
|
|
153
|
+
underline === undefined && !color) {
|
|
154
|
+
return {
|
|
155
|
+
id: (0, uuid_1.v4)(),
|
|
156
|
+
success: false,
|
|
157
|
+
content: [{ type: 'text', text: '请至少指定一个字体属性(如 font_name、font_size、bold 等)' }],
|
|
158
|
+
error: '没有指定任何字体属性',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const response = await wps_client_1.wpsClient.executeMethod('setFont', {
|
|
163
|
+
fontName: font_name,
|
|
164
|
+
fontSize: font_size,
|
|
165
|
+
bold,
|
|
166
|
+
italic,
|
|
167
|
+
underline,
|
|
168
|
+
color,
|
|
169
|
+
range: range || 'selection',
|
|
170
|
+
}, wps_1.WpsAppType.WRITER);
|
|
171
|
+
if (response.success && response.data) {
|
|
172
|
+
const settings = response.data.settings;
|
|
173
|
+
let settingStr = '';
|
|
174
|
+
if (settings.fontName)
|
|
175
|
+
settingStr += `字体: ${settings.fontName}\n`;
|
|
176
|
+
if (settings.fontSize)
|
|
177
|
+
settingStr += `字号: ${settings.fontSize}\n`;
|
|
178
|
+
if (settings.bold !== undefined)
|
|
179
|
+
settingStr += `加粗: ${settings.bold ? '是' : '否'}\n`;
|
|
180
|
+
if (settings.italic !== undefined)
|
|
181
|
+
settingStr += `斜体: ${settings.italic ? '是' : '否'}\n`;
|
|
182
|
+
if (settings.color)
|
|
183
|
+
settingStr += `颜色: ${settings.color}\n`;
|
|
184
|
+
return {
|
|
185
|
+
id: (0, uuid_1.v4)(),
|
|
186
|
+
success: true,
|
|
187
|
+
content: [
|
|
188
|
+
{
|
|
189
|
+
type: 'text',
|
|
190
|
+
text: `字体格式设置成功!\n${settingStr}`,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return {
|
|
197
|
+
id: (0, uuid_1.v4)(),
|
|
198
|
+
success: false,
|
|
199
|
+
content: [{ type: 'text', text: `设置字体失败: ${response.error}` }],
|
|
200
|
+
error: response.error,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
206
|
+
return {
|
|
207
|
+
id: (0, uuid_1.v4)(),
|
|
208
|
+
success: false,
|
|
209
|
+
content: [{ type: 'text', text: `设置字体出错: ${errMsg}` }],
|
|
210
|
+
error: errMsg,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
exports.setFontHandler = setFontHandler;
|
|
215
|
+
/**
|
|
216
|
+
* 生成目录
|
|
217
|
+
* 自动根据文档中的标题样式生成目录
|
|
218
|
+
*/
|
|
219
|
+
exports.generateTocDefinition = {
|
|
220
|
+
name: 'wps_word_generate_toc',
|
|
221
|
+
description: `根据文档中的标题样式自动生成目录。
|
|
222
|
+
|
|
223
|
+
前提条件:文档中的标题必须使用"标题1"、"标题2"等样式。
|
|
224
|
+
|
|
225
|
+
使用场景:
|
|
226
|
+
- "帮我生成目录"
|
|
227
|
+
- "在文档开头插入目录"`,
|
|
228
|
+
category: tools_1.ToolCategory.DOCUMENT,
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: 'object',
|
|
231
|
+
properties: {
|
|
232
|
+
position: {
|
|
233
|
+
type: 'string',
|
|
234
|
+
description: '插入位置,可选值: "start"(文档开头), "cursor"(当前光标位置)。默认start',
|
|
235
|
+
enum: ['start', 'cursor'],
|
|
236
|
+
},
|
|
237
|
+
levels: {
|
|
238
|
+
type: 'number',
|
|
239
|
+
description: '目录包含的标题级别数,如 3 表示包含标题1-3。默认3',
|
|
240
|
+
},
|
|
241
|
+
include_page_numbers: {
|
|
242
|
+
type: 'boolean',
|
|
243
|
+
description: '是否包含页码,默认true',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
required: [],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
const generateTocHandler = async (args) => {
|
|
250
|
+
const { position, levels, include_page_numbers } = args;
|
|
251
|
+
try {
|
|
252
|
+
const response = await wps_client_1.wpsClient.executeMethod('generateTOC', {
|
|
253
|
+
position: position || 'start',
|
|
254
|
+
levels: levels || 3,
|
|
255
|
+
includePageNumbers: include_page_numbers !== false,
|
|
256
|
+
}, wps_1.WpsAppType.WRITER);
|
|
257
|
+
if (response.success && response.data) {
|
|
258
|
+
return {
|
|
259
|
+
id: (0, uuid_1.v4)(),
|
|
260
|
+
success: true,
|
|
261
|
+
content: [
|
|
262
|
+
{
|
|
263
|
+
type: 'text',
|
|
264
|
+
text: `目录生成成功!\n包含标题级别: 1-${response.data.levels}\n位置: ${position === 'cursor' ? '当前光标位置' : '文档开头'}`,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
return {
|
|
271
|
+
id: (0, uuid_1.v4)(),
|
|
272
|
+
success: false,
|
|
273
|
+
content: [{ type: 'text', text: `生成目录失败: ${response.error}` }],
|
|
274
|
+
error: response.error,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
280
|
+
return {
|
|
281
|
+
id: (0, uuid_1.v4)(),
|
|
282
|
+
success: false,
|
|
283
|
+
content: [{ type: 'text', text: `生成目录出错: ${errMsg}` }],
|
|
284
|
+
error: errMsg,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
exports.generateTocHandler = generateTocHandler;
|
|
289
|
+
/**
|
|
290
|
+
* 插入书签
|
|
291
|
+
* 在当前光标位置插入书签,方便交叉引用和导航
|
|
292
|
+
*/
|
|
293
|
+
exports.insertBookmarkDefinition = {
|
|
294
|
+
name: 'wps_word_insert_bookmark',
|
|
295
|
+
description: `在当前光标位置或选中区域插入书签。
|
|
296
|
+
|
|
297
|
+
书签可用于:
|
|
298
|
+
- 交叉引用
|
|
299
|
+
- 超链接跳转目标
|
|
300
|
+
- 文档内快速导航
|
|
301
|
+
|
|
302
|
+
使用场景:
|
|
303
|
+
- "在这里插入一个书签"
|
|
304
|
+
- "标记这个位置为'章节开头'"`,
|
|
305
|
+
category: tools_1.ToolCategory.DOCUMENT,
|
|
306
|
+
inputSchema: {
|
|
307
|
+
type: 'object',
|
|
308
|
+
properties: {
|
|
309
|
+
name: {
|
|
310
|
+
type: 'string',
|
|
311
|
+
description: '书签名称,不能包含空格,建议使用英文或下划线连接',
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
required: ['name'],
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
const insertBookmarkHandler = async (args) => {
|
|
318
|
+
const { name } = args;
|
|
319
|
+
try {
|
|
320
|
+
const response = await wps_client_1.wpsClient.executeMethod('insertBookmark', { name }, wps_1.WpsAppType.WRITER);
|
|
321
|
+
if (response.success) {
|
|
322
|
+
return {
|
|
323
|
+
id: (0, uuid_1.v4)(),
|
|
324
|
+
success: true,
|
|
325
|
+
content: [
|
|
326
|
+
{
|
|
327
|
+
type: 'text',
|
|
328
|
+
text: `书签插入成功!\n书签名称: ${name}`,
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
return {
|
|
335
|
+
id: (0, uuid_1.v4)(),
|
|
336
|
+
success: false,
|
|
337
|
+
content: [{ type: 'text', text: `插入书签失败: ${response.error}` }],
|
|
338
|
+
error: response.error,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
344
|
+
return {
|
|
345
|
+
id: (0, uuid_1.v4)(),
|
|
346
|
+
success: false,
|
|
347
|
+
content: [{ type: 'text', text: `插入书签出错: ${errMsg}` }],
|
|
348
|
+
error: errMsg,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
exports.insertBookmarkHandler = insertBookmarkHandler;
|
|
353
|
+
/**
|
|
354
|
+
* 设置页面布局
|
|
355
|
+
* 调整页面方向、边距等页面设置
|
|
356
|
+
*/
|
|
357
|
+
exports.setPageSetupDefinition = {
|
|
358
|
+
name: 'wps_word_set_page_setup',
|
|
359
|
+
description: `设置文档页面布局,包括页面方向和边距。
|
|
360
|
+
|
|
361
|
+
使用场景:
|
|
362
|
+
- "把页面改成横向"
|
|
363
|
+
- "设置上下边距为2厘米"
|
|
364
|
+
- "调整页面为A4横向,边距2cm"`,
|
|
365
|
+
category: tools_1.ToolCategory.DOCUMENT,
|
|
366
|
+
inputSchema: {
|
|
367
|
+
type: 'object',
|
|
368
|
+
properties: {
|
|
369
|
+
orientation: {
|
|
370
|
+
type: 'string',
|
|
371
|
+
description: '页面方向: "portrait"(纵向) 或 "landscape"(横向)',
|
|
372
|
+
enum: ['portrait', 'landscape'],
|
|
373
|
+
},
|
|
374
|
+
marginTop: {
|
|
375
|
+
type: 'number',
|
|
376
|
+
description: '上边距(磅值)',
|
|
377
|
+
},
|
|
378
|
+
marginBottom: {
|
|
379
|
+
type: 'number',
|
|
380
|
+
description: '下边距(磅值)',
|
|
381
|
+
},
|
|
382
|
+
marginLeft: {
|
|
383
|
+
type: 'number',
|
|
384
|
+
description: '左边距(磅值)',
|
|
385
|
+
},
|
|
386
|
+
marginRight: {
|
|
387
|
+
type: 'number',
|
|
388
|
+
description: '右边距(磅值)',
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
required: [],
|
|
392
|
+
},
|
|
393
|
+
};
|
|
394
|
+
const setPageSetupHandler = async (args) => {
|
|
395
|
+
const { orientation, marginTop, marginBottom, marginLeft, marginRight } = args;
|
|
396
|
+
if (!orientation && marginTop === undefined && marginBottom === undefined &&
|
|
397
|
+
marginLeft === undefined && marginRight === undefined) {
|
|
398
|
+
return {
|
|
399
|
+
id: (0, uuid_1.v4)(),
|
|
400
|
+
success: false,
|
|
401
|
+
content: [{ type: 'text', text: '请至少指定一个页面设置属性(如 orientation、marginTop 等)' }],
|
|
402
|
+
error: '没有指定任何页面设置属性',
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const response = await wps_client_1.wpsClient.executeMethod('setPageSetup', { orientation, marginTop, marginBottom, marginLeft, marginRight }, wps_1.WpsAppType.WRITER);
|
|
407
|
+
if (response.success && response.data) {
|
|
408
|
+
const s = response.data.settings;
|
|
409
|
+
let desc = '';
|
|
410
|
+
if (s.orientation)
|
|
411
|
+
desc += `页面方向: ${s.orientation === 'landscape' ? '横向' : '纵向'}\n`;
|
|
412
|
+
if (s.marginTop !== undefined)
|
|
413
|
+
desc += `上边距: ${s.marginTop}pt\n`;
|
|
414
|
+
if (s.marginBottom !== undefined)
|
|
415
|
+
desc += `下边距: ${s.marginBottom}pt\n`;
|
|
416
|
+
if (s.marginLeft !== undefined)
|
|
417
|
+
desc += `左边距: ${s.marginLeft}pt\n`;
|
|
418
|
+
if (s.marginRight !== undefined)
|
|
419
|
+
desc += `右边距: ${s.marginRight}pt\n`;
|
|
420
|
+
return {
|
|
421
|
+
id: (0, uuid_1.v4)(),
|
|
422
|
+
success: true,
|
|
423
|
+
content: [
|
|
424
|
+
{
|
|
425
|
+
type: 'text',
|
|
426
|
+
text: `页面布局设置成功!\n${desc}`,
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
return {
|
|
433
|
+
id: (0, uuid_1.v4)(),
|
|
434
|
+
success: false,
|
|
435
|
+
content: [{ type: 'text', text: `设置页面布局失败: ${response.error}` }],
|
|
436
|
+
error: response.error,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
442
|
+
return {
|
|
443
|
+
id: (0, uuid_1.v4)(),
|
|
444
|
+
success: false,
|
|
445
|
+
content: [{ type: 'text', text: `设置页面布局出错: ${errMsg}` }],
|
|
446
|
+
error: errMsg,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
exports.setPageSetupHandler = setPageSetupHandler;
|
|
451
|
+
/**
|
|
452
|
+
* 导出所有格式化相关的Tools
|
|
453
|
+
*/
|
|
454
|
+
exports.formatTools = [
|
|
455
|
+
{ definition: exports.applyStyleDefinition, handler: exports.applyStyleHandler },
|
|
456
|
+
{ definition: exports.setFontDefinition, handler: exports.setFontHandler },
|
|
457
|
+
{ definition: exports.generateTocDefinition, handler: exports.generateTocHandler },
|
|
458
|
+
{ definition: exports.insertBookmarkDefinition, handler: exports.insertBookmarkHandler },
|
|
459
|
+
{ definition: exports.setPageSetupDefinition, handler: exports.setPageSetupHandler },
|
|
460
|
+
];
|
|
461
|
+
exports.default = exports.formatTools;
|
|
462
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/tools/word/format.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,+BAAoC;AACpC,6CAM2B;AAC3B,wDAAoD;AACpD,yCAA6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ACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,OAAO;YACL,EAAE,EAAE,IAAA,SAAM,GAAE;YACZ,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,MAAM,EAAE,EAAE,CAAC;YACxD,KAAK,EAAE,MAAM;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AApEW,QAAA,mBAAmB,uBAoE9B;AAEF;;GAEG;AACU,QAAA,WAAW,GAAqB;IAC3C,EAAE,UAAU,EAAE,4BAAoB,EAAE,OAAO,EAAE,yBAAiB,EAAE;IAChE,EAAE,UAAU,EAAE,yBAAiB,EAAE,OAAO,EAAE,sBAAc,EAAE;IAC1D,EAAE,UAAU,EAAE,6BAAqB,EAAE,OAAO,EAAE,0BAAkB,EAAE;IAClE,EAAE,UAAU,EAAE,gCAAwB,EAAE,OAAO,EAAE,6BAAqB,EAAE;IACxE,EAAE,UAAU,EAAE,8BAAsB,EAAE,OAAO,EAAE,2BAAmB,EAAE;CACrE,CAAC;AAEF,kBAAe,mBAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input: Word 深水区工具的参数(统计/批注/书签/表格读取、建关文档、超链接、表转文本)
|
|
3
|
+
* Output: 各自的查询或修改结果
|
|
4
|
+
* Pos: 第 5 期补齐的 Word 缺口。一旦我被修改,请更新我的头部注释,以及所属目录的md。
|
|
5
|
+
*
|
|
6
|
+
* 这一批补的是什么
|
|
7
|
+
* ----------------
|
|
8
|
+
* 对着同类 WPS 自动化工具的公开能力清单逐项比对后挑出来的**真缺口**:
|
|
9
|
+
* 同类 61 / 本仓 58,数量不差,差在"深水区"三批 ——
|
|
10
|
+
*
|
|
11
|
+
* 一、读侧太弱(模型只能盲写)。现只能插批注/建书签/插表格,
|
|
12
|
+
* 读不了删不掉:"文档里有几个表、表里有什么"答不上,
|
|
13
|
+
* skill 里"先读后写"的原则没有工具支撑。→ get_document_stats /
|
|
14
|
+
* get_comments / get_bookmarks / get_tables / get_table_data
|
|
15
|
+
* 二、建不了新文档。PS 动作 createDocument 早就有(还修过"零等待返回空壳"的
|
|
16
|
+
* 病史),但一直没有 TS 工具暴露 —— Word 建不了新文档,而 Excel 有
|
|
17
|
+
* create_workbook。→ create_document / close_document
|
|
18
|
+
* 三、批注管理无闭环、超链接完全没有。→ delete_comment / insert_hyperlink
|
|
19
|
+
* 外加 convert_table_to_text(表格贴去别处前的常规动作)。
|
|
20
|
+
*
|
|
21
|
+
* 刻意不补的(对方有我也不做):
|
|
22
|
+
* get_revisions / accept / reject —— wps_word_revisions 的 mode
|
|
23
|
+
* (list/acceptAll/rejectAll/acceptOne/rejectOne)已全覆盖,拆三个只增加模型选择负担;
|
|
24
|
+
* mail_merge / content_control —— WPS 12.1 支持度存疑或场景边缘。
|
|
25
|
+
*
|
|
26
|
+
* close_document 的"未保存怎么办"(设计答案,不是实现细节)
|
|
27
|
+
* ------------------------------------------------------
|
|
28
|
+
* COM 是 STA:关闭未保存文档会弹「另存为」模态框,弹框就把桥通道卡死。
|
|
29
|
+
* PS 侧对此有确定性守卫 —— 文档从未保存过时直接报错,让调用方先 save_as,
|
|
30
|
+
* 或显式 save=false。工具描述里必须把这条说给模型听。
|
|
31
|
+
*
|
|
32
|
+
* 真机支持度:新 PS 动作逐个探过(__probeWordCaps,在临时文档上探、探完删),
|
|
33
|
+
* 见 scripts/manual/word-caps-probe.js。
|
|
34
|
+
*/
|
|
35
|
+
import { ToolDefinition, ToolHandler, RegisteredTool } from '../../types/tools';
|
|
36
|
+
export declare const getDocumentStatsDefinition: ToolDefinition;
|
|
37
|
+
export declare const getDocumentStatsHandler: ToolHandler;
|
|
38
|
+
export declare const getCommentsDefinition: ToolDefinition;
|
|
39
|
+
export declare const getCommentsHandler: ToolHandler;
|
|
40
|
+
export declare const deleteCommentDefinition: ToolDefinition;
|
|
41
|
+
export declare const deleteCommentHandler: ToolHandler;
|
|
42
|
+
export declare const getBookmarksDefinition: ToolDefinition;
|
|
43
|
+
export declare const getBookmarksHandler: ToolHandler;
|
|
44
|
+
export declare const getTablesDefinition: ToolDefinition;
|
|
45
|
+
export declare const getTablesHandler: ToolHandler;
|
|
46
|
+
export declare const getTableDataDefinition: ToolDefinition;
|
|
47
|
+
export declare const getTableDataHandler: ToolHandler;
|
|
48
|
+
export declare const createDocumentDefinition: ToolDefinition;
|
|
49
|
+
export declare const createDocumentHandler: ToolHandler;
|
|
50
|
+
export declare const closeDocumentDefinition: ToolDefinition;
|
|
51
|
+
export declare const closeDocumentHandler: ToolHandler;
|
|
52
|
+
export declare const insertHyperlinkDefinition: ToolDefinition;
|
|
53
|
+
export declare const insertHyperlinkHandler: ToolHandler;
|
|
54
|
+
export declare const convertTableToTextDefinition: ToolDefinition;
|
|
55
|
+
export declare const convertTableToTextHandler: ToolHandler;
|
|
56
|
+
export declare const gapTools: RegisteredTool[];
|
|
57
|
+
export default gapTools;
|
|
58
|
+
//# sourceMappingURL=gaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gaps.d.ts","sourceRoot":"","sources":["../../../src/tools/word/gaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EACL,cAAc,EACd,WAAW,EAGX,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAuC3B,eAAO,MAAM,0BAA0B,EAAE,cAaxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,WAsBrC,CAAC;AAMF,eAAO,MAAM,qBAAqB,EAAE,cAYnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAoBhC,CAAC;AAMF,eAAO,MAAM,uBAAuB,EAAE,cAoBrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EA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