wps-multitool-mcp 1.0.4 → 1.1.0

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 (394) hide show
  1. package/dist/bridge/cancellable.d.ts +1 -10
  2. package/dist/bridge/cancellable.d.ts.map +1 -1
  3. package/dist/bridge/cancellable.js +1 -10
  4. package/dist/bridge/cancellable.js.map +1 -1
  5. package/dist/bridge/index.d.ts +0 -17
  6. package/dist/bridge/index.d.ts.map +1 -1
  7. package/dist/bridge/index.js +190 -24
  8. package/dist/bridge/index.js.map +1 -1
  9. package/dist/bridge/ps-child.d.ts +2 -15
  10. package/dist/bridge/ps-child.d.ts.map +1 -1
  11. package/dist/bridge/ps-child.js +26 -17
  12. package/dist/bridge/ps-child.js.map +1 -1
  13. package/dist/cli/install.d.ts +0 -8
  14. package/dist/cli/install.d.ts.map +1 -1
  15. package/dist/cli/install.js +1 -9
  16. package/dist/cli/install.js.map +1 -1
  17. package/dist/client/action-routes.d.ts +2 -18
  18. package/dist/client/action-routes.d.ts.map +1 -1
  19. package/dist/client/action-routes.generated.d.ts +2 -2
  20. package/dist/client/action-routes.generated.d.ts.map +1 -1
  21. package/dist/client/action-routes.generated.js +8 -6
  22. package/dist/client/action-routes.generated.js.map +1 -1
  23. package/dist/client/action-routes.js +3 -16
  24. package/dist/client/action-routes.js.map +1 -1
  25. package/dist/client/addon-channel.d.ts +7 -38
  26. package/dist/client/addon-channel.d.ts.map +1 -1
  27. package/dist/client/addon-channel.js +11 -42
  28. package/dist/client/addon-channel.js.map +1 -1
  29. package/dist/client/ps-daemon.d.ts +0 -16
  30. package/dist/client/ps-daemon.d.ts.map +1 -1
  31. package/dist/client/ps-daemon.js +5 -18
  32. package/dist/client/ps-daemon.js.map +1 -1
  33. package/dist/client/wps-client.d.ts +2 -1
  34. package/dist/client/wps-client.d.ts.map +1 -1
  35. package/dist/client/wps-client.js +7 -6
  36. package/dist/client/wps-client.js.map +1 -1
  37. package/dist/runtime-identity.d.ts +0 -9
  38. package/dist/runtime-identity.d.ts.map +1 -1
  39. package/dist/runtime-identity.js +0 -9
  40. package/dist/runtime-identity.js.map +1 -1
  41. package/dist/server/address-dsl.d.ts +44 -0
  42. package/dist/server/address-dsl.d.ts.map +1 -0
  43. package/dist/server/address-dsl.js +144 -0
  44. package/dist/server/address-dsl.js.map +1 -0
  45. package/dist/server/auto-snapshot.d.ts +0 -14
  46. package/dist/server/auto-snapshot.d.ts.map +1 -1
  47. package/dist/server/auto-snapshot.js +5 -15
  48. package/dist/server/auto-snapshot.js.map +1 -1
  49. package/dist/server/backend-selector.d.ts +91 -15
  50. package/dist/server/backend-selector.d.ts.map +1 -1
  51. package/dist/server/backend-selector.js +250 -28
  52. package/dist/server/backend-selector.js.map +1 -1
  53. package/dist/server/builtin-tools.d.ts +9 -0
  54. package/dist/server/builtin-tools.d.ts.map +1 -0
  55. package/dist/server/builtin-tools.js +326 -0
  56. package/dist/server/builtin-tools.js.map +1 -0
  57. package/dist/server/cancel-context.d.ts +0 -10
  58. package/dist/server/cancel-context.d.ts.map +1 -1
  59. package/dist/server/cancel-context.js +0 -10
  60. package/dist/server/cancel-context.js.map +1 -1
  61. package/dist/server/collab-guard.d.ts +13 -0
  62. package/dist/server/collab-guard.d.ts.map +1 -0
  63. package/dist/server/collab-guard.js +99 -0
  64. package/dist/server/collab-guard.js.map +1 -0
  65. package/dist/server/intent-miss-log.d.ts +28 -0
  66. package/dist/server/intent-miss-log.d.ts.map +1 -0
  67. package/dist/server/intent-miss-log.js +143 -0
  68. package/dist/server/intent-miss-log.js.map +1 -0
  69. package/dist/server/mcp-server.d.ts +7 -7
  70. package/dist/server/mcp-server.d.ts.map +1 -1
  71. package/dist/server/mcp-server.js +100 -384
  72. package/dist/server/mcp-server.js.map +1 -1
  73. package/dist/server/progress-context.d.ts.map +1 -1
  74. package/dist/server/progress-context.js +0 -12
  75. package/dist/server/progress-context.js.map +1 -1
  76. package/dist/server/schema-validate.d.ts +28 -0
  77. package/dist/server/schema-validate.d.ts.map +1 -0
  78. package/dist/server/schema-validate.js +114 -0
  79. package/dist/server/schema-validate.js.map +1 -0
  80. package/dist/server/server-info.d.ts +0 -11
  81. package/dist/server/server-info.d.ts.map +1 -1
  82. package/dist/server/server-info.js +5 -15
  83. package/dist/server/server-info.js.map +1 -1
  84. package/dist/server/target-context.d.ts +0 -14
  85. package/dist/server/target-context.d.ts.map +1 -1
  86. package/dist/server/target-context.js +0 -14
  87. package/dist/server/target-context.js.map +1 -1
  88. package/dist/server/task-engine.d.ts +112 -0
  89. package/dist/server/task-engine.d.ts.map +1 -0
  90. package/dist/server/task-engine.js +305 -0
  91. package/dist/server/task-engine.js.map +1 -0
  92. package/dist/server/tool-aliases.generated.d.ts +1 -1
  93. package/dist/server/tool-aliases.generated.d.ts.map +1 -1
  94. package/dist/server/tool-aliases.generated.js +14 -2
  95. package/dist/server/tool-aliases.generated.js.map +1 -1
  96. package/dist/server/tool-annotations.d.ts +4 -10
  97. package/dist/server/tool-annotations.d.ts.map +1 -1
  98. package/dist/server/tool-annotations.generated.d.ts.map +1 -1
  99. package/dist/server/tool-annotations.generated.js +7 -11
  100. package/dist/server/tool-annotations.generated.js.map +1 -1
  101. package/dist/server/tool-annotations.js +56 -17
  102. package/dist/server/tool-annotations.js.map +1 -1
  103. package/dist/server/tool-group-events.d.ts +0 -7
  104. package/dist/server/tool-group-events.d.ts.map +1 -1
  105. package/dist/server/tool-group-events.js +0 -7
  106. package/dist/server/tool-group-events.js.map +1 -1
  107. package/dist/server/tool-metadata.d.ts +0 -26
  108. package/dist/server/tool-metadata.d.ts.map +1 -1
  109. package/dist/server/tool-metadata.js +16 -37
  110. package/dist/server/tool-metadata.js.map +1 -1
  111. package/dist/server/tool-registry.d.ts +0 -10
  112. package/dist/server/tool-registry.d.ts.map +1 -1
  113. package/dist/server/tool-registry.js +35 -26
  114. package/dist/server/tool-registry.js.map +1 -1
  115. package/dist/server/tool-tiers.d.ts +1 -1
  116. package/dist/server/tool-tiers.js +1 -1
  117. package/dist/server/tool-verification.d.ts +5 -11
  118. package/dist/server/tool-verification.d.ts.map +1 -1
  119. package/dist/server/tool-verification.generated.d.ts +4 -4
  120. package/dist/server/tool-verification.generated.d.ts.map +1 -1
  121. package/dist/server/tool-verification.generated.js +10 -14
  122. package/dist/server/tool-verification.generated.js.map +1 -1
  123. package/dist/server/tool-verification.js +2 -8
  124. package/dist/server/tool-verification.js.map +1 -1
  125. package/dist/tools/common/batch.d.ts +0 -9
  126. package/dist/tools/common/batch.d.ts.map +1 -1
  127. package/dist/tools/common/batch.js +3 -12
  128. package/dist/tools/common/batch.js.map +1 -1
  129. package/dist/tools/common/convert.d.ts +0 -13
  130. package/dist/tools/common/convert.d.ts.map +1 -1
  131. package/dist/tools/common/convert.js +25 -78
  132. package/dist/tools/common/convert.js.map +1 -1
  133. package/dist/tools/common/general.d.ts +0 -10
  134. package/dist/tools/common/general.d.ts.map +1 -1
  135. package/dist/tools/common/general.js +44 -201
  136. package/dist/tools/common/general.js.map +1 -1
  137. package/dist/tools/common/helpers.d.ts +30 -0
  138. package/dist/tools/common/helpers.d.ts.map +1 -0
  139. package/dist/tools/common/helpers.js +45 -0
  140. package/dist/tools/common/helpers.js.map +1 -0
  141. package/dist/tools/common/index.d.ts +1 -14
  142. package/dist/tools/common/index.d.ts.map +1 -1
  143. package/dist/tools/common/index.js +13 -2
  144. package/dist/tools/common/index.js.map +1 -1
  145. package/dist/tools/common/intent.d.ts +10 -11
  146. package/dist/tools/common/intent.d.ts.map +1 -1
  147. package/dist/tools/common/intent.js +154 -56
  148. package/dist/tools/common/intent.js.map +1 -1
  149. package/dist/tools/common/repair.d.ts +0 -15
  150. package/dist/tools/common/repair.d.ts.map +1 -1
  151. package/dist/tools/common/repair.js +6 -35
  152. package/dist/tools/common/repair.js.map +1 -1
  153. package/dist/tools/common/snapshot.d.ts +0 -12
  154. package/dist/tools/common/snapshot.d.ts.map +1 -1
  155. package/dist/tools/common/snapshot.js +11 -15
  156. package/dist/tools/common/snapshot.js.map +1 -1
  157. package/dist/tools/common/status.d.ts +0 -11
  158. package/dist/tools/common/status.d.ts.map +1 -1
  159. package/dist/tools/common/status.js +32 -40
  160. package/dist/tools/common/status.js.map +1 -1
  161. package/dist/tools/common/taskrunner.d.ts +14 -0
  162. package/dist/tools/common/taskrunner.d.ts.map +1 -0
  163. package/dist/tools/common/taskrunner.js +89 -0
  164. package/dist/tools/common/taskrunner.js.map +1 -0
  165. package/dist/tools/common/template.d.ts +19 -0
  166. package/dist/tools/common/template.d.ts.map +1 -0
  167. package/dist/tools/common/template.js +127 -0
  168. package/dist/tools/common/template.js.map +1 -0
  169. package/dist/tools/common/toolgroups.d.ts +0 -14
  170. package/dist/tools/common/toolgroups.d.ts.map +1 -1
  171. package/dist/tools/common/toolgroups.js +28 -69
  172. package/dist/tools/common/toolgroups.js.map +1 -1
  173. package/dist/tools/excel/chart.d.ts +0 -17
  174. package/dist/tools/excel/chart.d.ts.map +1 -1
  175. package/dist/tools/excel/chart.js +66 -190
  176. package/dist/tools/excel/chart.js.map +1 -1
  177. package/dist/tools/excel/comment-protect.d.ts +0 -18
  178. package/dist/tools/excel/comment-protect.d.ts.map +1 -1
  179. package/dist/tools/excel/comment-protect.js +39 -59
  180. package/dist/tools/excel/comment-protect.js.map +1 -1
  181. package/dist/tools/excel/data-advanced.d.ts +0 -18
  182. package/dist/tools/excel/data-advanced.d.ts.map +1 -1
  183. package/dist/tools/excel/data-advanced.js +36 -56
  184. package/dist/tools/excel/data-advanced.js.map +1 -1
  185. package/dist/tools/excel/data.d.ts +0 -40
  186. package/dist/tools/excel/data.d.ts.map +1 -1
  187. package/dist/tools/excel/data.js +75 -203
  188. package/dist/tools/excel/data.js.map +1 -1
  189. package/dist/tools/excel/format.d.ts +0 -10
  190. package/dist/tools/excel/format.d.ts.map +1 -1
  191. package/dist/tools/excel/format.js +56 -278
  192. package/dist/tools/excel/format.js.map +1 -1
  193. package/dist/tools/excel/formula.d.ts +3 -36
  194. package/dist/tools/excel/formula.d.ts.map +1 -1
  195. package/dist/tools/excel/formula.js +31 -147
  196. package/dist/tools/excel/formula.js.map +1 -1
  197. package/dist/tools/excel/helpers.d.ts +30 -0
  198. package/dist/tools/excel/helpers.d.ts.map +1 -0
  199. package/dist/tools/excel/helpers.js +46 -0
  200. package/dist/tools/excel/helpers.js.map +1 -0
  201. package/dist/tools/excel/index.d.ts +4 -4
  202. package/dist/tools/excel/index.d.ts.map +1 -1
  203. package/dist/tools/excel/index.js +28 -21
  204. package/dist/tools/excel/index.js.map +1 -1
  205. package/dist/tools/excel/pivot.d.ts +0 -26
  206. package/dist/tools/excel/pivot.d.ts.map +1 -1
  207. package/dist/tools/excel/pivot.js +24 -147
  208. package/dist/tools/excel/pivot.js.map +1 -1
  209. package/dist/tools/excel/row-column.d.ts +0 -30
  210. package/dist/tools/excel/row-column.d.ts.map +1 -1
  211. package/dist/tools/excel/row-column.js +41 -73
  212. package/dist/tools/excel/row-column.js.map +1 -1
  213. package/dist/tools/excel/sheet-advanced.d.ts +35 -0
  214. package/dist/tools/excel/sheet-advanced.d.ts.map +1 -0
  215. package/dist/tools/excel/sheet-advanced.js +359 -0
  216. package/dist/tools/excel/sheet-advanced.js.map +1 -0
  217. package/dist/tools/excel/sheet-gaps.d.ts +1 -15
  218. package/dist/tools/excel/sheet-gaps.d.ts.map +1 -1
  219. package/dist/tools/excel/sheet-gaps.js +34 -67
  220. package/dist/tools/excel/sheet-gaps.js.map +1 -1
  221. package/dist/tools/excel/sheet.d.ts +4 -82
  222. package/dist/tools/excel/sheet.d.ts.map +1 -1
  223. package/dist/tools/excel/sheet.js +41 -740
  224. package/dist/tools/excel/sheet.js.map +1 -1
  225. package/dist/tools/excel/workbook.d.ts +0 -27
  226. package/dist/tools/excel/workbook.d.ts.map +1 -1
  227. package/dist/tools/excel/workbook.js +54 -87
  228. package/dist/tools/excel/workbook.js.map +1 -1
  229. package/dist/tools/index.d.ts +0 -17
  230. package/dist/tools/index.d.ts.map +1 -1
  231. package/dist/tools/index.js +0 -17
  232. package/dist/tools/index.js.map +1 -1
  233. package/dist/tools/ppt/animation.d.ts +0 -14
  234. package/dist/tools/ppt/animation.d.ts.map +1 -1
  235. package/dist/tools/ppt/animation.js +22 -98
  236. package/dist/tools/ppt/animation.js.map +1 -1
  237. package/dist/tools/ppt/batch-shapes.d.ts +8 -0
  238. package/dist/tools/ppt/batch-shapes.d.ts.map +1 -0
  239. package/dist/tools/ppt/batch-shapes.js +147 -0
  240. package/dist/tools/ppt/batch-shapes.js.map +1 -0
  241. package/dist/tools/ppt/beautify-advanced.d.ts +3 -47
  242. package/dist/tools/ppt/beautify-advanced.d.ts.map +1 -1
  243. package/dist/tools/ppt/beautify-advanced.js +65 -386
  244. package/dist/tools/ppt/beautify-advanced.js.map +1 -1
  245. package/dist/tools/ppt/chart-flow.d.ts +0 -37
  246. package/dist/tools/ppt/chart-flow.d.ts.map +1 -1
  247. package/dist/tools/ppt/chart-flow.js +41 -243
  248. package/dist/tools/ppt/chart-flow.js.map +1 -1
  249. package/dist/tools/ppt/data-viz.d.ts +0 -41
  250. package/dist/tools/ppt/data-viz.d.ts.map +1 -1
  251. package/dist/tools/ppt/data-viz.js +29 -268
  252. package/dist/tools/ppt/data-viz.js.map +1 -1
  253. package/dist/tools/ppt/deckkit.d.ts +71 -26
  254. package/dist/tools/ppt/deckkit.d.ts.map +1 -1
  255. package/dist/tools/ppt/deckkit.js +275 -44
  256. package/dist/tools/ppt/deckkit.js.map +1 -1
  257. package/dist/tools/ppt/helpers.d.ts +36 -0
  258. package/dist/tools/ppt/helpers.d.ts.map +1 -0
  259. package/dist/tools/ppt/helpers.js +57 -0
  260. package/dist/tools/ppt/helpers.js.map +1 -0
  261. package/dist/tools/ppt/image.d.ts +3 -11
  262. package/dist/tools/ppt/image.d.ts.map +1 -1
  263. package/dist/tools/ppt/image.js +100 -210
  264. package/dist/tools/ppt/image.js.map +1 -1
  265. package/dist/tools/ppt/index.d.ts +30 -42
  266. package/dist/tools/ppt/index.d.ts.map +1 -1
  267. package/dist/tools/ppt/index.js +102 -115
  268. package/dist/tools/ppt/index.js.map +1 -1
  269. package/dist/tools/ppt/misc.d.ts +2 -59
  270. package/dist/tools/ppt/misc.d.ts.map +1 -1
  271. package/dist/tools/ppt/misc.js +121 -548
  272. package/dist/tools/ppt/misc.js.map +1 -1
  273. package/dist/tools/ppt/page-effects.d.ts +17 -0
  274. package/dist/tools/ppt/page-effects.d.ts.map +1 -0
  275. package/dist/tools/ppt/page-effects.js +494 -0
  276. package/dist/tools/ppt/page-effects.js.map +1 -0
  277. package/dist/tools/ppt/page-info.d.ts +24 -0
  278. package/dist/tools/ppt/page-info.d.ts.map +1 -0
  279. package/dist/tools/ppt/page-info.js +230 -0
  280. package/dist/tools/ppt/page-info.js.map +1 -0
  281. package/dist/tools/ppt/presentation.d.ts +2 -38
  282. package/dist/tools/ppt/presentation.d.ts.map +1 -1
  283. package/dist/tools/ppt/presentation.js +71 -405
  284. package/dist/tools/ppt/presentation.js.map +1 -1
  285. package/dist/tools/ppt/shape-basic.d.ts +10 -23
  286. package/dist/tools/ppt/shape-basic.d.ts.map +1 -1
  287. package/dist/tools/ppt/shape-basic.js +306 -493
  288. package/dist/tools/ppt/shape-basic.js.map +1 -1
  289. package/dist/tools/ppt/shape-style.d.ts +19 -0
  290. package/dist/tools/ppt/shape-style.d.ts.map +1 -0
  291. package/dist/tools/ppt/shape-style.js +276 -0
  292. package/dist/tools/ppt/shape-style.js.map +1 -0
  293. package/dist/tools/ppt/slide-ops.d.ts +3 -50
  294. package/dist/tools/ppt/slide-ops.d.ts.map +1 -1
  295. package/dist/tools/ppt/slide-ops.js +90 -1493
  296. package/dist/tools/ppt/slide-ops.js.map +1 -1
  297. package/dist/tools/ppt/slide.d.ts +1 -34
  298. package/dist/tools/ppt/slide.d.ts.map +1 -1
  299. package/dist/tools/ppt/slide.js +157 -316
  300. package/dist/tools/ppt/slide.js.map +1 -1
  301. package/dist/tools/ppt/table.d.ts +0 -37
  302. package/dist/tools/ppt/table.d.ts.map +1 -1
  303. package/dist/tools/ppt/table.js +30 -237
  304. package/dist/tools/ppt/table.js.map +1 -1
  305. package/dist/tools/ppt/textbox.d.ts +0 -24
  306. package/dist/tools/ppt/textbox.d.ts.map +1 -1
  307. package/dist/tools/ppt/textbox.js +92 -109
  308. package/dist/tools/ppt/textbox.js.map +1 -1
  309. package/dist/tools/word/academic.d.ts +1 -12
  310. package/dist/tools/word/academic.d.ts.map +1 -1
  311. package/dist/tools/word/academic.js +76 -123
  312. package/dist/tools/word/academic.js.map +1 -1
  313. package/dist/tools/word/content.d.ts +2 -56
  314. package/dist/tools/word/content.d.ts.map +1 -1
  315. package/dist/tools/word/content.js +132 -499
  316. package/dist/tools/word/content.js.map +1 -1
  317. package/dist/tools/word/document.d.ts +1 -36
  318. package/dist/tools/word/document.d.ts.map +1 -1
  319. package/dist/tools/word/document.js +71 -361
  320. package/dist/tools/word/document.js.map +1 -1
  321. package/dist/tools/word/format.d.ts +0 -27
  322. package/dist/tools/word/format.d.ts.map +1 -1
  323. package/dist/tools/word/format.js +59 -238
  324. package/dist/tools/word/format.js.map +1 -1
  325. package/dist/tools/word/gaps.d.ts +1 -25
  326. package/dist/tools/word/gaps.d.ts.map +1 -1
  327. package/dist/tools/word/gaps.js +2 -26
  328. package/dist/tools/word/gaps.js.map +1 -1
  329. package/dist/tools/word/helpers.d.ts +31 -0
  330. package/dist/tools/word/helpers.d.ts.map +1 -0
  331. package/dist/tools/word/helpers.js +47 -0
  332. package/dist/tools/word/helpers.js.map +1 -0
  333. package/dist/tools/word/index.d.ts +2 -4
  334. package/dist/tools/word/index.d.ts.map +1 -1
  335. package/dist/tools/word/index.js +5 -9
  336. package/dist/tools/word/index.js.map +1 -1
  337. package/dist/tools/word/professional.d.ts +0 -6
  338. package/dist/tools/word/professional.d.ts.map +1 -1
  339. package/dist/tools/word/professional.js +77 -14
  340. package/dist/tools/word/professional.js.map +1 -1
  341. package/dist/tools/word/proofread.d.ts +0 -5
  342. package/dist/tools/word/proofread.d.ts.map +1 -1
  343. package/dist/tools/word/proofread.js +44 -189
  344. package/dist/tools/word/proofread.js.map +1 -1
  345. package/dist/tools/word/target.d.ts +0 -12
  346. package/dist/tools/word/target.d.ts.map +1 -1
  347. package/dist/tools/word/target.js +1 -13
  348. package/dist/tools/word/target.js.map +1 -1
  349. package/dist/tools/word/wordkit.d.ts +51 -0
  350. package/dist/tools/word/wordkit.d.ts.map +1 -0
  351. package/dist/tools/word/wordkit.js +276 -0
  352. package/dist/tools/word/wordkit.js.map +1 -0
  353. package/dist/types/index.d.ts +0 -1
  354. package/dist/types/index.d.ts.map +1 -1
  355. package/dist/types/index.js +0 -1
  356. package/dist/types/index.js.map +1 -1
  357. package/dist/types/tools.d.ts +10 -25
  358. package/dist/types/tools.d.ts.map +1 -1
  359. package/dist/types/tools.js +0 -1
  360. package/dist/types/tools.js.map +1 -1
  361. package/dist/types/wps.d.ts +3 -40
  362. package/dist/types/wps.d.ts.map +1 -1
  363. package/dist/types/wps.js +3 -4
  364. package/dist/types/wps.js.map +1 -1
  365. package/dist/utils/error.d.ts +0 -1
  366. package/dist/utils/error.d.ts.map +1 -1
  367. package/dist/utils/error.js +0 -1
  368. package/dist/utils/error.js.map +1 -1
  369. package/dist/utils/image-inline.d.ts.map +1 -1
  370. package/dist/utils/image-inline.js +1 -3
  371. package/dist/utils/image-inline.js.map +1 -1
  372. package/dist/utils/logger.d.ts +0 -14
  373. package/dist/utils/logger.d.ts.map +1 -1
  374. package/dist/utils/logger.js +26 -27
  375. package/dist/utils/logger.js.map +1 -1
  376. package/dist/version.d.ts +0 -9
  377. package/dist/version.d.ts.map +1 -1
  378. package/dist/version.js +1 -10
  379. package/dist/version.js.map +1 -1
  380. package/package.json +11 -7
  381. package/scripts/wps-com.ps1 +10849 -9260
  382. package/scripts/wps-comd.ps1 +23 -2
  383. package/skills/wps-multitool/SKILL.md +49 -6
  384. package/skills/wps-multitool/references/recipes.md +20 -4
  385. package/skills/wps-multitool/references/routing.md +20 -1
  386. package/src/server/intent-routes.json +48 -0
  387. package/src/server/task-packages.json +804 -0
  388. package/templates/briefing.pptx +0 -0
  389. package/templates/ledger.xlsx +0 -0
  390. package/templates/weekly-report.docx +0 -0
  391. package/dist/tools/ppt/background.d.ts +0 -54
  392. package/dist/tools/ppt/background.d.ts.map +0 -1
  393. package/dist/tools/ppt/background.js +0 -389
  394. package/dist/tools/ppt/background.js.map +0 -1
