wps-multitool-mcp 0.0.0-stage → 1.0.1

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.
Files changed (280) hide show
  1. package/README.md +3 -3
  2. package/dist/bridge/cancellable.d.ts +36 -0
  3. package/dist/bridge/cancellable.d.ts.map +1 -0
  4. package/dist/bridge/cancellable.js +155 -0
  5. package/dist/bridge/cancellable.js.map +1 -0
  6. package/dist/bridge/index.d.ts +37 -0
  7. package/dist/bridge/index.d.ts.map +1 -0
  8. package/dist/bridge/index.js +381 -0
  9. package/dist/bridge/index.js.map +1 -0
  10. package/dist/bridge/ps-child.d.ts +155 -0
  11. package/dist/bridge/ps-child.d.ts.map +1 -0
  12. package/dist/bridge/ps-child.js +578 -0
  13. package/dist/bridge/ps-child.js.map +1 -0
  14. package/dist/client/action-routes.d.ts +32 -0
  15. package/dist/client/action-routes.d.ts.map +1 -0
  16. package/dist/client/action-routes.generated.d.ts +10 -0
  17. package/dist/client/action-routes.generated.d.ts.map +1 -0
  18. package/dist/client/action-routes.generated.js +322 -0
  19. package/dist/client/action-routes.generated.js.map +1 -0
  20. package/dist/client/action-routes.js +57 -0
  21. package/dist/client/action-routes.js.map +1 -0
  22. package/dist/client/mac-poll-server.d.ts +77 -0
  23. package/dist/client/mac-poll-server.d.ts.map +1 -0
  24. package/dist/client/mac-poll-server.js +516 -0
  25. package/dist/client/mac-poll-server.js.map +1 -0
  26. package/dist/client/ps-daemon.d.ts +95 -0
  27. package/dist/client/ps-daemon.d.ts.map +1 -0
  28. package/dist/client/ps-daemon.js +424 -0
  29. package/dist/client/ps-daemon.js.map +1 -0
  30. package/dist/client/wps-client.d.ts +72 -0
  31. package/dist/client/wps-client.d.ts.map +1 -0
  32. package/dist/client/wps-client.js +408 -0
  33. package/dist/client/wps-client.js.map +1 -0
  34. package/dist/index.d.ts +29 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +121 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/runtime-identity.d.ts +23 -0
  39. package/dist/runtime-identity.d.ts.map +1 -0
  40. package/dist/runtime-identity.js +26 -0
  41. package/dist/runtime-identity.js.map +1 -0
  42. package/dist/server/cancel-context.d.ts +30 -0
  43. package/dist/server/cancel-context.d.ts.map +1 -0
  44. package/dist/server/cancel-context.js +38 -0
  45. package/dist/server/cancel-context.js.map +1 -0
  46. package/dist/server/mcp-server.d.ts +74 -0
  47. package/dist/server/mcp-server.d.ts.map +1 -0
  48. package/dist/server/mcp-server.js +725 -0
  49. package/dist/server/mcp-server.js.map +1 -0
  50. package/dist/server/server-info.d.ts +21 -0
  51. package/dist/server/server-info.d.ts.map +1 -0
  52. package/dist/server/server-info.js +56 -0
  53. package/dist/server/server-info.js.map +1 -0
  54. package/dist/server/tool-annotations.d.ts +52 -0
  55. package/dist/server/tool-annotations.d.ts.map +1 -0
  56. package/dist/server/tool-annotations.generated.d.ts +14 -0
  57. package/dist/server/tool-annotations.generated.d.ts.map +1 -0
  58. package/dist/server/tool-annotations.generated.js +324 -0
  59. package/dist/server/tool-annotations.generated.js.map +1 -0
  60. package/dist/server/tool-annotations.js +116 -0
  61. package/dist/server/tool-annotations.js.map +1 -0
  62. package/dist/server/tool-group-events.d.ts +23 -0
  63. package/dist/server/tool-group-events.d.ts.map +1 -0
  64. package/dist/server/tool-group-events.js +44 -0
  65. package/dist/server/tool-group-events.js.map +1 -0
  66. package/dist/server/tool-metadata.d.ts +43 -0
  67. package/dist/server/tool-metadata.d.ts.map +1 -0
  68. package/dist/server/tool-metadata.js +657 -0
  69. package/dist/server/tool-metadata.js.map +1 -0
  70. package/dist/server/tool-registry.d.ts +164 -0
  71. package/dist/server/tool-registry.d.ts.map +1 -0
  72. package/dist/server/tool-registry.js +453 -0
  73. package/dist/server/tool-registry.js.map +1 -0
  74. package/dist/server/tool-tiers.d.ts +39 -0
  75. package/dist/server/tool-tiers.d.ts.map +1 -0
  76. package/dist/server/tool-tiers.js +102 -0
  77. package/dist/server/tool-tiers.js.map +1 -0
  78. package/dist/tools/common/batch.d.ts +33 -0
  79. package/dist/tools/common/batch.d.ts.map +1 -0
  80. package/dist/tools/common/batch.js +195 -0
  81. package/dist/tools/common/batch.js.map +1 -0
  82. package/dist/tools/common/convert.d.ts +41 -0
  83. package/dist/tools/common/convert.d.ts.map +1 -0
  84. package/dist/tools/common/convert.js +299 -0
  85. package/dist/tools/common/convert.js.map +1 -0
  86. package/dist/tools/common/general.d.ts +39 -0
  87. package/dist/tools/common/general.d.ts.map +1 -0
  88. package/dist/tools/common/general.js +624 -0
  89. package/dist/tools/common/general.js.map +1 -0
  90. package/dist/tools/common/index.d.ts +36 -0
  91. package/dist/tools/common/index.d.ts.map +1 -0
  92. package/dist/tools/common/index.js +102 -0
  93. package/dist/tools/common/index.js.map +1 -0
  94. package/dist/tools/common/intent.d.ts +48 -0
  95. package/dist/tools/common/intent.d.ts.map +1 -0
  96. package/dist/tools/common/intent.js +221 -0
  97. package/dist/tools/common/intent.js.map +1 -0
  98. package/dist/tools/common/repair.d.ts +29 -0
  99. package/dist/tools/common/repair.d.ts.map +1 -0
  100. package/dist/tools/common/repair.js +140 -0
  101. package/dist/tools/common/repair.js.map +1 -0
  102. package/dist/tools/common/status.d.ts +27 -0
  103. package/dist/tools/common/status.d.ts.map +1 -0
  104. package/dist/tools/common/status.js +139 -0
  105. package/dist/tools/common/status.js.map +1 -0
  106. package/dist/tools/common/toolgroups.d.ts +38 -0
  107. package/dist/tools/common/toolgroups.d.ts.map +1 -0
  108. package/dist/tools/common/toolgroups.js +238 -0
  109. package/dist/tools/common/toolgroups.js.map +1 -0
  110. package/dist/tools/excel/chart.d.ts +86 -0
  111. package/dist/tools/excel/chart.d.ts.map +1 -0
  112. package/dist/tools/excel/chart.js +659 -0
  113. package/dist/tools/excel/chart.js.map +1 -0
  114. package/dist/tools/excel/comment-protect.d.ts +58 -0
  115. package/dist/tools/excel/comment-protect.d.ts.map +1 -0
  116. package/dist/tools/excel/comment-protect.js +274 -0
  117. package/dist/tools/excel/comment-protect.js.map +1 -0
  118. package/dist/tools/excel/data-advanced.d.ts +47 -0
  119. package/dist/tools/excel/data-advanced.d.ts.map +1 -0
  120. package/dist/tools/excel/data-advanced.js +263 -0
  121. package/dist/tools/excel/data-advanced.js.map +1 -0
  122. package/dist/tools/excel/data.d.ts +91 -0
  123. package/dist/tools/excel/data.d.ts.map +1 -0
  124. package/dist/tools/excel/data.js +626 -0
  125. package/dist/tools/excel/data.js.map +1 -0
  126. package/dist/tools/excel/format.d.ts +42 -0
  127. package/dist/tools/excel/format.d.ts.map +1 -0
  128. package/dist/tools/excel/format.js +715 -0
  129. package/dist/tools/excel/format.js.map +1 -0
  130. package/dist/tools/excel/formula.d.ts +64 -0
  131. package/dist/tools/excel/formula.d.ts.map +1 -0
  132. package/dist/tools/excel/formula.js +333 -0
  133. package/dist/tools/excel/formula.js.map +1 -0
  134. package/dist/tools/excel/index.d.ts +44 -0
  135. package/dist/tools/excel/index.d.ts.map +1 -0
  136. package/dist/tools/excel/index.js +249 -0
  137. package/dist/tools/excel/index.js.map +1 -0
  138. package/dist/tools/excel/pivot.d.ts +39 -0
  139. package/dist/tools/excel/pivot.d.ts.map +1 -0
  140. package/dist/tools/excel/pivot.js +455 -0
  141. package/dist/tools/excel/pivot.js.map +1 -0
  142. package/dist/tools/excel/row-column.d.ts +64 -0
  143. package/dist/tools/excel/row-column.d.ts.map +1 -0
  144. package/dist/tools/excel/row-column.js +299 -0
  145. package/dist/tools/excel/row-column.js.map +1 -0
  146. package/dist/tools/excel/sheet-gaps.d.ts +50 -0
  147. package/dist/tools/excel/sheet-gaps.d.ts.map +1 -0
  148. package/dist/tools/excel/sheet-gaps.js +373 -0
  149. package/dist/tools/excel/sheet-gaps.js.map +1 -0
  150. package/dist/tools/excel/sheet.d.ts +112 -0
  151. package/dist/tools/excel/sheet.d.ts.map +1 -0
  152. package/dist/tools/excel/sheet.js +937 -0
  153. package/dist/tools/excel/sheet.js.map +1 -0
  154. package/dist/tools/excel/workbook.d.ts +62 -0
  155. package/dist/tools/excel/workbook.d.ts.map +1 -0
  156. package/dist/tools/excel/workbook.js +366 -0
  157. package/dist/tools/excel/workbook.js.map +1 -0
  158. package/dist/tools/index.d.ts +48 -0
  159. package/dist/tools/index.d.ts.map +1 -0
  160. package/dist/tools/index.js +113 -0
  161. package/dist/tools/index.js.map +1 -0
  162. package/dist/tools/ppt/animation.d.ts +79 -0
  163. package/dist/tools/ppt/animation.d.ts.map +1 -0
  164. package/dist/tools/ppt/animation.js +719 -0
  165. package/dist/tools/ppt/animation.js.map +1 -0
  166. package/dist/tools/ppt/background.d.ts +72 -0
  167. package/dist/tools/ppt/background.d.ts.map +1 -0
  168. package/dist/tools/ppt/background.js +595 -0
  169. package/dist/tools/ppt/background.js.map +1 -0
  170. package/dist/tools/ppt/beautify-advanced.d.ts +72 -0
  171. package/dist/tools/ppt/beautify-advanced.d.ts.map +1 -0
  172. package/dist/tools/ppt/beautify-advanced.js +663 -0
  173. package/dist/tools/ppt/beautify-advanced.js.map +1 -0
  174. package/dist/tools/ppt/chart-flow.d.ts +58 -0
  175. package/dist/tools/ppt/chart-flow.d.ts.map +1 -0
  176. package/dist/tools/ppt/chart-flow.js +523 -0
  177. package/dist/tools/ppt/chart-flow.js.map +1 -0
  178. package/dist/tools/ppt/data-viz.d.ts +64 -0
  179. package/dist/tools/ppt/data-viz.d.ts.map +1 -0
  180. package/dist/tools/ppt/data-viz.js +514 -0
  181. package/dist/tools/ppt/data-viz.js.map +1 -0
  182. package/dist/tools/ppt/image.d.ts +30 -0
  183. package/dist/tools/ppt/image.d.ts.map +1 -0
  184. package/dist/tools/ppt/image.js +452 -0
  185. package/dist/tools/ppt/image.js.map +1 -0
  186. package/dist/tools/ppt/index.d.ts +72 -0
  187. package/dist/tools/ppt/index.d.ts.map +1 -0
  188. package/dist/tools/ppt/index.js +350 -0
  189. package/dist/tools/ppt/index.js.map +1 -0
  190. package/dist/tools/ppt/misc.d.ts +99 -0
  191. package/dist/tools/ppt/misc.d.ts.map +1 -0
  192. package/dist/tools/ppt/misc.js +868 -0
  193. package/dist/tools/ppt/misc.js.map +1 -0
  194. package/dist/tools/ppt/presentation.d.ts +72 -0
  195. package/dist/tools/ppt/presentation.d.ts.map +1 -0
  196. package/dist/tools/ppt/presentation.js +680 -0
  197. package/dist/tools/ppt/presentation.js.map +1 -0
  198. package/dist/tools/ppt/shape-basic.d.ts +46 -0
  199. package/dist/tools/ppt/shape-basic.d.ts.map +1 -0
  200. package/dist/tools/ppt/shape-basic.js +756 -0
  201. package/dist/tools/ppt/shape-basic.js.map +1 -0
  202. package/dist/tools/ppt/slide-ops.d.ts +79 -0
  203. package/dist/tools/ppt/slide-ops.d.ts.map +1 -0
  204. package/dist/tools/ppt/slide-ops.js +1646 -0
  205. package/dist/tools/ppt/slide-ops.js.map +1 -0
  206. package/dist/tools/ppt/slide.d.ts +51 -0
  207. package/dist/tools/ppt/slide.d.ts.map +1 -0
  208. package/dist/tools/ppt/slide.js +470 -0
  209. package/dist/tools/ppt/slide.js.map +1 -0
  210. package/dist/tools/ppt/table.d.ts +58 -0
  211. package/dist/tools/ppt/table.d.ts.map +1 -0
  212. package/dist/tools/ppt/table.js +512 -0
  213. package/dist/tools/ppt/table.js.map +1 -0
  214. package/dist/tools/ppt/textbox.d.ts +47 -0
  215. package/dist/tools/ppt/textbox.d.ts.map +1 -0
  216. package/dist/tools/ppt/textbox.js +246 -0
  217. package/dist/tools/ppt/textbox.js.map +1 -0
  218. package/dist/tools/word/academic.d.ts +50 -0
  219. package/dist/tools/word/academic.d.ts.map +1 -0
  220. package/dist/tools/word/academic.js +500 -0
  221. package/dist/tools/word/academic.js.map +1 -0
  222. package/dist/tools/word/content.d.ts +97 -0
  223. package/dist/tools/word/content.d.ts.map +1 -0
  224. package/dist/tools/word/content.js +838 -0
  225. package/dist/tools/word/content.js.map +1 -0
  226. package/dist/tools/word/document.d.ts +70 -0
  227. package/dist/tools/word/document.d.ts.map +1 -0
  228. package/dist/tools/word/document.js +633 -0
  229. package/dist/tools/word/document.js.map +1 -0
  230. package/dist/tools/word/format.d.ts +50 -0
  231. package/dist/tools/word/format.d.ts.map +1 -0
  232. package/dist/tools/word/format.js +462 -0
  233. package/dist/tools/word/format.js.map +1 -0
  234. package/dist/tools/word/gaps.d.ts +58 -0
  235. package/dist/tools/word/gaps.d.ts.map +1 -0
  236. package/dist/tools/word/gaps.js +431 -0
  237. package/dist/tools/word/gaps.js.map +1 -0
  238. package/dist/tools/word/index.d.ts +34 -0
  239. package/dist/tools/word/index.d.ts.map +1 -0
  240. package/dist/tools/word/index.js +124 -0
  241. package/dist/tools/word/index.js.map +1 -0
  242. package/dist/tools/word/professional.d.ts +48 -0
  243. package/dist/tools/word/professional.d.ts.map +1 -0
  244. package/dist/tools/word/professional.js +657 -0
  245. package/dist/tools/word/professional.js.map +1 -0
  246. package/dist/tools/word/proofread.d.ts +25 -0
  247. package/dist/tools/word/proofread.d.ts.map +1 -0
  248. package/dist/tools/word/proofread.js +718 -0
  249. package/dist/tools/word/proofread.js.map +1 -0
  250. package/dist/types/index.d.ts +9 -0
  251. package/dist/types/index.d.ts.map +1 -0
  252. package/dist/types/index.js +25 -0
  253. package/dist/types/index.js.map +1 -0
  254. package/dist/types/tools.d.ts +163 -0
  255. package/dist/types/tools.d.ts.map +1 -0
  256. package/dist/types/tools.js +45 -0
  257. package/dist/types/tools.js.map +1 -0
  258. package/dist/types/wps.d.ts +190 -0
  259. package/dist/types/wps.d.ts.map +1 -0
  260. package/dist/types/wps.js +23 -0
  261. package/dist/types/wps.js.map +1 -0
  262. package/dist/utils/error.d.ts +147 -0
  263. package/dist/utils/error.d.ts.map +1 -0
  264. package/dist/utils/error.js +417 -0
  265. package/dist/utils/error.js.map +1 -0
  266. package/dist/utils/logger.d.ts +56 -0
  267. package/dist/utils/logger.d.ts.map +1 -0
  268. package/dist/utils/logger.js +138 -0
  269. package/dist/utils/logger.js.map +1 -0
  270. package/dist/version.d.ts +22 -0
  271. package/dist/version.d.ts.map +1 -0
  272. package/dist/version.js +101 -0
  273. package/dist/version.js.map +1 -0
  274. package/package.json +57 -4
  275. package/scripts/wps-com.ps1 +7260 -0
  276. package/scripts/wps-comd.ps1 +123 -0
  277. package/skills/wps-multitool/SKILL.md +111 -0
  278. package/skills/wps-multitool/references/errors.md +62 -0
  279. package/skills/wps-multitool/references/recipes.md +82 -0
  280. package/skills/wps-multitool/references/routing.md +88 -0