@@ -1,41 +1,14 @@
1
1
  "use strict";
2
2
  /**
3
- * Input: 幻灯片操作工具参数
4
- * Output: 幻灯片操作结果
5
- * Pos: PPT 幻灯片操作工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
6
- *
7
- * 幻灯片操作Tools - 删除/复制/移动/查询/切换/布局/备注
8
- *
9
- * 包含:
3
+ * Input: 幻灯片页操作参数
4
+ * Output: 幻灯片页操作结果
5
+ * Pos: PPT 幻灯片页操作工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
10
6
  * - wps_ppt_delete_slide: 删除指定幻灯片
11
- * - wps_ppt_duplicate_slide: 复制幻灯片
12
- * - wps_ppt_move_slide: 移动幻灯片到指定位置
13
- * - wps_ppt_get_slide_count: 获取幻灯片总数
14
- * - wps_ppt_get_slide_info: 获取指定幻灯片的详细信息
15
- * - wps_ppt_switch_slide: 切换到指定幻灯片
16
- * - wps_ppt_set_slide_layout: 设置幻灯片版式布局
17
- * - wps_ppt_get_slide_notes: 获取幻灯片备注内容
18
- * - wps_ppt_set_slide_notes: 设置幻灯片备注
19
- * - wps_ppt_add_shape: 添加形状
20
- * - wps_ppt_set_shape_style: 设置形状样式
21
- * - wps_ppt_add_textbox: 添加文本框
22
- * - wps_ppt_set_slide_title: 设置幻灯片标题
23
- * - wps_ppt_insert_image: 插入图片
24
- * - wps_ppt_set_shape_text: 设置形状文字
25
- * - wps_ppt_set_animation: 设置元素动画
26
- * - wps_ppt_set_background: 设置幻灯片背景
27
- * - wps_ppt_set_slide_size: 设置幻灯片尺寸
28
- * - wps_ppt_set_transition: 设置幻灯片切换效果
29
- * - wps_ppt_add_chart: 在幻灯片中插入图表
30
- * - wps_ppt_set_shape_fill: 设置形状填充颜色
31
- * - wps_ppt_add_speaker_notes: 添加演讲者备注
32
7
  */