@@ -0,0 +1,719 @@
1
+ "use strict";
2
+ /**
3
+ * Input: PPT 动画与切换效果操作参数
4
+ * Output: 动画/切换效果操作结果
5
+ * Pos: PPT 动画与切换工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
6
+ * PPT动画Tools - 动画与幻灯片切换管理模块
7
+ * 处理动画的添加、删除、排序、预设以及幻灯片切换效果
8
+ *
9
+ * 包含:
10
+ * - wps_ppt_add_animation: 添加动画效果
11
+ * - wps_ppt_remove_animation: 移除动画效果
12
+ * - wps_ppt_get_animations: 获取动画列表
13
+ * - wps_ppt_set_animation_order: 设置动画顺序
14
+ * - wps_ppt_add_animation_preset: 添加预设入场动画
15
+ * - wps_ppt_add_emphasis_animation: 添加强调动画
16
+ * - wps_ppt_set_slide_transition: 设置幻灯片切换效果
17
+ * - wps_ppt_remove_slide_transition: 移除幻灯片切换效果
18
+ * - wps_ppt_apply_transition_to_all: 应用切换效果到所有幻灯片
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.animationTools = exports.applyTransitionToAllHandler = exports.applyTransitionToAllDefinition = exports.removeSlideTransitionHandler = exports.removeSlideTransitionDefinition = exports.setSlideTransitionHandler = exports.setSlideTransitionDefinition = exports.addEmphasisAnimationHandler = exports.addEmphasisAnimationDefinition = exports.addAnimationPresetHandler = exports.addAnimationPresetDefinition = exports.setAnimationOrderHandler = exports.setAnimationOrderDefinition = exports.getAnimationsHandler = exports.getAnimationsDefinition = exports.removeAnimationHandler = exports.removeAnimationDefinition = exports.addAnimationHandler = exports.addAnimationDefinition = void 0;
22
+ const uuid_1 = require("uuid");
23
+ const tools_1 = require("../../types/tools");
24
+ const wps_client_1 = require("../../client/wps-client");
25
+ const wps_1 = require("../../types/wps");
26
+ // ==================== 1. 添加动画效果 ====================
27
+ /**
28
+ * 添加动画效果
29
+ * 为指定幻灯片上的形状添加动画
30
+ */
31
+ exports.addAnimationDefinition = {
32
+ name: 'wps_ppt_add_animation',
33
+ description: `为幻灯片中的形状添加动画效果。
34
+
35
+ 使用场景:
36
+ - "给第1页第2个形状加个淡入动画"
37
+ - "为标题添加飞入效果"
38
+ - "添加动画让元素依次出现"`,
39
+ category: tools_1.ToolCategory.PRESENTATION,
40
+ inputSchema: {
41
+ type: 'object',
42
+ properties: {
43
+ slideIndex: {
44
+ type: 'number',
45
+ description: '幻灯片页码(从1开始)',
46
+ },
47
+ shapeIndex: {
48
+ type: 'number',
49
+ description: '形状索引(从1开始)',
50
+ },
51
+ effect: {
52
+ type: 'string',
53
+ description: '动画效果名称,如 "fadeIn"、"flyIn"、"wipe" 等',
54
+ },
55
+ trigger: {
56
+ type: 'string',
57
+ description: '触发方式',
58
+ enum: ['onClick', 'withPrevious', 'afterPrevious'],
59
+ },
60
+ },
61
+ required: ['slideIndex', 'shapeIndex', 'effect'],
62
+ },
63
+ };
64
+ const addAnimationHandler = async (args) => {
65
+ const { slideIndex, shapeIndex, effect, trigger } = args;
66
+ try {
67
+ const response = await wps_client_1.wpsClient.executeMethod('addAnimation', {
68
+ slideIndex,
69
+ shapeIndex,
70
+ effect,
71
+ trigger: trigger || 'onClick',
72
+ }, wps_1.WpsAppType.PRESENTATION);
73
+ if (response.success && response.data) {
74
+ const triggerName = {
75
+ onClick: '单击时',
76
+ withPrevious: '与上一动画同时',
77
+ afterPrevious: '上一动画之后',
78
+ };
79
+ return {
80
+ id: (0, uuid_1.v4)(),
81
+ success: true,
82
+ content: [
83
+ {
84
+ type: 'text',
85
+ text: `动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n效果: ${effect}\n触发: ${triggerName[trigger || 'onClick'] || trigger}\n动画序号: ${response.data.animationIndex}`,
86
+ },
87
+ ],
88
+ };
89
+ }
90
+ else {
91
+ return {
92
+ id: (0, uuid_1.v4)(),
93
+ success: false,
94
+ content: [{ type: 'text', text: `添加动画失败: ${response.error}` }],
95
+ error: response.error,
96
+ };
97
+ }
98
+ }
99
+ catch (error) {
100
+ const errMsg = error instanceof Error ? error.message : String(error);
101
+ return {
102
+ id: (0, uuid_1.v4)(),
103
+ success: false,
104
+ content: [{ type: 'text', text: `添加动画出错: ${errMsg}` }],
105
+ error: errMsg,
106
+ };
107
+ }
108
+ };
109
+ exports.addAnimationHandler = addAnimationHandler;
110
+ // ==================== 2. 移除动画效果 ====================
111
+ /**
112
+ * 移除动画效果
113
+ * 从指定幻灯片中移除指定的动画
114
+ */
115
+ exports.removeAnimationDefinition = {
116
+ name: 'wps_ppt_remove_animation',
117
+ description: `移除幻灯片中指定的动画效果。
118
+
119
+ 使用场景:
120
+ - "删除第1页的第2个动画"
121
+ - "移除这个动画效果"`,
122
+ category: tools_1.ToolCategory.PRESENTATION,
123
+ inputSchema: {
124
+ type: 'object',
125
+ properties: {
126
+ slideIndex: {
127
+ type: 'number',
128
+ description: '幻灯片页码(从1开始)',
129
+ },
130
+ animationIndex: {
131
+ type: 'number',
132
+ description: '动画索引(从1开始)',
133
+ },
134
+ },
135
+ required: ['slideIndex', 'animationIndex'],
136
+ },
137
+ };
138
+ const removeAnimationHandler = async (args) => {
139
+ const { slideIndex, animationIndex } = args;
140
+ try {
141
+ const response = await wps_client_1.wpsClient.executeMethod('removeAnimation', { slideIndex, animationIndex }, wps_1.WpsAppType.PRESENTATION);
142
+ if (response.success) {
143
+ return {
144
+ id: (0, uuid_1.v4)(),
145
+ success: true,
146
+ content: [
147
+ {
148
+ type: 'text',
149
+ text: `动画移除成功!\n幻灯片: 第 ${slideIndex} 页\n已移除第 ${animationIndex} 个动画`,
150
+ },
151
+ ],
152
+ };
153
+ }
154
+ else {
155
+ return {
156
+ id: (0, uuid_1.v4)(),
157
+ success: false,
158
+ content: [{ type: 'text', text: `移除动画失败: ${response.error}` }],
159
+ error: response.error,
160
+ };
161
+ }
162
+ }
163
+ catch (error) {
164
+ const errMsg = error instanceof Error ? error.message : String(error);
165
+ return {
166
+ id: (0, uuid_1.v4)(),
167
+ success: false,
168
+ content: [{ type: 'text', text: `移除动画出错: ${errMsg}` }],
169
+ error: errMsg,
170
+ };
171
+ }
172
+ };
173
+ exports.removeAnimationHandler = removeAnimationHandler;
174
+ // ==================== 3. 获取动画列表 ====================
175
+ /**
176
+ * 获取动画列表
177
+ * 查看指定幻灯片上所有动画效果
178
+ */
179
+ exports.getAnimationsDefinition = {
180
+ name: 'wps_ppt_get_animations',
181
+ description: `获取幻灯片上所有动画效果的列表。
182
+
183
+ 使用场景:
184
+ - "查看第1页有哪些动画"
185
+ - "列出这页的所有动画"`,
186
+ category: tools_1.ToolCategory.PRESENTATION,
187
+ inputSchema: {
188
+ type: 'object',
189
+ properties: {
190
+ slideIndex: {
191
+ type: 'number',
192
+ description: '幻灯片页码(从1开始)',
193
+ },
194
+ },
195
+ required: ['slideIndex'],
196
+ },
197
+ };
198
+ const getAnimationsHandler = async (args) => {
199
+ const { slideIndex } = args;
200
+ try {
201
+ const response = await wps_client_1.wpsClient.executeMethod('getAnimations', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
202
+ if (response.success && response.data) {
203
+ const animations = response.data.animations;
204
+ if (!animations || animations.length === 0) {
205
+ return {
206
+ id: (0, uuid_1.v4)(),
207
+ success: true,
208
+ content: [
209
+ {
210
+ type: 'text',
211
+ text: `第 ${slideIndex} 页没有动画效果。`,
212
+ },
213
+ ],
214
+ };
215
+ }
216
+ const triggerName = {
217
+ onClick: '单击时',
218
+ withPrevious: '与上一动画同时',
219
+ afterPrevious: '上一动画之后',
220
+ };
221
+ let output = `第 ${slideIndex} 页的动画效果(共 ${animations.length} 个):\n`;
222
+ animations.forEach((anim) => {
223
+ output += ` ${anim.index}. [${anim.shapeName}] ${anim.effect} - ${triggerName[anim.trigger] || anim.trigger}\n`;
224
+ });
225
+ return {
226
+ id: (0, uuid_1.v4)(),
227
+ success: true,
228
+ content: [{ type: 'text', text: output }],
229
+ };
230
+ }
231
+ else {
232
+ return {
233
+ id: (0, uuid_1.v4)(),
234
+ success: false,
235
+ content: [{ type: 'text', text: `获取动画列表失败: ${response.error}` }],
236
+ error: response.error,
237
+ };
238
+ }
239
+ }
240
+ catch (error) {
241
+ const errMsg = error instanceof Error ? error.message : String(error);
242
+ return {
243
+ id: (0, uuid_1.v4)(),
244
+ success: false,
245
+ content: [{ type: 'text', text: `获取动画列表出错: ${errMsg}` }],
246
+ error: errMsg,
247
+ };
248
+ }
249
+ };
250
+ exports.getAnimationsHandler = getAnimationsHandler;
251
+ // ==================== 4. 设置动画顺序 ====================
252
+ /**
253
+ * 设置动画顺序
254
+ * 调整动画在时间线上的播放顺序
255
+ */
256
+ exports.setAnimationOrderDefinition = {
257
+ name: 'wps_ppt_set_animation_order',
258
+ description: `调整动画在时间线上的播放顺序。
259
+
260
+ 使用场景:
261
+ - "把第3个动画移到第1个播放"
262
+ - "调整动画顺序"`,
263
+ category: tools_1.ToolCategory.PRESENTATION,
264
+ inputSchema: {
265
+ type: 'object',
266
+ properties: {
267
+ slideIndex: {
268
+ type: 'number',
269
+ description: '幻灯片页码(从1开始)',
270
+ },
271
+ animationIndex: {
272
+ type: 'number',
273
+ description: '当前动画索引(从1开始)',
274
+ },
275
+ newOrder: {
276
+ type: 'number',
277
+ description: '新的播放顺序位置(从1开始)',
278
+ },
279
+ },
280
+ required: ['slideIndex', 'animationIndex', 'newOrder'],
281
+ },
282
+ };
283
+ const setAnimationOrderHandler = async (args) => {
284
+ const { slideIndex, animationIndex, newOrder } = args;
285
+ try {
286
+ const response = await wps_client_1.wpsClient.executeMethod('setAnimationOrder', { slideIndex, animationIndex, newOrder }, wps_1.WpsAppType.PRESENTATION);
287
+ if (response.success) {
288
+ return {
289
+ id: (0, uuid_1.v4)(),
290
+ success: true,
291
+ content: [
292
+ {
293
+ type: 'text',
294
+ text: `动画顺序调整成功!\n幻灯片: 第 ${slideIndex} 页\n动画 ${animationIndex} → 新位置 ${newOrder}`,
295
+ },
296
+ ],
297
+ };
298
+ }
299
+ else {
300
+ return {
301
+ id: (0, uuid_1.v4)(),
302
+ success: false,
303
+ content: [{ type: 'text', text: `调整动画顺序失败: ${response.error}` }],
304
+ error: response.error,
305
+ };
306
+ }
307
+ }
308
+ catch (error) {
309
+ const errMsg = error instanceof Error ? error.message : String(error);
310
+ return {
311
+ id: (0, uuid_1.v4)(),
312
+ success: false,
313
+ content: [{ type: 'text', text: `调整动画顺序出错: ${errMsg}` }],
314
+ error: errMsg,
315
+ };
316
+ }
317
+ };
318
+ exports.setAnimationOrderHandler = setAnimationOrderHandler;
319
+ // ==================== 5. 添加预设入场动画 ====================
320
+ /**
321
+ * 添加预设入场动画
322
+ * 提供常用的入场动画预设,简化动画添加流程
323
+ */
324
+ exports.addAnimationPresetDefinition = {
325
+ name: 'wps_ppt_add_animation_preset',
326
+ description: `为形状添加预设入场动画效果。
327
+
328
+ 支持的预设:
329
+ - fadeIn: 淡入
330
+ - flyIn: 飞入
331
+ - wipe: 擦除
332
+ - zoom: 缩放
333
+ - bounce: 弹跳
334
+ - spin: 旋转
335
+
336
+ 使用场景:
337
+ - "给标题加个淡入效果"
338
+ - "让这个形状飞入"
339
+ - "添加弹跳入场动画"`,
340
+ category: tools_1.ToolCategory.PRESENTATION,
341
+ inputSchema: {
342
+ type: 'object',
343
+ properties: {
344
+ slideIndex: {
345
+ type: 'number',
346
+ description: '幻灯片页码(从1开始)',
347
+ },
348
+ shapeIndex: {
349
+ type: 'number',
350
+ description: '形状索引(从1开始)',
351
+ },
352
+ preset: {
353
+ type: 'string',
354
+ description: '预设动画类型',
355
+ enum: ['fadeIn', 'flyIn', 'wipe', 'zoom', 'bounce', 'spin'],
356
+ },
357
+ },
358
+ required: ['slideIndex', 'shapeIndex', 'preset'],
359
+ },
360
+ };
361
+ const addAnimationPresetHandler = async (args) => {
362
+ const { slideIndex, shapeIndex, preset } = args;
363
+ try {
364
+ const response = await wps_client_1.wpsClient.executeMethod('addAnimationPreset', { slideIndex, shapeIndex, preset }, wps_1.WpsAppType.PRESENTATION);
365
+ if (response.success && response.data) {
366
+ const presetName = {
367
+ fadeIn: '淡入',
368
+ flyIn: '飞入',
369
+ wipe: '擦除',
370
+ zoom: '缩放',
371
+ bounce: '弹跳',
372
+ spin: '旋转',
373
+ };
374
+ return {
375
+ id: (0, uuid_1.v4)(),
376
+ success: true,
377
+ content: [
378
+ {
379
+ type: 'text',
380
+ text: `预设动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n预设: ${presetName[preset] || preset}\n动画序号: ${response.data.animationIndex}`,
381
+ },
382
+ ],
383
+ };
384
+ }
385
+ else {
386
+ return {
387
+ id: (0, uuid_1.v4)(),
388
+ success: false,
389
+ content: [{ type: 'text', text: `添加预设动画失败: ${response.error}` }],
390
+ error: response.error,
391
+ };
392
+ }
393
+ }
394
+ catch (error) {
395
+ const errMsg = error instanceof Error ? error.message : String(error);
396
+ return {
397
+ id: (0, uuid_1.v4)(),
398
+ success: false,
399
+ content: [{ type: 'text', text: `添加预设动画出错: ${errMsg}` }],
400
+ error: errMsg,
401
+ };
402
+ }
403
+ };
404
+ exports.addAnimationPresetHandler = addAnimationPresetHandler;
405
+ // ==================== 6. 添加强调动画 ====================
406
+ /**
407
+ * 添加强调动画
408
+ * 为已有形状添加强调型动画效果,用于突出显示
409
+ */
410
+ exports.addEmphasisAnimationDefinition = {
411
+ name: 'wps_ppt_add_emphasis_animation',
412
+ description: `为形状添加强调动画效果,用于在演示时突出显示元素。
413
+
414
+ 支持的效果:
415
+ - pulse: 脉冲
416
+ - spin: 陀螺旋
417
+ - grow: 放大/缩小
418
+ - teeter: 跷跷板
419
+ - colorPulse: 颜色脉冲
420
+
421
+ 使用场景:
422
+ - "让这个元素闪烁突出"
423
+ - "添加脉冲强调效果"
424
+ - "让图片旋转强调"`,
425
+ category: tools_1.ToolCategory.PRESENTATION,
426
+ inputSchema: {
427
+ type: 'object',
428
+ properties: {
429
+ slideIndex: {
430
+ type: 'number',
431
+ description: '幻灯片页码(从1开始)',
432
+ },
433
+ shapeIndex: {
434
+ type: 'number',
435
+ description: '形状索引(从1开始)',
436
+ },
437
+ effect: {
438
+ type: 'string',
439
+ description: '强调动画效果',
440
+ enum: ['pulse', 'spin', 'grow', 'teeter', 'colorPulse'],
441
+ },
442
+ },
443
+ required: ['slideIndex', 'shapeIndex', 'effect'],
444
+ },
445
+ };
446
+ const addEmphasisAnimationHandler = async (args) => {
447
+ const { slideIndex, shapeIndex, effect } = args;
448
+ try {
449
+ const response = await wps_client_1.wpsClient.executeMethod('addEmphasisAnimation', { slideIndex, shapeIndex, effect }, wps_1.WpsAppType.PRESENTATION);
450
+ if (response.success && response.data) {
451
+ const effectName = {
452
+ pulse: '脉冲',
453
+ spin: '陀螺旋',
454
+ grow: '放大/缩小',
455
+ teeter: '跷跷板',
456
+ colorPulse: '颜色脉冲',
457
+ };
458
+ return {
459
+ id: (0, uuid_1.v4)(),
460
+ success: true,
461
+ content: [
462
+ {
463
+ type: 'text',
464
+ text: `强调动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n效果: ${effectName[effect] || effect}\n动画序号: ${response.data.animationIndex}`,
465
+ },
466
+ ],
467
+ };
468
+ }
469
+ else {
470
+ return {
471
+ id: (0, uuid_1.v4)(),
472
+ success: false,
473
+ content: [{ type: 'text', text: `添加强调动画失败: ${response.error}` }],
474
+ error: response.error,
475
+ };
476
+ }
477
+ }
478
+ catch (error) {
479
+ const errMsg = error instanceof Error ? error.message : String(error);
480
+ return {
481
+ id: (0, uuid_1.v4)(),
482
+ success: false,
483
+ content: [{ type: 'text', text: `添加强调动画出错: ${errMsg}` }],
484
+ error: errMsg,
485
+ };
486
+ }
487
+ };
488
+ exports.addEmphasisAnimationHandler = addEmphasisAnimationHandler;
489
+ // ==================== 7. 设置幻灯片切换效果 ====================
490
+ /**
491
+ * 设置幻灯片切换效果
492
+ * 为幻灯片设置页面切换动画
493
+ */
494
+ exports.setSlideTransitionDefinition = {
495
+ name: 'wps_ppt_set_slide_transition',
496
+ description: `设置幻灯片的页面切换效果。
497
+
498
+ 常用切换效果:
499
+ - fade: 淡出
500
+ - push: 推入
501
+ - wipe: 擦除
502
+ - split: 分割
503
+ - reveal: 显露
504
+ - cover: 覆盖
505
+ - curtains: 帷幕
506
+ - blinds: 百叶窗
507
+
508
+ 使用场景:
509
+ - "给第1页加个淡出切换"
510
+ - "设置页面切换为推入效果"
511
+ - "添加切换动画"`,
512
+ category: tools_1.ToolCategory.PRESENTATION,
513
+ inputSchema: {
514
+ type: 'object',
515
+ properties: {
516
+ slideIndex: {
517
+ type: 'number',
518
+ description: '幻灯片页码(从1开始)',
519
+ },
520
+ effect: {
521
+ type: 'string',
522
+ description: '切换效果名称',
523
+ },
524
+ duration: {
525
+ type: 'number',
526
+ description: '切换持续时间(秒),默认1秒',
527
+ },
528
+ sound: {
529
+ type: 'string',
530
+ description: '切换时播放的声音文件路径(可选)',
531
+ },
532
+ },
533
+ required: ['slideIndex', 'effect'],
534
+ },
535
+ };
536
+ const setSlideTransitionHandler = async (args) => {
537
+ const { slideIndex, effect, duration, sound } = args;
538
+ try {
539
+ const response = await wps_client_1.wpsClient.executeMethod('setSlideTransition', {
540
+ slideIndex,
541
+ effect,
542
+ duration: duration || 1,
543
+ sound,
544
+ }, wps_1.WpsAppType.PRESENTATION);
545
+ if (response.success) {
546
+ let output = `切换效果设置成功!\n幻灯片: 第 ${slideIndex} 页\n效果: ${effect}\n持续时间: ${duration || 1} 秒`;
547
+ if (sound) {
548
+ output += `\n声音: ${sound}`;
549
+ }
550
+ return {
551
+ id: (0, uuid_1.v4)(),
552
+ success: true,
553
+ content: [{ type: 'text', text: output }],
554
+ };
555
+ }
556
+ else {
557
+ return {
558
+ id: (0, uuid_1.v4)(),
559
+ success: false,
560
+ content: [{ type: 'text', text: `设置切换效果失败: ${response.error}` }],
561
+ error: response.error,
562
+ };
563
+ }
564
+ }
565
+ catch (error) {
566
+ const errMsg = error instanceof Error ? error.message : String(error);
567
+ return {
568
+ id: (0, uuid_1.v4)(),
569
+ success: false,
570
+ content: [{ type: 'text', text: `设置切换效果出错: ${errMsg}` }],
571
+ error: errMsg,
572
+ };
573
+ }
574
+ };
575
+ exports.setSlideTransitionHandler = setSlideTransitionHandler;
576
+ // ==================== 8. 移除幻灯片切换效果 ====================
577
+ /**
578
+ * 移除幻灯片切换效果
579
+ * 清除指定幻灯片的切换动画
580
+ */
581
+ exports.removeSlideTransitionDefinition = {
582
+ name: 'wps_ppt_remove_slide_transition',
583
+ description: `移除幻灯片的切换效果。
584
+
585
+ 使用场景:
586
+ - "取消第1页的切换效果"
587
+ - "移除页面切换动画"`,
588
+ category: tools_1.ToolCategory.PRESENTATION,
589
+ inputSchema: {
590
+ type: 'object',
591
+ properties: {
592
+ slideIndex: {
593
+ type: 'number',
594
+ description: '幻灯片页码(从1开始)',
595
+ },
596
+ },
597
+ required: ['slideIndex'],
598
+ },
599
+ };
600
+ const removeSlideTransitionHandler = async (args) => {
601
+ const { slideIndex } = args;
602
+ try {
603
+ const response = await wps_client_1.wpsClient.executeMethod('removeSlideTransition', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
604
+ if (response.success) {
605
+ return {
606
+ id: (0, uuid_1.v4)(),
607
+ success: true,
608
+ content: [
609
+ {
610
+ type: 'text',
611
+ text: `切换效果已移除!\n幻灯片: 第 ${slideIndex} 页`,
612
+ },
613
+ ],
614
+ };
615
+ }
616
+ else {
617
+ return {
618
+ id: (0, uuid_1.v4)(),
619
+ success: false,
620
+ content: [{ type: 'text', text: `移除切换效果失败: ${response.error}` }],
621
+ error: response.error,
622
+ };
623
+ }
624
+ }
625
+ catch (error) {
626
+ const errMsg = error instanceof Error ? error.message : String(error);
627
+ return {
628
+ id: (0, uuid_1.v4)(),
629
+ success: false,
630
+ content: [{ type: 'text', text: `移除切换效果出错: ${errMsg}` }],
631
+ error: errMsg,
632
+ };
633
+ }
634
+ };
635
+ exports.removeSlideTransitionHandler = removeSlideTransitionHandler;
636
+ // ==================== 9. 应用切换效果到所有幻灯片 ====================
637
+ /**
638
+ * 应用切换效果到所有幻灯片
639
+ * 一次性为所有幻灯片设置统一的切换效果
640
+ */
641
+ exports.applyTransitionToAllDefinition = {
642
+ name: 'wps_ppt_apply_transition_to_all',
643
+ description: `为所有幻灯片应用统一的切换效果。
644
+
645
+ 使用场景:
646
+ - "给所有页面加上淡出切换"
647
+ - "统一设置切换效果"
648
+ - "所有幻灯片用推入切换"`,
649
+ category: tools_1.ToolCategory.PRESENTATION,
650
+ inputSchema: {
651
+ type: 'object',
652
+ properties: {
653
+ effect: {
654
+ type: 'string',
655
+ description: '切换效果名称,如 "fade"、"push"、"wipe" 等',
656
+ },
657
+ duration: {
658
+ type: 'number',
659
+ description: '切换持续时间(秒),默认1秒',
660
+ },
661
+ },
662
+ required: ['effect'],
663
+ },
664
+ };
665
+ const applyTransitionToAllHandler = async (args) => {
666
+ const { effect, duration } = args;
667
+ try {
668
+ const response = await wps_client_1.wpsClient.executeMethod('applyTransitionToAll', {
669
+ effect,
670
+ duration: duration || 1,
671
+ }, wps_1.WpsAppType.PRESENTATION);
672
+ if (response.success && response.data) {
673
+ return {
674
+ id: (0, uuid_1.v4)(),
675
+ success: true,
676
+ content: [
677
+ {
678
+ type: 'text',
679
+ text: `切换效果已应用到所有幻灯片!\n效果: ${effect}\n持续时间: ${duration || 1} 秒\n应用页数: ${response.data.slideCount} 页`,
680
+ },
681
+ ],
682
+ };
683
+ }
684
+ else {
685
+ return {
686
+ id: (0, uuid_1.v4)(),
687
+ success: false,
688
+ content: [{ type: 'text', text: `应用切换效果失败: ${response.error}` }],
689
+ error: response.error,
690
+ };
691
+ }
692
+ }
693
+ catch (error) {
694
+ const errMsg = error instanceof Error ? error.message : String(error);
695
+ return {
696
+ id: (0, uuid_1.v4)(),
697
+ success: false,
698
+ content: [{ type: 'text', text: `应用切换效果出错: ${errMsg}` }],
699
+ error: errMsg,
700
+ };
701
+ }
702
+ };
703
+ exports.applyTransitionToAllHandler = applyTransitionToAllHandler;
704
+ /**
705
+ * 导出所有动画与切换相关的Tools
706
+ */
707
+ exports.animationTools = [
708
+ { definition: exports.addAnimationDefinition, handler: exports.addAnimationHandler },
709
+ { definition: exports.removeAnimationDefinition, handler: exports.removeAnimationHandler },
710
+ { definition: exports.getAnimationsDefinition, handler: exports.getAnimationsHandler },
711
+ { definition: exports.setAnimationOrderDefinition, handler: exports.setAnimationOrderHandler },
712
+ { definition: exports.addAnimationPresetDefinition, handler: exports.addAnimationPresetHandler },
713
+ { definition: exports.addEmphasisAnimationDefinition, handler: exports.addEmphasisAnimationHandler },
714
+ { definition: exports.setSlideTransitionDefinition, handler: exports.setSlideTransitionHandler },
715
+ { definition: exports.removeSlideTransitionDefinition, handler: exports.removeSlideTransitionHandler },
716
+ { definition: exports.applyTransitionToAllDefinition, handler: exports.applyTransitionToAllHandler },
717
+ ];
718
+ exports.default = exports.animationTools;
719
+ //# sourceMappingURL=animation.js.map