33
8
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.slideOpsTools = exports.addSpeakerNotesHandler = exports.addSpeakerNotesDefinition = exports.setShapeFillHandler = exports.setShapeFillDefinition = exports.setTransitionHandler = exports.setTransitionDefinition = exports.setSlideSizeHandler = exports.setSlideSizeDefinition = exports.setBackgroundHandler = exports.setBackgroundDefinition = exports.setAnimationHandler = exports.setAnimationDefinition = exports.setShapeTextHandler = exports.setShapeTextDefinition = exports.insertImageHandler = exports.insertImageDefinition = exports.setSlideTitleHandler = exports.setSlideTitleDefinition = exports.addTextboxHandler = exports.addTextboxDefinition = exports.setShapeStyleHandler = exports.setShapeStyleDefinition = exports.addShapeHandler = exports.addShapeDefinition = exports.getSlideNotesHandler = exports.getSlideNotesDefinition = exports.setSlideLayoutHandler = exports.setSlideLayoutDefinition = exports.switchSlideHandler = exports.switchSlideDefinition = exports.getSlideInfoHandler = exports.getSlideInfoDefinition = exports.getSlideCountHandler = exports.getSlideCountDefinition = exports.moveSlideHandler = exports.moveSlideDefinition = exports.deleteSlideHandler = exports.deleteSlideDefinition = void 0;
35
- const uuid_1 = require("uuid");
9
+ exports.slideOpsTools = exports.setSlideSizeHandler = exports.setSlideSizeDefinition = exports.getSlideNotesHandler = exports.getSlideNotesDefinition = exports.setSlideLayoutHandler = exports.setSlideLayoutDefinition = exports.switchSlideHandler = exports.switchSlideDefinition = exports.getSlideInfoHandler = exports.getSlideInfoDefinition = exports.getSlideCountHandler = exports.getSlideCountDefinition = exports.moveSlideHandler = exports.moveSlideDefinition = exports.deleteSlideHandler = exports.deleteSlideDefinition = void 0;
36
10
  const tools_1 = require("../../types/tools");
37
- const wps_client_1 = require("../../client/wps-client");
38
- const wps_1 = require("../../types/wps");
11
+ const helpers_1 = require("./helpers");
39
12
  // ============================================================
40
13
  // 1. wps_ppt_delete_slide - 删除指定幻灯片
41
14
  // ============================================================
@@ -61,42 +34,14 @@ exports.deleteSlideDefinition = {
61
34
  };
62
35
  const deleteSlideHandler = async (args) => {
63
36
  const { slideIndex } = args;
64
- try {
65
- const response = await wps_client_1.wpsClient.executeMethod('deleteSlide', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
66
- if (response.success) {
67
- return {
68
- id: (0, uuid_1.v4)(),
69
- success: true,
70
- content: [
71
- {
72
- type: 'text',
73
- text: `幻灯片删除成功!\n已删除: 第 ${slideIndex} 页`,
74
- },
75
- ],
76
- };
77
- }
78
- else {
79
- return {
80
- id: (0, uuid_1.v4)(),
81
- success: false,
82
- content: [{ type: 'text', text: `删除幻灯片失败: ${response.error}` }],
83
- error: response.error,
84
- };
85
- }
86
- }
87
- catch (error) {
88
- const errMsg = error instanceof Error ? error.message : String(error);
89
- return {
90
- id: (0, uuid_1.v4)(),
91
- success: false,
92
- content: [{ type: 'text', text: `删除幻灯片出错: ${errMsg}` }],
93
- error: errMsg,
94
- };
95
- }
37
+ const r = await (0, helpers_1.call)('deleteSlide', { slideIndex });
38
+ if (!r.ok)
39
+ return (0, helpers_1.fail)((0, helpers_1.errText)('删除幻灯片失败', r), r.error);
40
+ return (0, helpers_1.ok)(`幻灯片删除成功!\n已删除: 第 ${slideIndex} 页`, r.warnings);
96
41
  };
97
42
  exports.deleteSlideHandler = deleteSlideHandler;
98
43
  // ============================================================
99
- // 3. wps_ppt_move_slide - 移动幻灯片到指定位置
44
+ // 2. wps_ppt_move_slide - 移动幻灯片到指定位置
100
45
  // ============================================================
101
46
  exports.moveSlideDefinition = {
102
47
  name: 'wps_ppt_move_slide',
@@ -124,42 +69,14 @@ exports.moveSlideDefinition = {
124
69
  };
125
70
  const moveSlideHandler = async (args) => {
126
71
  const { fromIndex, toIndex } = args;
127
- try {
128
- const response = await wps_client_1.wpsClient.executeMethod('moveSlide', { fromIndex, toIndex }, wps_1.WpsAppType.PRESENTATION);
129
- if (response.success) {
130
- return {
131
- id: (0, uuid_1.v4)(),
132
- success: true,
133
- content: [
134
- {
135
- type: 'text',
136
- text: `幻灯片移动成功!\n从第 ${fromIndex} 页 → 移到第 ${toIndex} 页`,
137
- },
138
- ],
139
- };
140
- }
141
- else {
142
- return {
143
- id: (0, uuid_1.v4)(),
144
- success: false,
145
- content: [{ type: 'text', text: `移动幻灯片失败: ${response.error}` }],
146
- error: response.error,
147
- };
148
- }
149
- }
150
- catch (error) {
151
- const errMsg = error instanceof Error ? error.message : String(error);
152
- return {
153
- id: (0, uuid_1.v4)(),
154
- success: false,
155
- content: [{ type: 'text', text: `移动幻灯片出错: ${errMsg}` }],
156
- error: errMsg,
157
- };
158
- }
72
+ const r = await (0, helpers_1.call)('moveSlide', { fromIndex, toIndex });
73
+ if (!r.ok)
74
+ return (0, helpers_1.fail)((0, helpers_1.errText)('移动幻灯片失败', r), r.error);
75
+ return (0, helpers_1.ok)(`幻灯片移动成功!\n从第 ${fromIndex} 页 → 移到第 ${toIndex} 页`, r.warnings);
159
76
  };
160
77
  exports.moveSlideHandler = moveSlideHandler;
161
78
  // ============================================================
162
- // 4. wps_ppt_get_slide_count - 获取幻灯片总数
79
+ // 3. wps_ppt_get_slide_count - 获取幻灯片总数
163
80
  // ============================================================
164
81
  exports.getSlideCountDefinition = {
165
82
  name: 'wps_ppt_get_slide_count',
@@ -177,42 +94,14 @@ exports.getSlideCountDefinition = {
177
94
  },
178
95
  };
179
96
  const getSlideCountHandler = async (_args) => {
180
- try {
181
- const response = await wps_client_1.wpsClient.executeMethod('getSlideCount', {}, wps_1.WpsAppType.PRESENTATION);
182
- if (response.success && response.data) {
183
- return {
184
- id: (0, uuid_1.v4)(),
185
- success: true,
186
- content: [
187
- {
188
- type: 'text',
189
- text: `当前演示文稿共有 ${response.data.count} 页幻灯片`,
190
- },
191
- ],
192
- };
193
- }
194
- else {
195
- return {
196
- id: (0, uuid_1.v4)(),
197
- success: false,
198
- content: [{ type: 'text', text: `获取幻灯片总数失败: ${response.error}` }],
199
- error: response.error,
200
- };
201
- }
202
- }
203
- catch (error) {
204
- const errMsg = error instanceof Error ? error.message : String(error);
205
- return {
206
- id: (0, uuid_1.v4)(),
207
- success: false,
208
- content: [{ type: 'text', text: `获取幻灯片总数出错: ${errMsg}` }],
209
- error: errMsg,
210
- };
211
- }
97
+ const r = await (0, helpers_1.call)('getSlideCount', {});
98
+ if (!r.ok || !r.data)
99
+ return (0, helpers_1.fail)((0, helpers_1.errText)('获取幻灯片总数失败', r), r.error);
100
+ return (0, helpers_1.ok)(`当前演示文稿共有 ${r.data.count} 页幻灯片`, r.warnings);
212
101
  };
213
102
  exports.getSlideCountHandler = getSlideCountHandler;
214
103
  // ============================================================
215
- // 5. wps_ppt_get_slide_info - 获取指定幻灯片的详细信息
104
+ // 4. wps_ppt_get_slide_info - 获取指定幻灯片的详细信息
216
105
  // ============================================================
217
106
  exports.getSlideInfoDefinition = {
218
107
  name: 'wps_ppt_get_slide_info',
@@ -236,51 +125,34 @@ exports.getSlideInfoDefinition = {
236
125
  };
237
126
  const getSlideInfoHandler = async (args) => {
238
127
  const { slideIndex } = args;
239
- try {
240
- const response = await wps_client_1.wpsClient.executeMethod('getSlideInfo', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
241
- if (response.success && response.data) {
242
- const info = response.data;
243
- let output = `第 ${info.slideIndex} 页幻灯片信息:\n`;
244
- output += `布局: ${info.layout}\n`;
245
- output += `元素数量: ${info.shapesCount}\n`;
246
- if (info.shapes && info.shapes.length > 0) {
247
- output += `\n元素列表:\n`;
248
- info.shapes.forEach((shape, i) => {
249
- output += ` ${i + 1}. [${shape.type}] ${shape.name}`;
250
- if (shape.text) {
251
- output += ` - "${shape.text.substring(0, 50)}${shape.text.length > 50 ? '...' : ''}"`;
252
- }
253
- output += '\n';
254
- });
128
+ const r = await (0, helpers_1.call)('getSlideInfo', { slideIndex });
129
+ if (!r.ok || !r.data)
130
+ return (0, helpers_1.fail)((0, helpers_1.errText)('获取幻灯片信息失败', r), r.error);
131
+ const info = r.data;
132
+ let output = `第 ${info.slideIndex} 页幻灯片信息:\n`;
133
+ output += `布局: ${info.layout}\n`;
134
+ output += `元素数量: ${info.shapesCount}\n`;
135
+ if (info.shapes && info.shapes.length > 0) {
136
+ output += `\n元素列表:\n`;
137
+ info.shapes.forEach((shape, i) => {
138
+ output += ` ${i + 1}. [${shape.type}] ${shape.name}`;
139
+ if (shape.placeholderType) {
140
+ output += ` 占位符类型:${shape.placeholderType}`;
255
141
  }
256
- return {
257
- id: (0, uuid_1.v4)(),
258
- success: true,
259
- content: [{ type: 'text', text: output }],
260
- };
261
- }
262
- else {
263
- return {
264
- id: (0, uuid_1.v4)(),
265
- success: false,
266
- content: [{ type: 'text', text: `获取幻灯片信息失败: ${response.error}` }],
267
- error: response.error,
268
- };
269
- }
270
- }
271
- catch (error) {
272
- const errMsg = error instanceof Error ? error.message : String(error);
273
- return {
274
- id: (0, uuid_1.v4)(),
275
- success: false,
276
- content: [{ type: 'text', text: `获取幻灯片信息出错: ${errMsg}` }],
277
- error: errMsg,
278
- };
142
+ if (shape.hasText !== undefined) {
143
+ output += shape.hasText ? ' 有文本框' : ' 无文本框';
144
+ }
145
+ if (shape.text) {
146
+ output += ` - "${shape.text.substring(0, 50)}${shape.text.length > 50 ? '...' : ''}"`;
147
+ }
148
+ output += '\n';
149
+ });
279
150
  }
151
+ return (0, helpers_1.ok)(output, r.warnings);
280
152
  };
281
153
  exports.getSlideInfoHandler = getSlideInfoHandler;
282
154
  // ============================================================
283
- // 6. wps_ppt_switch_slide - 切换到指定幻灯片
155
+ // 5. wps_ppt_switch_slide - 切换到指定幻灯片
284
156
  // ============================================================
285
157
  exports.switchSlideDefinition = {
286
158
  name: 'wps_ppt_switch_slide',
@@ -304,42 +176,14 @@ exports.switchSlideDefinition = {
304
176
  };
305
177
  const switchSlideHandler = async (args) => {
306
178
  const { slideIndex } = args;
307
- try {
308
- const response = await wps_client_1.wpsClient.executeMethod('switchSlide', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
309
- if (response.success) {
310
- return {
311
- id: (0, uuid_1.v4)(),
312
- success: true,
313
- content: [
314
- {
315
- type: 'text',
316
- text: `已切换到第 ${slideIndex} 页幻灯片`,
317
- },
318
- ],
319
- };
320
- }
321
- else {
322
- return {
323
- id: (0, uuid_1.v4)(),
324
- success: false,
325
- content: [{ type: 'text', text: `切换幻灯片失败: ${response.error}` }],
326
- error: response.error,
327
- };
328
- }
329
- }
330
- catch (error) {
331
- const errMsg = error instanceof Error ? error.message : String(error);
332
- return {
333
- id: (0, uuid_1.v4)(),
334
- success: false,
335
- content: [{ type: 'text', text: `切换幻灯片出错: ${errMsg}` }],
336
- error: errMsg,
337
- };
338
- }
179
+ const r = await (0, helpers_1.call)('switchSlide', { slideIndex });
180
+ if (!r.ok)
181
+ return (0, helpers_1.fail)((0, helpers_1.errText)('切换幻灯片失败', r), r.error);
182
+ return (0, helpers_1.ok)(`已切换到第 ${slideIndex} 页幻灯片`, r.warnings);
339
183
  };
340
184
  exports.switchSlideHandler = switchSlideHandler;
341
185
  // ============================================================
342
- // 7. wps_ppt_set_slide_layout - 设置幻灯片版式布局
186
+ // 6. wps_ppt_set_slide_layout - 设置幻灯片版式布局
343
187
  // ============================================================
344
188
  exports.setSlideLayoutDefinition = {
345
189
  name: 'wps_ppt_set_slide_layout',
@@ -376,51 +220,23 @@ exports.setSlideLayoutDefinition = {
376
220
  };
377
221
  const setSlideLayoutHandler = async (args) => {
378
222
  const { slideIndex, layout } = args;
379
- try {
380
- const response = await wps_client_1.wpsClient.executeMethod('setSlideLayout', { slideIndex, layout }, wps_1.WpsAppType.PRESENTATION);
381
- if (response.success) {
382
- const layoutName = {
383
- title: '标题页',
384
- title_content: '标题+内容',
385
- blank: '空白页',
386
- two_column: '两栏内容',
387
- comparison: '对比布局',
388
- section_header: '节标题',
389
- title_only: '仅标题',
390
- };
391
- return {
392
- id: (0, uuid_1.v4)(),
393
- success: true,
394
- content: [
395
- {
396
- type: 'text',
397
- text: `幻灯片布局设置成功!\n幻灯片: 第 ${slideIndex} 页\n布局: ${layoutName[layout] || layout}`,
398
- },
399
- ],
400
- };
401
- }
402
- else {
403
- return {
404
- id: (0, uuid_1.v4)(),
405
- success: false,
406
- content: [{ type: 'text', text: `设置幻灯片布局失败: ${response.error}` }],
407
- error: response.error,
408
- };
409
- }
410
- }
411
- catch (error) {
412
- const errMsg = error instanceof Error ? error.message : String(error);
413
- return {
414
- id: (0, uuid_1.v4)(),
415
- success: false,
416
- content: [{ type: 'text', text: `设置幻灯片布局出错: ${errMsg}` }],
417
- error: errMsg,
418
- };
419
- }
223
+ const r = await (0, helpers_1.call)('setSlideLayout', { slideIndex, layout });
224
+ if (!r.ok)
225
+ return (0, helpers_1.fail)((0, helpers_1.errText)('设置幻灯片布局失败', r), r.error);
226
+ const layoutName = {
227
+ title: '标题页',
228
+ title_content: '标题+内容',
229
+ blank: '空白页',
230
+ two_column: '两栏内容',
231
+ comparison: '对比布局',
232
+ section_header: '节标题',
233
+ title_only: '仅标题',
234
+ };
235
+ return (0, helpers_1.ok)(`幻灯片布局设置成功!\n幻灯片: 第 ${slideIndex} 页\n布局: ${layoutName[layout] || layout}`, r.warnings);
420
236
  };
421
237
  exports.setSlideLayoutHandler = setSlideLayoutHandler;
422
238
  // ============================================================
423
- // 8. wps_ppt_get_slide_notes - 获取幻灯片备注内容
239
+ // 7. wps_ppt_get_slide_notes - 获取幻灯片备注内容
424
240
  // ============================================================
425
241
  exports.getSlideNotesDefinition = {
426
242
  name: 'wps_ppt_get_slide_notes',
@@ -444,987 +260,32 @@ exports.getSlideNotesDefinition = {
444
260
  };
445
261
  const getSlideNotesHandler = async (args) => {
446
262
  const { slideIndex } = args;
447
- try {
448
- const response = await wps_client_1.wpsClient.executeMethod('getSlideNotes', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
449
- if (response.success && response.data) {
450
- const notes = response.data.notes;
451
- return {
452
- id: (0, uuid_1.v4)(),
453
- success: true,
454
- content: [
455
- {
456
- type: 'text',
457
- text: notes
458
- ? `第 ${slideIndex} 页备注内容:\n${notes}`
459
- : `第 ${slideIndex} 页没有备注内容`,
460
- },
461
- ],
462
- };
463
- }
464
- else {
465
- return {
466
- id: (0, uuid_1.v4)(),
467
- success: false,
468
- content: [{ type: 'text', text: `获取幻灯片备注失败: ${response.error}` }],
469
- error: response.error,
470
- };
471
- }
472
- }
473
- catch (error) {
474
- const errMsg = error instanceof Error ? error.message : String(error);
475
- return {
476
- id: (0, uuid_1.v4)(),
477
- success: false,
478
- content: [{ type: 'text', text: `获取幻灯片备注出错: ${errMsg}` }],
479
- error: errMsg,
480
- };
481
- }
263
+ const r = await (0, helpers_1.call)('getSlideNotes', { slideIndex });
264
+ if (!r.ok || !r.data)
265
+ return (0, helpers_1.fail)((0, helpers_1.errText)('获取幻灯片备注失败', r), r.error);
266
+ const notes = r.data.notes;
267
+ return (0, helpers_1.ok)(notes
268
+ ? `第 ${slideIndex} 页备注内容:\n${notes}`
269
+ : `第 ${slideIndex} 页没有备注内容`, r.warnings);
482
270
  };
483
271
  exports.getSlideNotesHandler = getSlideNotesHandler;
484
272
  // ============================================================
485
- // 10. wps_ppt_add_shape - 添加形状
486
- // ============================================================
487
- exports.addShapeDefinition = {
488
- name: 'wps_ppt_add_shape',
489
- description: `在幻灯片中添加形状。
490
-
491
- 支持的形状类型:
492
- - rectangle: 矩形
493
- - oval: 椭圆
494
- - triangle: 三角形
495
- - diamond: 菱形
496
- - pentagon: 五边形
497
- - hexagon: 六边形
498
- - arrow: 箭头
499
- - star: 星形
500
- - heart: 心形
501
- - cloud: 云形
502
-
503
- 使用场景:
504
- - "在第1页添加一个矩形"
505
- - "插入一个蓝色的圆形"
506
- - "添加一个带文字的箭头"`,
507
- category: tools_1.ToolCategory.PRESENTATION,
508
- inputSchema: {
509
- type: 'object',
510
- properties: {
511
- slideIndex: {
512
- type: 'number',
513
- description: '幻灯片索引(从1开始),默认1',
514
- },
515
- type: {
516
- type: 'string',
517
- description: '形状类型',
518
- enum: ['rectangle', 'oval', 'triangle', 'diamond', 'pentagon', 'hexagon', 'arrow', 'star', 'heart', 'cloud'],
519
- },
520
- left: {
521
- type: 'number',
522
- description: '左边距(像素),默认100',
523
- },
524
- top: {
525
- type: 'number',
526
- description: '上边距(像素),默认100',
527
- },
528
- width: {
529
- type: 'number',
530
- description: '宽度(像素),默认100',
531
- },
532
- height: {
533
- type: 'number',
534
- description: '高度(像素),默认100',
535
- },
536
- text: {
537
- type: 'string',
538
- description: '形状内的文本',
539
- },
540
- fillColor: {
541
- type: 'string',
542
- description: '填充颜色,十六进制如 #FF0000',
543
- },
544
- },
545
- required: [],
546
- },
547
- };
548
- const addShapeHandler = async (args) => {
549
- const { slideIndex, type, left, top, width, height, text, fillColor } = args;
550
- try {
551
- const response = await wps_client_1.wpsClient.executeMethod('addShape', {
552
- slideIndex: slideIndex || 1,
553
- type: type || 'rectangle',
554
- left: left || 100,
555
- top: top || 100,
556
- width: width || 100,
557
- height: height || 100,
558
- text,
559
- fillColor,
560
- }, wps_1.WpsAppType.PRESENTATION);
561
- if (response.success && response.data) {
562
- const shapeNameMap = {
563
- rectangle: '矩形', oval: '椭圆', triangle: '三角形', diamond: '菱形',
564
- pentagon: '五边形', hexagon: '六边形', arrow: '箭头', star: '星形',
565
- heart: '心形', cloud: '云形',
566
- };
567
- const typeName = shapeNameMap[type || 'rectangle'] || type;
568
- return {
569
- id: (0, uuid_1.v4)(),
570
- success: true,
571
- content: [
572
- {
573
- type: 'text',
574
- text: `形状添加成功!\n幻灯片: 第 ${response.data.slideIndex} 页\n形状类型: ${typeName}\n形状名称: ${response.data.name}${text ? `\n文本: ${text}` : ''}${fillColor ? `\n填充色: ${fillColor}` : ''}`,
575
- },
576
- ],
577
- };
578
- }
579
- else {
580
- return {
581
- id: (0, uuid_1.v4)(),
582
- success: false,
583
- content: [{ type: 'text', text: `添加形状失败: ${response.error}` }],
584
- error: response.error,
585
- };
586
- }
587
- }
588
- catch (error) {
589
- const errMsg = error instanceof Error ? error.message : String(error);
590
- return {
591
- id: (0, uuid_1.v4)(),
592
- success: false,
593
- content: [{ type: 'text', text: `添加形状出错: ${errMsg}` }],
594
- error: errMsg,
595
- };
596
- }
597
- };
598
- exports.addShapeHandler = addShapeHandler;
599
- // ============================================================
600
- // 11. wps_ppt_set_shape_style - 设置形状样式
601
- // ============================================================
602
- exports.setShapeStyleDefinition = {
603
- name: 'wps_ppt_set_shape_style',
604
- description: `设置幻灯片中形状的样式,包括填充颜色、边框颜色和边框粗细。
605
-
606
- 使用场景:
607
- - "把矩形改成红色"
608
- - "设置形状的边框为蓝色"
609
- - "修改形状样式"`,
610
- category: tools_1.ToolCategory.PRESENTATION,
611
- inputSchema: {
612
- type: 'object',
613
- properties: {
614
- slideIndex: {
615
- type: 'number',
616
- description: '幻灯片索引(从1开始),默认1',
617
- },
618
- name: {
619
- type: 'string',
620
- description: '形状名称(通过getSlideInfo获取)',
621
- },
622
- shapeIndex: {
623
- type: 'number',
624
- description: '形状索引(与name二选一)',
625
- },
626
- fillColor: {
627
- type: 'string',
628
- description: '填充颜色,十六进制如 #FF0000',
629
- },
630
- lineColor: {
631
- type: 'string',
632
- description: '边框颜色,十六进制如 #000000',
633
- },
634
- lineWidth: {
635
- type: 'number',
636
- description: '边框粗细(磅)',
637
- },
638
- },
639
- required: [],
640
- },
641
- };
642
- const setShapeStyleHandler = async (args) => {
643
- const { slideIndex, name, shapeIndex, fillColor, lineColor, lineWidth } = args;
644
- try {
645
- const response = await wps_client_1.wpsClient.executeMethod('setShapeStyle', {
646
- slideIndex: slideIndex || 1,
647
- name,
648
- shapeIndex,
649
- fillColor,
650
- lineColor,
651
- lineWidth,
652
- }, wps_1.WpsAppType.PRESENTATION);
653
- if (response.success && response.data) {
654
- let output = `形状样式设置成功!\n形状: ${response.data.name}`;
655
- if (fillColor)
656
- output += `\n填充色: ${fillColor}`;
657
- if (lineColor)
658
- output += `\n边框色: ${lineColor}`;
659
- if (lineWidth)
660
- output += `\n边框粗细: ${lineWidth}pt`;
661
- return {
662
- id: (0, uuid_1.v4)(),
663
- success: true,
664
- content: [{ type: 'text', text: output }],
665
- };
666
- }
667
- else {
668
- return {
669
- id: (0, uuid_1.v4)(),
670
- success: false,
671
- content: [{ type: 'text', text: `设置形状样式失败: ${response.error}` }],
672
- error: response.error,
673
- };
674
- }
675
- }
676
- catch (error) {
677
- const errMsg = error instanceof Error ? error.message : String(error);
678
- return {
679
- id: (0, uuid_1.v4)(),
680
- success: false,
681
- content: [{ type: 'text', text: `设置形状样式出错: ${errMsg}` }],
682
- error: errMsg,
683
- };
684
- }
685
- };
686
- exports.setShapeStyleHandler = setShapeStyleHandler;
687
- // ============================================================
688
- // 12. wps_ppt_add_textbox - 添加文本框
689
- // ============================================================
690
- exports.addTextboxDefinition = {
691
- name: 'wps_ppt_add_textbox',
692
- description: `在幻灯片中添加文本框。
693
-
694
- 使用场景:
695
- - "在第1页添加一个文本框"
696
- - "插入一个写着标题的文本框"
697
- - "添加文本框并设置字号"`,
698
- category: tools_1.ToolCategory.PRESENTATION,
699
- inputSchema: {
700
- type: 'object',
701
- properties: {
702
- slideIndex: {
703
- type: 'number',
704
- description: '幻灯片索引(从1开始),默认1',
705
- },
706
- left: {
707
- type: 'number',
708
- description: '左边距(像素),默认100',
709
- },
710
- top: {
711
- type: 'number',
712
- description: '上边距(像素),默认100',
713
- },
714
- width: {
715
- type: 'number',
716
- description: '宽度(像素),默认200',
717
- },
718
- height: {
719
- type: 'number',
720
- description: '高度(像素),默认50',
721
- },
722
- text: {
723
- type: 'string',
724
- description: '文本框内容',
725
- },
726
- fontSize: {
727
- type: 'number',
728
- description: '字号大小',
729
- },
730
- fontName: {
731
- type: 'string',
732
- description: '字体名称,如 "微软雅黑"',
733
- },
734
- },
735
- required: [],
736
- },
737
- };
738
- const addTextboxHandler = async (args) => {
739
- const { slideIndex, left, top, width, height, text, fontSize, fontName } = args;
740
- try {
741
- const response = await wps_client_1.wpsClient.executeMethod('addTextBox', {
742
- slideIndex: slideIndex || 1,
743
- left: left || 100,
744
- top: top || 100,
745
- width: width || 200,
746
- height: height || 50,
747
- text,
748
- fontSize,
749
- fontName,
750
- }, wps_1.WpsAppType.PRESENTATION);
751
- if (response.success && response.data) {
752
- return {
753
- id: (0, uuid_1.v4)(),
754
- success: true,
755
- content: [
756
- {
757
- type: 'text',
758
- text: `文本框添加成功!\n幻灯片: 第 ${response.data.slideIndex} 页\n名称: ${response.data.name}${text ? `\n内容: "${text}"` : ''}${fontSize ? `\n字号: ${fontSize}` : ''}${fontName ? `\n字体: ${fontName}` : ''}`,
759
- },
760
- ],
761
- };
762
- }
763
- else {
764
- return {
765
- id: (0, uuid_1.v4)(),
766
- success: false,
767
- content: [{ type: 'text', text: `添加文本框失败: ${response.error}` }],
768
- error: response.error,
769
- };
770
- }
771
- }
772
- catch (error) {
773
- const errMsg = error instanceof Error ? error.message : String(error);
774
- return {
775
- id: (0, uuid_1.v4)(),
776
- success: false,
777
- content: [{ type: 'text', text: `添加文本框出错: ${errMsg}` }],
778
- error: errMsg,
779
- };
780
- }
781
- };
782
- exports.addTextboxHandler = addTextboxHandler;
783
- // ============================================================
784
- // 13. wps_ppt_set_slide_title - 设置幻灯片标题
785
- // ============================================================
786
- exports.setSlideTitleDefinition = {
787
- name: 'wps_ppt_set_slide_title',
788
- description: `设置幻灯片的标题文本。
789
-
790
- 使用场景:
791
- - "把第1页标题改成'年度总结'"
792
- - "设置标题为'项目进展'"
793
- - "修改幻灯片标题"`,
794
- category: tools_1.ToolCategory.PRESENTATION,
795
- inputSchema: {
796
- type: 'object',
797
- properties: {
798
- slideIndex: {
799
- type: 'number',
800
- description: '幻灯片索引(从1开始),默认1',
801
- },
802
- title: {
803
- type: 'string',
804
- description: '标题文本',
805
- },
806
- },
807
- required: ['title'],
808
- },
809
- };
810
- const setSlideTitleHandler = async (args) => {
811
- const { slideIndex, title } = args;
812
- try {
813
- const response = await wps_client_1.wpsClient.executeMethod('setSlideTitle', {
814
- slideIndex: slideIndex || 1,
815
- title,
816
- }, wps_1.WpsAppType.PRESENTATION);
817
- if (response.success && response.data) {
818
- return {
819
- id: (0, uuid_1.v4)(),
820
- success: true,
821
- content: [
822
- {
823
- type: 'text',
824
- text: `幻灯片标题设置成功!\n幻灯片: 第 ${response.data.slideIndex} 页\n标题: "${response.data.title}"`,
825
- },
826
- ],
827
- };
828
- }
829
- else {
830
- return {
831
- id: (0, uuid_1.v4)(),
832
- success: false,
833
- content: [{ type: 'text', text: `设置幻灯片标题失败: ${response.error}` }],
834
- error: response.error,
835
- };
836
- }
837
- }
838
- catch (error) {
839
- const errMsg = error instanceof Error ? error.message : String(error);
840
- return {
841
- id: (0, uuid_1.v4)(),
842
- success: false,
843
- content: [{ type: 'text', text: `设置幻灯片标题出错: ${errMsg}` }],
844
- error: errMsg,
845
- };
846
- }
847
- };
848
- exports.setSlideTitleHandler = setSlideTitleHandler;
849
- // ============================================================
850
- // 14. wps_ppt_insert_image - 插入图片
851
- // ============================================================
852
- exports.insertImageDefinition = {
853
- name: 'wps_ppt_insert_image',
854
- description: `在幻灯片中插入图片。
855
-
856
- 使用场景:
857
- - "在第1页插入一张图片"
858
- - "添加图片到幻灯片"
859
- - "把这个图片放到PPT里"`,
860
- category: tools_1.ToolCategory.PRESENTATION,
861
- inputSchema: {
862
- type: 'object',
863
- properties: {
864
- slideIndex: {
865
- type: 'number',
866
- description: '幻灯片索引(从1开始),默认1',
867
- },
868
- path: {
869
- type: 'string',
870
- description: '图片文件的完整路径',
871
- },
872
- left: {
873
- type: 'number',
874
- description: '左边距(像素),默认100',
875
- },
876
- top: {
877
- type: 'number',
878
- description: '上边距(像素),默认100',
879
- },
880
- width: {
881
- type: 'number',
882
- description: '宽度(像素),不填则保持原始尺寸',
883
- },
884
- height: {
885
- type: 'number',
886
- description: '高度(像素),不填则保持原始尺寸',
887
- },
888
- },
889
- required: ['path'],
890
- },
891
- };
892
- const insertImageHandler = async (args) => {
893
- const { slideIndex, path, left, top, width, height } = args;
894
- try {
895
- const response = await wps_client_1.wpsClient.executeMethod('insertPptImage', {
896
- slideIndex: slideIndex || 1,
897
- path,
898
- left: left || 100,
899
- top: top || 100,
900
- width: width || -1,
901
- height: height || -1,
902
- }, wps_1.WpsAppType.PRESENTATION);
903
- if (response.success && response.data) {
904
- return {
905
- id: (0, uuid_1.v4)(),
906
- success: true,
907
- content: [
908
- {
909
- type: 'text',
910
- text: `图片插入成功!\n幻灯片: 第 ${slideIndex || 1} 页\n图片名称: ${response.data.name}\n图片路径: ${response.data.path}`,
911
- },
912
- ],
913
- };
914
- }
915
- else {
916
- return {
917
- id: (0, uuid_1.v4)(),
918
- success: false,
919
- content: [{ type: 'text', text: `插入图片失败: ${response.error}` }],
920
- error: response.error,
921
- };
922
- }
923
- }
924
- catch (error) {
925
- const errMsg = error instanceof Error ? error.message : String(error);
926
- return {
927
- id: (0, uuid_1.v4)(),
928
- success: false,
929
- content: [{ type: 'text', text: `插入图片出错: ${errMsg}` }],
930
- error: errMsg,
931
- };
932
- }
933
- };
934
- exports.insertImageHandler = insertImageHandler;
935
- // ============================================================
936
- // 15. wps_ppt_set_shape_text - 设置形状文字
937
- // ============================================================
938
- exports.setShapeTextDefinition = {
939
- name: 'wps_ppt_set_shape_text',
940
- description: `设置幻灯片中指定形状的文字内容。
941
-
942
- 使用场景:
943
- - "把第1页的第2个形状文字改成'销售额'"
944
- - "修改形状里的文字"`,
945
- category: tools_1.ToolCategory.PRESENTATION,
946
- inputSchema: {
947
- type: 'object',
948
- properties: {
949
- slideIndex: { type: 'number', description: '幻灯片索引(从1开始)' },
950
- shapeIndex: { type: 'number', description: '形状索引(从1开始)' },
951
- text: { type: 'string', description: '要设置的文字内容' },
952
- },
953
- required: ['slideIndex', 'shapeIndex', 'text'],
954
- },
955
- };
956
- const setShapeTextHandler = async (args) => {
957
- const { slideIndex, shapeIndex, text } = args;
958
- try {
959
- const response = await wps_client_1.wpsClient.executeMethod('setShapeText', { slideIndex, shapeIndex, text }, wps_1.WpsAppType.PRESENTATION);
960
- if (response.success && response.data) {
961
- return {
962
- id: (0, uuid_1.v4)(),
963
- success: true,
964
- content: [{ type: 'text', text: `形状文字设置成功!\n形状: ${response.data.name}\n文字: "${text}"` }],
965
- };
966
- }
967
- else {
968
- return {
969
- id: (0, uuid_1.v4)(),
970
- success: false,
971
- content: [{ type: 'text', text: `设置形状文字失败: ${response.error}` }],
972
- error: response.error,
973
- };
974
- }
975
- }
976
- catch (error) {
977
- const errMsg = error instanceof Error ? error.message : String(error);
978
- return {
979
- id: (0, uuid_1.v4)(),
980
- success: false,
981
- content: [{ type: 'text', text: `设置形状文字出错: ${errMsg}` }],
982
- error: errMsg,
983
- };
984
- }
985
- };
986
- exports.setShapeTextHandler = setShapeTextHandler;
987
- // ============================================================
988
- // 16. wps_ppt_set_animation - 设置元素动画
989
- // ============================================================
990
- exports.setAnimationDefinition = {
991
- name: 'wps_ppt_set_animation',
992
- description: `给形状加动画,或调整已有动画的播放顺序(第 8 轮合并了动画族 5 个工具)。
993
-
994
- **两个分支用 \`op\` 选**:
995
- - \`op:'add'\`(默认):给形状加动画,要 \`shapeIndex\` + \`category\` + \`effect\`
996
- - \`op:'reorder'\`:把已有动画挪位置,要 \`animationIndex\` + \`order\`
997
-
998
- \`category\` 决定动作落在哪个动画窗格:
999
- - entrance 入场(appear / fadeIn / flyIn / wipeIn / zoomIn / bounceIn / spinIn)
1000
- - emphasis 强调(pulse / grow / teeter / colorPulse)
1001
- - exit 退场(fadeOut / flyOut / wipeOut / zoomOut / disappear)
1002
-
1003
- 什么时候用:
1004
- - "给第1页第2个形状加个淡入" → { op:'add', slideIndex:1, shapeIndex:2, category:'entrance', effect:'fadeIn' }
1005
- - "让这个元素闪一下强调" → { op:'add', slideIndex:1, shapeIndex:2, category:'emphasis', effect:'pulse' }
1006
- - "把第3个动画移到最前面" → { op:'reorder', slideIndex:1, animationIndex:3, order:1 }
1007
-
1008
- 限制:\`.add\` 是【累加】的 —— 同一形状重复加会叠出多条动画,不会替换。
1009
- 想看现在有哪些动画用 wps_ppt_get_animations,删掉某一条用 wps_ppt_remove_animation。`,
1010
- category: tools_1.ToolCategory.PRESENTATION,
1011
- inputSchema: {
1012
- type: 'object',
1013
- properties: {
1014
- op: {
1015
- type: 'string',
1016
- enum: ['add', 'reorder'],
1017
- description: '操作:add 加动画(默认)/ reorder 调顺序',
1018
- },
1019
- slideIndex: {
1020
- type: 'number',
1021
- description: '幻灯片索引(从1开始)',
1022
- },
1023
- shapeIndex: {
1024
- type: 'number',
1025
- description: '形状索引(从1开始);op=add 时必填',
1026
- },
1027
- category: {
1028
- type: 'string',
1029
- enum: ['entrance', 'emphasis', 'exit'],
1030
- description: '动画类别;op=add 时必填',
1031
- },
1032
- effect: {
1033
- type: 'string',
1034
- description: '具体效果名。entrance: fadeIn/flyIn/wipeIn/zoomIn/bounceIn/spinIn;emphasis: pulse/spin/grow/teeter/colorPulse;exit: fadeOut/flyOut/wipeOut/zoomOut/disappear',
1035
- },
1036
- trigger: {
1037
- type: 'string',
1038
- enum: ['onClick', 'withPrevious', 'afterPrevious'],
1039
- description: '触发方式,默认 onClick(单击时)',
1040
- },
1041
- animationIndex: {
1042
- type: 'number',
1043
- description: '已有动画的序号(从1开始);op=reorder 时必填',
1044
- },
1045
- order: {
1046
- type: 'number',
1047
- description: '新的播放位置(从1开始);op=reorder 时必填',
1048
- },
1049
- },
1050
- required: ['slideIndex'],
1051
- },
1052
- };
1053
- /** 旧 animationType → { category, effect }。旧名 wps_ppt_set_animation 只收一个字符串,
1054
- * 收尾先按 Out/Exit 结尾判退场,其余按入场;未知名默认入场(宁可多加一个也别不加)。 */
1055
- function splitLegacyAnimationType(animationType) {
1056
- return {
1057
- category: /(out|exit)$/i.test(animationType) ? 'exit' : 'entrance',
1058
- effect: animationType,
1059
- };
1060
- }
1061
- const ANIM_NAME_MAP = {
1062
- fadeIn: '淡入', flyIn: '飞入', wipeIn: '擦除', zoomIn: '缩放进入',
1063
- bounceIn: '弹跳进入', spinIn: '旋转进入', fadeOut: '淡出', flyOut: '飞出',
1064
- wipeOut: '擦除退场', zoomOut: '缩小退场', disappear: '消失',
1065
- pulse: '脉冲', grow: '放大缩小', teeter: '跷跷板', colorPulse: '颜色脉冲',
1066
- };
1067
- const TRIGGER_NAME_MAP = {
1068
- onClick: '单击时',
1069
- withPrevious: '与上一动画同时',
1070
- afterPrevious: '上一动画之后',
1071
- };
1072
- const CATEGORY_NAME_MAP = {
1073
- entrance: '入场', emphasis: '强调', exit: '退场',
1074
- };
1075
- /**
1076
- * category + effect → PS 真正认的效果名。
1077
- * 为什么要在 TS 侧合成:WPS COM 的 AddEffect 只吃一个效果 ID,不认"入场/强调/退场"这个维度。
1078
- * 不做这层合成的话,category 就是一个装饰参数(PS 收不到、进不了动画窗格对应格),
1079
- * 那才是真的骗人 —— 用户以为加了退场动画,实际加的还是入场。
1080
- */
1081
- function resolveEffectId(category, effect) {
1082
- const normalized = String(effect || '').trim();
1083
- const lower = normalized.toLowerCase();
1084
- if (category === 'exit') {
1085
- const outMap = {
1086
- fade: 'fadeOut', fly: 'flyOut', wipe: 'wipeOut', zoom: 'zoomOut',
1087
- vanish: 'vanish', disappear: 'disappear', dissolve: 'dissolveOut',
1088
- };
1089
- // 已经带 Out 尾名的(fadeOut)原样送下去,不重复拼
1090
- if (lower.endsWith('out') || lower === 'disappear' || lower === 'vanish')
1091
- return normalized;
1092
- return outMap[lower] || normalized;
1093
- }
1094
- const inMap = {
1095
- fade: 'fadeIn', fly: 'flyIn', wipe: 'wipeIn', zoom: 'zoomIn',
1096
- dissolve: 'dissolveIn', appear: 'appear',
1097
- };
1098
- if (lower.endsWith('in') || lower === 'appear')
1099
- return normalized;
1100
- return inMap[lower] || normalized;
1101
- }
1102
- const setAnimationHandler = async (args) => {
1103
- const op = args.op || 'add';
1104
- try {
1105
- if (op === 'reorder') {
1106
- const { slideIndex, animationIndex, order } = args;
1107
- if (!animationIndex || !order) {
1108
- return {
1109
- id: (0, uuid_1.v4)(),
1110
- success: false,
1111
- content: [{ type: 'text', text: `op=reorder 时必须同时给 animationIndex 和 order` }],
1112
- error: 'Missing required parameter: animationIndex / order',
1113
- };
1114
- }
1115
- const response = await wps_client_1.wpsClient.executeMethod('setAnimationOrder', { slideIndex, animationIndex, newOrder: order }, wps_1.WpsAppType.PRESENTATION);
1116
- if (response.success) {
1117
- return {
1118
- id: (0, uuid_1.v4)(),
1119
- success: true,
1120
- content: [
1121
- {
1122
- type: 'text',
1123
- text: `动画顺序调整成功!\n幻灯片: 第 ${slideIndex} 页\n动画 ${animationIndex} → 新位置 ${order}`,
1124
- },
1125
- ],
1126
- };
1127
- }
1128
- return {
1129
- id: (0, uuid_1.v4)(),
1130
- success: false,
1131
- content: [{ type: 'text', text: `调整动画顺序失败: ${response.error}` }],
1132
- error: response.error,
1133
- };
1134
- }
1135
- // op=add:effect 缺失时兜住旧的 animationType(第 2 轮起这个参数就叫 animationType)
1136
- const raw = args;
1137
- const legacy = !raw.effect && raw.animationType
1138
- ? splitLegacyAnimationType(String(raw.animationType))
1139
- : null;
1140
- const category = raw.category || (legacy ? legacy.category : undefined);
1141
- const effect = raw.effect || (legacy ? legacy.effect : undefined);
1142
- if (!raw.shapeIndex || !category || !effect) {
1143
- return {
1144
- id: (0, uuid_1.v4)(),
1145
- success: false,
1146
- content: [
1147
- {
1148
- type: 'text',
1149
- text: `op=add 时必须同时给 shapeIndex、category(entrance/emphasis/exit)和 effect`,
1150
- },
1151
- ],
1152
- error: 'Missing required parameter: shapeIndex / category / effect',
1153
- };
1154
- }
1155
- // category 在这里落地成真正的效果名(exit+fade → fadeOut),PS 侧只认效果 ID
1156
- const effectId = resolveEffectId(category, effect);
1157
- const response = await wps_client_1.wpsClient.executeMethod('addAnimation', {
1158
- slideIndex: raw.slideIndex,
1159
- shapeIndex: raw.shapeIndex,
1160
- effect: effectId,
1161
- trigger: raw.trigger || 'onClick',
1162
- }, wps_1.WpsAppType.PRESENTATION);
1163
- if (response.success) {
1164
- const lines = [
1165
- `动画设置成功!`,
1166
- `幻灯片: 第 ${raw.slideIndex} 页`,
1167
- `形状: 第 ${raw.shapeIndex} 个`,
1168
- `类别: ${CATEGORY_NAME_MAP[category] || category}`,
1169
- `动画: ${ANIM_NAME_MAP[effect] || effect}(${effectId})`,
1170
- `触发: ${TRIGGER_NAME_MAP[raw.trigger || 'onClick'] || raw.trigger || 'onClick'}`,
1171
- ];
1172
- if (response.data && response.data.animationIndex) {
1173
- lines.push(`动画序号: ${response.data.animationIndex}`);
1174
- }
1175
- return {
1176
- id: (0, uuid_1.v4)(),
1177
- success: true,
1178
- content: [{ type: 'text', text: lines.join('\n') }],
1179
- };
1180
- }
1181
- return {
1182
- id: (0, uuid_1.v4)(),
1183
- success: false,
1184
- content: [{ type: 'text', text: `设置动画失败: ${response.error}` }],
1185
- error: response.error,
1186
- };
1187
- }
1188
- catch (error) {
1189
- const errMsg = error instanceof Error ? error.message : String(error);
1190
- return {
1191
- id: (0, uuid_1.v4)(),
1192
- success: false,
1193
- content: [{ type: 'text', text: `设置动画出错: ${errMsg}` }],
1194
- error: errMsg,
1195
- };
1196
- }
1197
- };
1198
- exports.setAnimationHandler = setAnimationHandler;
1199
- // ============================================================
1200
- // 17. wps_ppt_set_background - 设置背景(第 5 轮:background 族 6→1 合并)
1201
- // ============================================================
1202
- exports.setBackgroundDefinition = {
1203
- name: 'wps_ppt_set_background',
1204
- description: `设置背景:某一页、整份文稿、或幻灯片母版。
1205
-
1206
- **三个维度一次说清**(合并了原来 6 个背景工具,别再找 set_background_color / _image / _gradient / set_slide_background / set_master_background):
1207
- - \`target\`: slide(默认,单页)/ all(整份文稿)/ master(母版)
1208
- - \`type\`: solid(纯色)/ image(图片)/ gradient(渐变)/ pattern
1209
- - 具体的填充物:\`color\` / \`imagePath\` / \`gradient\`
1210
-
1211
- 什么时候用:
1212
- - "把这页背景改成深蓝" → { target:'slide', slideIndex:2, type:'solid', color:'#003366' }
1213
- - "整份文稿统一白底" → { target:'all', type:'solid', color:'#FFFFFF' }
1214
- - "用这张图做背景" → { target:'slide', slideIndex:1, type:'image', imagePath:'C:\\\\pics\\\\bg.png' }
1215
- - "母版加渐变" → { target:'master', type:'gradient', gradient:{ type:'linear', colors:['#FF0000','#00FF00'] } }
1216
-
1217
- 不填 \`type\` 也能用:按你给的 color / imagePath / gradient 自动推断(老名字走别名过来时就是这条路)。
1218
-
1219
- 限制(真限制,不是没实现):
1220
- - \`target:'master'\` 只支持纯色与渐变 —— 母版背景换图片 WPS 不认,会明确报错而不是假装成功。
1221
- - \`type:'pattern'\`(图案填充)WPS COM 没有对应接口,明确报错。`,
1222
- category: tools_1.ToolCategory.PRESENTATION,
1223
- inputSchema: {
1224
- type: 'object',
1225
- properties: {
1226
- target: {
1227
- type: 'string',
1228
- enum: ['slide', 'all', 'master'],
1229
- description: '作用范围:slide 单页(默认)/ all 整份文稿 / master 母版',
1230
- },
1231
- slideIndex: {
1232
- type: 'number',
1233
- description: '页码(从1开始);target=all/master 时忽略',
1234
- },
1235
- type: {
1236
- type: 'string',
1237
- enum: ['solid', 'gradient', 'image', 'pattern'],
1238
- description: '填充类型。不填则按 color→solid / imagePath→image / gradient→gradient 推断',
1239
- },
1240
- color: { type: 'string', description: 'type=solid 时的颜色,十六进制如 #FF0000' },
1241
- imagePath: { type: 'string', description: 'type=image 时的图片路径' },
1242
- gradient: {
1243
- type: 'object',
1244
- description: 'type=gradient 时的渐变配置:{ type:"linear"|"radial", colors:["#FF0000","#00FF00"] }。' +
1245
- 'WPS 只吃前两个颜色,多余的颜色会被忽略(会在提示里说明)',
1246
- },
1247
- pattern: { type: 'string', description: 'type=pattern 时的图案名(WPS 不支持,传了会明确报错)' },
1248
- // 老名字(别名)可能会带过来的历史参数,接受但不推荐
1249
- background: {
1250
- type: 'object',
1251
- description: '(历史形状){type,color,colors,imagePath,pattern},等价于把里面几项平铺到顶层',
1252
- },
1253
- },
1254
- // 刻意不 required['type']:草案里是必填,但那样 5 个旧名就没法走别名(别名不能注入参数),
1255
- // 而合并的目标恰恰是"旧名无损映射"。改为按参数推断,并在描述里写明。
1256
- required: [],
1257
- },
1258
- };
1259
- /** 把老形状 background{} 摊平到顶层(只补缺失的键) */
1260
- function flattenLegacyBackground(args) {
1261
- const out = { ...args };
1262
- const bg = args.background;
1263
- if (bg && typeof bg === 'object') {
1264
- for (const [k, v] of Object.entries(bg)) {
1265
- if (out[k] === undefined)
1266
- out[k] = v;
1267
- }
1268
- // 老形状里 "colors" 是渐变色数组
1269
- if (out.gradient === undefined && Array.isArray(bg.colors)) {
1270
- out.gradient = { type: 'linear', colors: bg.colors };
1271
- }
1272
- }
1273
- return out;
1274
- }
1275
- const setBackgroundHandler = async (args) => {
1276
- const a = flattenLegacyBackground(args);
1277
- const target = a.target || 'slide';
1278
- const slideIndex = a.slideIndex;
1279
- const color = a.color;
1280
- const imagePath = a.imagePath;
1281
- const pattern = a.pattern;
1282
- const gradient = a.gradient;
1283
- // type 推断:草案要求必填,但旧名走别名时给不出 type(别名不能注入参数)。
1284
- // 按"给了什么填什么"推断 —— 唯一有歧义的情况是同时给了多个,那时按 image > gradient > color 取先。
1285
- const type = a.type ||
1286
- (imagePath ? 'image' : gradient ? 'gradient' : pattern ? 'pattern' : color ? 'solid' : '');
1287
- const fail = (msg, err) => ({
1288
- id: (0, uuid_1.v4)(),
1289
- success: false,
1290
- content: [{ type: 'text', text: msg }],
1291
- error: err ?? msg,
1292
- });
1293
- const ok = (text) => ({
1294
- id: (0, uuid_1.v4)(),
1295
- success: true,
1296
- content: [{ type: 'text', text }],
1297
- });
1298
- if (!type) {
1299
- return fail('要说清怎么填:给 color(纯色)/ imagePath(图片)/ gradient(渐变)之一,或显式传 type。' +
1300
- '示例:{ "target":"slide", "slideIndex":1, "type":"solid", "color":"#003366" }');
1301
- }
1302
- if (type === 'pattern') {
1303
- return fail('WPS COM 没有图案填充的接口,type:"pattern" 无法执行(这不是参数问题,换 solid/gradient/image)。');
1304
- }
1305
- if (type === 'solid' && !color)
1306
- return fail('type=solid 需要 color,例如 "#003366"。');
1307
- if (type === 'image' && !imagePath)
1308
- return fail('type=image 需要 imagePath(图片在本机的绝对路径)。');
1309
- if (type === 'gradient') {
1310
- const colors = (gradient && gradient.colors) || [];
1311
- if (!Array.isArray(colors) || colors.length < 2) {
1312
- return fail('type=gradient 需要 gradient.colors 至少两个颜色,例如 ["#FF0000","#00FF00"]。');
1313
- }
1314
- }
1315
- if (target === 'master' && type === 'image') {
1316
- return fail('母版背景不支持图片(WPS 的母版 Fill 只吃纯色/渐变)。要整份文稿用图片背景,用 target:"all"。');
1317
- }
1318
- if (target === 'slide' && !slideIndex) {
1319
- return fail('target=slide 需要 slideIndex(从 1 开始)。要改整份文稿用 target:"all"。');
1320
- }
1321
- // 一个内部小包装。注意:动作名走变量 → param-shape-audit(扫 executeMethod 的字面量)看不到这 4 个
1322
- // 调用点,属于那个脚本自己写明的"动态拼参数抓不到 = 漏报"。所以这里的参数是【手工对着 PS 的读法核过的】:
1323
- // setMasterBackground 读 color / color1 / color2
1324
- // setBackgroundColor 读 color / applyToAll
1325
- // setSlideBackground 读 slideIndex / color / imagePath
1326
- // getSlideCount 无参数
1327
- // 改这里的参数名时,请同步改上面这份清单(它就是这几个动作的"参数契约")。
1328
- const exec = (action, params) => wps_client_1.wpsClient.executeMethod(action, params, wps_1.WpsAppType.PRESENTATION);
1329
- const warnings = [];
1330
- const where = target === 'all' ? '整份文稿' : target === 'master' ? '母版' : `第 ${slideIndex} 页`;
1331
- try {
1332
- // ---- 母版 ----
1333
- if (target === 'master') {
1334
- const params = type === 'gradient'
1335
- ? { color1: gradient.colors[0], color2: gradient.colors[1] }
1336
- : { color };
1337
- const r = await exec('setMasterBackground', params);
1338
- if (!r.success)
1339
- return fail(`设置母版背景失败: ${r.error}`, r.error);
1340
- return ok(`母版背景已设置:${type === 'gradient' ? `渐变 ${gradient.colors.slice(0, 2).join(' → ')}` : color}`);
1341
- }
1342
- // ---- 整份文稿 ----
1343
- if (target === 'all') {
1344
- if (type === 'solid') {
1345
- const r = await exec('setBackgroundColor', { color, applyToAll: true });
1346
- if (!r.success)
1347
- return fail(`设置整份文稿背景失败: ${r.error}`, r.error);
1348
- return ok(`整份文稿背景已设为 ${color}(applyToAll)`);
1349
- }
1350
- // 渐变/图片没有"一次全设"的动作 → 逐页设。先问页数,别拿失败当终止条件。
1351
- const cnt = await exec('getSlideCount', {});
1352
- const total = Number((cnt.data && cnt.data.count) || 0);
1353
- if (!total)
1354
- return fail('拿不到页数,无法逐页设置背景。');
1355
- let done = 0;
1356
- const failedPages = [];
1357
- for (let i = 1; i <= total; i++) {
1358
- const r = type === 'image'
1359
- ? await exec('setSlideBackground', { slideIndex: i, imagePath })
1360
- : await exec('setSlideBackground', {
1361
- slideIndex: i,
1362
- color1: gradient.colors[0],
1363
- color2: gradient.colors[1],
1364
- });
1365
- if (r.success)
1366
- done++;
1367
- else
1368
- failedPages.push(i);
1369
- }
1370
- if (done === 0)
1371
- return fail(`整份文稿逐页设置背景全部失败(共 ${total} 页)。`);
1372
- if (failedPages.length) {
1373
- warnings.push({
1374
- step: 'set_background.all',
1375
- message: `第 ${failedPages.join('、')} 页没设置成功(共 ${total} 页,成功 ${done} 页)`,
1376
- });
1377
- }
1378
- return {
1379
- id: (0, uuid_1.v4)(),
1380
- success: true,
1381
- content: [{ type: 'text', text: `整份文稿背景已设置:${done}/${total} 页` }],
1382
- ...(warnings.length ? { warnings } : {}),
1383
- };
1384
- }
1385
- // ---- 单页 ----
1386
- const params = { slideIndex };
1387
- if (type === 'solid')
1388
- params.color = color;
1389
- else if (type === 'image')
1390
- params.imagePath = imagePath;
1391
- else {
1392
- params.color1 = gradient.colors[0];
1393
- params.color2 = gradient.colors[1];
1394
- }
1395
- const r = await exec('setSlideBackground', params);
1396
- if (!r.success)
1397
- return fail(`设置背景失败: ${r.error}`, r.error);
1398
- const detail = type === 'solid' ? `颜色 ${color}` : type === 'image' ? `图片 ${imagePath}` : `渐变 ${gradient.colors.slice(0, 2).join(' → ')}`;
1399
- if (type === 'gradient' && gradient.colors.length > 2) {
1400
- warnings.push({ step: 'gradient', message: 'WPS 的渐变只支持两个色标,多余的颜色已忽略' });
1401
- }
1402
- return {
1403
- id: (0, uuid_1.v4)(),
1404
- success: true,
1405
- content: [{ type: 'text', text: `背景已设置:${where},${detail}` }],
1406
- ...(warnings.length ? { warnings } : {}),
1407
- };
1408
- }
1409
- catch (error) {
1410
- const errMsg = error instanceof Error ? error.message : String(error);
1411
- return fail(`设置背景出错: ${errMsg}`);
1412
- }
1413
- };
1414
- exports.setBackgroundHandler = setBackgroundHandler;
1415
- // ============================================================
1416
- // 18. wps_ppt_set_slide_size - 设置幻灯片尺寸
273
+ // 8. wps_ppt_set_slide_size - 设置幻灯片尺寸
1417
274
  // ============================================================
1418
275
  exports.setSlideSizeDefinition = {
1419
276
  name: 'wps_ppt_set_slide_size',
1420
- description: `设置演示文稿的幻灯片尺寸(按像素给,内部换算成 WPS 的磅)。
277
+ description: `设置演示文稿的幻灯片尺寸(单位:磅)。
1421
278
 
1422
- 常用尺寸:
1423
- - 标准(4:3): 宽960, 高720
1424
- - 宽屏(16:9): 宽960, 高540
279
+ **⚠️ v1.0.5 起单位为磅**(此前版本按像素收并自动 ×0.75 换算成磅)。
280
+ 迁移提示:16:9 的 960×540 数值恰好磅/像素相同,旧调用不受影响;
281
+ 4:3 旧写法 960×720 现在会得到更大的 960×720 磅版面——4:3 请改传 **720×540**。
282
+
283
+ 常用尺寸(磅):
284
+ - 标准(4:3): 宽720, 高540(10×7.5 英寸)
285
+ - 宽屏(16:9): 宽960, 高540(13.3×7.5 英寸)
1425
286
  - 宽屏(16:10): 宽960, 高600
1426
- - A4横版: 宽1123, 高794
1427
- - A4竖版: 宽794, 高1123
287
+ - A4横版: 宽842, 高595
288
+ - A4竖版: 宽595, 高842
1428
289
 
1429
290
  注意:改尺寸会重排整份文稿,元素可能溢出页面。改完建议 wps_ppt_export_slide_as_image 看一眼。
1430
291
 
@@ -1438,11 +299,11 @@ exports.setSlideSizeDefinition = {
1438
299
  properties: {
1439
300
  width: {
1440
301
  type: 'number',
1441
- description: '幻灯片宽度(像素,96 DPI;内部 ×0.75 换算成磅)',
302
+ description: '幻灯片宽度(磅)。v1.0.5 起为磅;16:9 用 960,4:3 用 720',
1442
303
  },
1443
304
  height: {
1444
305
  type: 'number',
1445
- description: '幻灯片高度(像素,96 DPI;内部 ×0.75 换算成磅)',
306
+ description: '幻灯片高度(磅)。v1.0.5 起为磅;16:9 用 540,4:3 用 540',
1446
307
  },
1447
308
  },
1448
309
  required: ['width', 'height'],
@@ -1450,270 +311,17 @@ exports.setSlideSizeDefinition = {
1450
311
  };
1451
312
  const setSlideSizeHandler = async (args) => {
1452
313
  const { width, height } = args;
1453
- try {
1454
- const response = await wps_client_1.wpsClient.executeMethod('setSlideSize', // 第 1 期第 2 章第 2 轮:这句原为「仅Windows支持」,是假注释 —— 该动作曾长期不存在于 ps1。第 6 轮已补 case,现在 Windows 上真能用。
1455
- { width, height }, wps_1.WpsAppType.PRESENTATION);
1456
- if (response.success) {
1457
- return {
1458
- id: (0, uuid_1.v4)(),
1459
- success: true,
1460
- content: [
1461
- {
1462
- type: 'text',
1463
- text: `幻灯片尺寸设置成功!\n宽度: ${width}px\n高度: ${height}px`,
1464
- },
1465
- ],
1466
- };
1467
- }
1468
- else {
1469
- return {
1470
- id: (0, uuid_1.v4)(),
1471
- success: false,
1472
- content: [{ type: 'text', text: `设置幻灯片尺寸失败: ${response.error}` }],
1473
- error: response.error,
1474
- };
1475
- }
1476
- }
1477
- catch (error) {
1478
- const errMsg = error instanceof Error ? error.message : String(error);
1479
- return {
1480
- id: (0, uuid_1.v4)(),
1481
- success: false,
1482
- content: [{ type: 'text', text: `设置幻灯片尺寸出错: ${errMsg}` }],
1483
- error: errMsg,
1484
- };
1485
- }
314
+ const r = await (0, helpers_1.call)(
315
+ // 早期 ps1 缺 case 时曾误标「仅Windows支持」;现已真实可用。
316
+ // v1.0.5 起单位为磅(ps1 的 ×0.75 换算已按所有者裁定移除),schema 描述已同步。
317
+ 'setSlideSize', { width, height });
318
+ if (!r.ok)
319
+ return (0, helpers_1.fail)((0, helpers_1.errText)('设置幻灯片尺寸失败', r), r.error);
320
+ return (0, helpers_1.ok)(`幻灯片尺寸设置成功!\n宽度: ${width} 磅\n高度: ${height} 磅`, r.warnings);
1486
321
  };
1487
322
  exports.setSlideSizeHandler = setSlideSizeHandler;
1488
323
  // ============================================================
1489
- // 19. wps_ppt_set_transition - 设置幻灯片切换效果
1490
- // ============================================================
1491
- exports.setTransitionDefinition = {
1492
- name: 'wps_ppt_set_transition',
1493
- description: `设置幻灯片切换效果:单页 or 整份文稿(第 8 轮合并了切换族 3 个工具)。
1494
-
1495
- - \`target\`: slide(默认,只改 \`slideIndex\` 那一页)/ all(整份文稿统一)
1496
- - \`effect\`(**必填**): fade 淡出 / push 推入 / wipe 擦除 / split 拆分 / reveal 揭开 / cover 覆盖 / dissolve 溶解 / curtains 帷幕 / **none 取消切换**
1497
-
1498
- 什么时候用:
1499
- - "给第1页加个淡出切换" → { target:'slide', slideIndex:1, effect:'fade', duration:1 }
1500
- - "所有页统一用推入" → { target:'all', effect:'push' }
1501
- - "第2页不要切换效果" → { target:'slide', slideIndex:2, effect:'none' }
1502
-
1503
- 取消切换用 \`effect:'none'\`,不要去找"删除切换"的工具 —— 切换本来就是"切走时播放的东西",
1504
- 把它设成没有就等价于删掉,而且这样不会因为名字里有"删/删掉"而弹破坏性确认框。
1505
-
1506
- 真限制:没有"切换音效"参数。WPS 的 COM 接口里没有"切走时播一段音频"这个能力
1507
- (那是 PowerPoint 的 AddMediaObject2),所以本工具不提供该参数 —— 要音效得先在 WPS 里录进切换设置。`,
1508
- category: tools_1.ToolCategory.PRESENTATION,
1509
- inputSchema: {
1510
- type: 'object',
1511
- properties: {
1512
- target: {
1513
- type: 'string',
1514
- enum: ['slide', 'all'],
1515
- description: '作用范围:slide 单页(默认)/ all 整份文稿',
1516
- },
1517
- slideIndex: {
1518
- type: 'number',
1519
- description: '幻灯片索引(从1开始);target=all 时忽略',
1520
- },
1521
- effect: {
1522
- type: 'string',
1523
- description: '切换效果:fade / push / wipe / split / reveal / cover / dissolve / curtains;none = 取消切换',
1524
- },
1525
- duration: {
1526
- type: 'number',
1527
- description: '切换持续时间(秒),默认1秒',
1528
- },
1529
- },
1530
- required: [],
1531
- },
1532
- };
1533
- const TRANS_NAME_MAP = {
1534
- fade: '淡出', push: '推入', wipe: '擦除', split: '拆分',
1535
- reveal: '揭开', cover: '覆盖', dissolve: '溶解', curtains: '帷幕',
1536
- none: '取消切换',
1537
- };
1538
- const setTransitionHandler = async (args) => {
1539
- const { slideIndex, duration } = args;
1540
- const target = (args.target || 'slide');
1541
- // 第 2 轮起的旧参数名是 transition;旧名调用经别名进来时带的是它
1542
- const effect = args.effect || args.transition;
1543
- if (!effect) {
1544
- return {
1545
- id: (0, uuid_1.v4)(),
1546
- success: false,
1547
- content: [{ type: 'text', text: `必须给 effect(切换效果名,或 none 表示取消切换)` }],
1548
- error: 'Missing required parameter: effect',
1549
- };
1550
- }
1551
- if (target === 'slide' && !slideIndex) {
1552
- return {
1553
- id: (0, uuid_1.v4)(),
1554
- success: false,
1555
- content: [{ type: 'text', text: `target='slide' 时必须给 slideIndex` }],
1556
- error: 'Missing required parameter: slideIndex',
1557
- };
1558
- }
1559
- try {
1560
- // 整份文稿走 PS 侧的 applyTransitionToAll:它是独立的动作,
1561
- // 而 setSlideTransition 的循环版不在这个 case 里,硬塞 all 进去等于让 PS 认一个它不认的键。
1562
- const response = target === 'all'
1563
- ? await wps_client_1.wpsClient.executeMethod('applyTransitionToAll', { effect, duration: duration || 1 }, wps_1.WpsAppType.PRESENTATION)
1564
- : await wps_client_1.wpsClient.executeMethod('setSlideTransition', { slideIndex, effect, duration: duration || 1 }, wps_1.WpsAppType.PRESENTATION);
1565
- if (response.success) {
1566
- const lines = [
1567
- `切换效果设置成功!`,
1568
- target === 'all' ? `范围: 全部幻灯片` : `幻灯片: 第 ${slideIndex} 页`,
1569
- `切换效果: ${TRANS_NAME_MAP[effect] || effect}`,
1570
- `持续时间: ${duration || 1} 秒`,
1571
- ];
1572
- if (response.data && response.data.slideCount) {
1573
- lines.push(`已应用: ${response.data.slideCount} 页`);
1574
- }
1575
- return {
1576
- id: (0, uuid_1.v4)(),
1577
- success: true,
1578
- content: [{ type: 'text', text: lines.join('\n') }],
1579
- };
1580
- }
1581
- return {
1582
- id: (0, uuid_1.v4)(),
1583
- success: false,
1584
- content: [{ type: 'text', text: `设置切换效果失败: ${response.error}` }],
1585
- error: response.error,
1586
- };
1587
- }
1588
- catch (error) {
1589
- const errMsg = error instanceof Error ? error.message : String(error);
1590
- return {
1591
- id: (0, uuid_1.v4)(),
1592
- success: false,
1593
- content: [{ type: 'text', text: `设置切换效果出错: ${errMsg}` }],
1594
- error: errMsg,
1595
- };
1596
- }
1597
- };
1598
- exports.setTransitionHandler = setTransitionHandler;
1599
- // ============================================================
1600
- // 21. wps_ppt_set_shape_fill - 设置形状填充颜色
1601
- // ============================================================
1602
- exports.setShapeFillDefinition = {
1603
- name: 'wps_ppt_set_shape_fill',
1604
- description: `设置幻灯片中指定形状的填充颜色。
1605
-
1606
- 使用场景:
1607
- - "把第1页的第2个形状填充为红色"
1608
- - "修改形状背景色为#00FF00"
1609
- - "设置形状的填充颜色"`,
1610
- category: tools_1.ToolCategory.PRESENTATION,
1611
- inputSchema: {
1612
- type: 'object',
1613
- properties: {
1614
- slideIndex: { type: 'number', description: '幻灯片索引(从1开始)' },
1615
- shapeIndex: { type: 'number', description: '形状索引(从1开始)' },
1616
- color: { type: 'string', description: '填充颜色,十六进制如 #FF0000' },
1617
- },
1618
- required: ['slideIndex', 'shapeIndex', 'color'],
1619
- },
1620
- };
1621
- const setShapeFillHandler = async (args) => {
1622
- const { slideIndex, shapeIndex, color } = args;
1623
- try {
1624
- const response = await wps_client_1.wpsClient.executeMethod('setShapeFill', // 第 1 期第 2 章第 2 轮:这句原为「仅Windows支持」,是假注释 —— 该动作曾长期不存在于 ps1。第 6 轮已补 case,现在 Windows 上真能用。
1625
- { slideIndex, shapeIndex, color }, wps_1.WpsAppType.PRESENTATION);
1626
- if (response.success) {
1627
- return {
1628
- id: (0, uuid_1.v4)(),
1629
- success: true,
1630
- content: [
1631
- {
1632
- type: 'text',
1633
- text: `形状填充颜色设置成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n填充颜色: ${color}`,
1634
- },
1635
- ],
1636
- };
1637
- }
1638
- else {
1639
- return {
1640
- id: (0, uuid_1.v4)(),
1641
- success: false,
1642
- content: [{ type: 'text', text: `设置形状填充失败: ${response.error}` }],
1643
- error: response.error,
1644
- };
1645
- }
1646
- }
1647
- catch (error) {
1648
- const errMsg = error instanceof Error ? error.message : String(error);
1649
- return {
1650
- id: (0, uuid_1.v4)(),
1651
- success: false,
1652
- content: [{ type: 'text', text: `设置形状填充出错: ${errMsg}` }],
1653
- error: errMsg,
1654
- };
1655
- }
1656
- };
1657
- exports.setShapeFillHandler = setShapeFillHandler;
1658
- // ============================================================
1659
- // 22. wps_ppt_add_speaker_notes - 添加演讲者备注
1660
- // ============================================================
1661
- exports.addSpeakerNotesDefinition = {
1662
- name: 'wps_ppt_add_speaker_notes',
1663
- description: `添加或追加演讲者备注到指定幻灯片。
1664
-
1665
- 使用场景:
1666
- - "给第1页添加演讲者备注"
1667
- - "在备注中写上提示词"
1668
- - "追加演讲提示到第3页"`,
1669
- category: tools_1.ToolCategory.PRESENTATION,
1670
- inputSchema: {
1671
- type: 'object',
1672
- properties: {
1673
- slideIndex: { type: 'number', description: '幻灯片索引(从1开始)' },
1674
- notes: { type: 'string', description: '演讲者备注内容' },
1675
- },
1676
- required: ['slideIndex', 'notes'],
1677
- },
1678
- };
1679
- const addSpeakerNotesHandler = async (args) => {
1680
- const { slideIndex, notes } = args;
1681
- try {
1682
- const response = await wps_client_1.wpsClient.executeMethod('setSlideNotes', { slideIndex, notes }, wps_1.WpsAppType.PRESENTATION);
1683
- if (response.success) {
1684
- return {
1685
- id: (0, uuid_1.v4)(),
1686
- success: true,
1687
- content: [
1688
- {
1689
- type: 'text',
1690
- text: `演讲者备注添加成功!\n幻灯片: 第 ${slideIndex} 页\n备注内容: "${notes.length > 50 ? notes.substring(0, 50) + '...' : notes}"`,
1691
- },
1692
- ],
1693
- };
1694
- }
1695
- else {
1696
- return {
1697
- id: (0, uuid_1.v4)(),
1698
- success: false,
1699
- content: [{ type: 'text', text: `添加演讲者备注失败: ${response.error}` }],
1700
- error: response.error,
1701
- };
1702
- }
1703
- }
1704
- catch (error) {
1705
- const errMsg = error instanceof Error ? error.message : String(error);
1706
- return {
1707
- id: (0, uuid_1.v4)(),
1708
- success: false,
1709
- content: [{ type: 'text', text: `添加演讲者备注出错: ${errMsg}` }],
1710
- error: errMsg,
1711
- };
1712
- }
1713
- };
1714
- exports.addSpeakerNotesHandler = addSpeakerNotesHandler;
1715
- // ============================================================
1716
- // 导出所有幻灯片操作相关的Tools
324
+ // 导出所有幻灯片页操作相关的Tools
1717
325
  // ============================================================
1718
326
  exports.slideOpsTools = [
1719
327
  { definition: exports.deleteSlideDefinition, handler: exports.deleteSlideHandler },
@@ -1723,18 +331,7 @@ exports.slideOpsTools = [
1723
331
  { definition: exports.switchSlideDefinition, handler: exports.switchSlideHandler },
1724
332
  { definition: exports.setSlideLayoutDefinition, handler: exports.setSlideLayoutHandler },
1725
333
  { definition: exports.getSlideNotesDefinition, handler: exports.getSlideNotesHandler },
1726
- { definition: exports.addShapeDefinition, handler: exports.addShapeHandler },
1727
- { definition: exports.setShapeStyleDefinition, handler: exports.setShapeStyleHandler },
1728
- { definition: exports.addTextboxDefinition, handler: exports.addTextboxHandler },
1729
- { definition: exports.setSlideTitleDefinition, handler: exports.setSlideTitleHandler },
1730
- { definition: exports.insertImageDefinition, handler: exports.insertImageHandler },
1731
- { definition: exports.setShapeTextDefinition, handler: exports.setShapeTextHandler },
1732
- { definition: exports.setAnimationDefinition, handler: exports.setAnimationHandler },
1733
- { definition: exports.setBackgroundDefinition, handler: exports.setBackgroundHandler },
1734
334
  { definition: exports.setSlideSizeDefinition, handler: exports.setSlideSizeHandler },
1735
- { definition: exports.setTransitionDefinition, handler: exports.setTransitionHandler },
1736
- { definition: exports.setShapeFillDefinition, handler: exports.setShapeFillHandler },
1737
- { definition: exports.addSpeakerNotesDefinition, handler: exports.addSpeakerNotesHandler },
1738
335
  ];
1739
336
  exports.default = exports.slideOpsTools;
1740
337
  //# sourceMappingURL=slide-ops.js.map