hanseol-dev 4.0.12

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 (720) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +267 -0
  3. package/dist/agents/base/base-agent.d.ts +38 -0
  4. package/dist/agents/base/base-agent.d.ts.map +1 -0
  5. package/dist/agents/base/base-agent.js +69 -0
  6. package/dist/agents/base/base-agent.js.map +1 -0
  7. package/dist/agents/docs-search/index.d.ts +33 -0
  8. package/dist/agents/docs-search/index.d.ts.map +1 -0
  9. package/dist/agents/docs-search/index.js +244 -0
  10. package/dist/agents/docs-search/index.js.map +1 -0
  11. package/dist/agents/index.d.ts +4 -0
  12. package/dist/agents/index.d.ts.map +1 -0
  13. package/dist/agents/index.js +4 -0
  14. package/dist/agents/index.js.map +1 -0
  15. package/dist/agents/planner/index.d.ts +19 -0
  16. package/dist/agents/planner/index.d.ts.map +1 -0
  17. package/dist/agents/planner/index.js +339 -0
  18. package/dist/agents/planner/index.js.map +1 -0
  19. package/dist/cli.d.ts +3 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +205 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/constants.d.ts +10 -0
  24. package/dist/constants.d.ts.map +1 -0
  25. package/dist/constants.js +12 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/core/auth/oauth-login.d.ts +19 -0
  28. package/dist/core/auth/oauth-login.d.ts.map +1 -0
  29. package/dist/core/auth/oauth-login.js +197 -0
  30. package/dist/core/auth/oauth-login.js.map +1 -0
  31. package/dist/core/compact/compact-manager.d.ts +22 -0
  32. package/dist/core/compact/compact-manager.d.ts.map +1 -0
  33. package/dist/core/compact/compact-manager.js +75 -0
  34. package/dist/core/compact/compact-manager.js.map +1 -0
  35. package/dist/core/compact/compact-prompts.d.ts +11 -0
  36. package/dist/core/compact/compact-prompts.d.ts.map +1 -0
  37. package/dist/core/compact/compact-prompts.js +90 -0
  38. package/dist/core/compact/compact-prompts.js.map +1 -0
  39. package/dist/core/compact/context-tracker.d.ts +28 -0
  40. package/dist/core/compact/context-tracker.d.ts.map +1 -0
  41. package/dist/core/compact/context-tracker.js +71 -0
  42. package/dist/core/compact/context-tracker.js.map +1 -0
  43. package/dist/core/compact/index.d.ts +4 -0
  44. package/dist/core/compact/index.d.ts.map +1 -0
  45. package/dist/core/compact/index.js +4 -0
  46. package/dist/core/compact/index.js.map +1 -0
  47. package/dist/core/config/config-manager.d.ts +43 -0
  48. package/dist/core/config/config-manager.d.ts.map +1 -0
  49. package/dist/core/config/config-manager.js +254 -0
  50. package/dist/core/config/config-manager.js.map +1 -0
  51. package/dist/core/config/index.d.ts +2 -0
  52. package/dist/core/config/index.d.ts.map +1 -0
  53. package/dist/core/config/index.js +2 -0
  54. package/dist/core/config/index.js.map +1 -0
  55. package/dist/core/docs-manager.d.ts +46 -0
  56. package/dist/core/docs-manager.d.ts.map +1 -0
  57. package/dist/core/docs-manager.js +475 -0
  58. package/dist/core/docs-manager.js.map +1 -0
  59. package/dist/core/llm/index.d.ts +2 -0
  60. package/dist/core/llm/index.d.ts.map +1 -0
  61. package/dist/core/llm/index.js +2 -0
  62. package/dist/core/llm/index.js.map +1 -0
  63. package/dist/core/llm/llm-client.d.ts +98 -0
  64. package/dist/core/llm/llm-client.d.ts.map +1 -0
  65. package/dist/core/llm/llm-client.js +1024 -0
  66. package/dist/core/llm/llm-client.js.map +1 -0
  67. package/dist/core/s3-auto-updater.d.ts +44 -0
  68. package/dist/core/s3-auto-updater.d.ts.map +1 -0
  69. package/dist/core/s3-auto-updater.js +158 -0
  70. package/dist/core/s3-auto-updater.js.map +1 -0
  71. package/dist/core/session/index.d.ts +2 -0
  72. package/dist/core/session/index.d.ts.map +1 -0
  73. package/dist/core/session/index.js +2 -0
  74. package/dist/core/session/index.js.map +1 -0
  75. package/dist/core/session/session-manager.d.ts +71 -0
  76. package/dist/core/session/session-manager.d.ts.map +1 -0
  77. package/dist/core/session/session-manager.js +250 -0
  78. package/dist/core/session/session-manager.js.map +1 -0
  79. package/dist/core/slash-command-handler.d.ts +32 -0
  80. package/dist/core/slash-command-handler.d.ts.map +1 -0
  81. package/dist/core/slash-command-handler.js +455 -0
  82. package/dist/core/slash-command-handler.js.map +1 -0
  83. package/dist/core/usage-tracker.d.ts +74 -0
  84. package/dist/core/usage-tracker.d.ts.map +1 -0
  85. package/dist/core/usage-tracker.js +279 -0
  86. package/dist/core/usage-tracker.js.map +1 -0
  87. package/dist/errors/base.d.ts +22 -0
  88. package/dist/errors/base.d.ts.map +1 -0
  89. package/dist/errors/base.js +43 -0
  90. package/dist/errors/base.js.map +1 -0
  91. package/dist/errors/file.d.ts +31 -0
  92. package/dist/errors/file.d.ts.map +1 -0
  93. package/dist/errors/file.js +110 -0
  94. package/dist/errors/file.js.map +1 -0
  95. package/dist/errors/index.d.ts +12 -0
  96. package/dist/errors/index.d.ts.map +1 -0
  97. package/dist/errors/index.js +42 -0
  98. package/dist/errors/index.js.map +1 -0
  99. package/dist/errors/llm.d.ts +26 -0
  100. package/dist/errors/llm.d.ts.map +1 -0
  101. package/dist/errors/llm.js +86 -0
  102. package/dist/errors/llm.js.map +1 -0
  103. package/dist/errors/network.d.ts +19 -0
  104. package/dist/errors/network.d.ts.map +1 -0
  105. package/dist/errors/network.js +82 -0
  106. package/dist/errors/network.js.map +1 -0
  107. package/dist/errors/quota.d.ts +25 -0
  108. package/dist/errors/quota.d.ts.map +1 -0
  109. package/dist/errors/quota.js +10 -0
  110. package/dist/errors/quota.js.map +1 -0
  111. package/dist/errors/validation.d.ts +19 -0
  112. package/dist/errors/validation.d.ts.map +1 -0
  113. package/dist/errors/validation.js +62 -0
  114. package/dist/errors/validation.js.map +1 -0
  115. package/dist/eval/eval-runner.d.ts +24 -0
  116. package/dist/eval/eval-runner.d.ts.map +1 -0
  117. package/dist/eval/eval-runner.js +291 -0
  118. package/dist/eval/eval-runner.js.map +1 -0
  119. package/dist/eval/index.d.ts +3 -0
  120. package/dist/eval/index.d.ts.map +1 -0
  121. package/dist/eval/index.js +3 -0
  122. package/dist/eval/index.js.map +1 -0
  123. package/dist/eval/types.d.ts +77 -0
  124. package/dist/eval/types.d.ts.map +1 -0
  125. package/dist/eval/types.js +2 -0
  126. package/dist/eval/types.js.map +1 -0
  127. package/dist/index.d.ts +4 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +6 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/orchestration/index.d.ts +4 -0
  132. package/dist/orchestration/index.d.ts.map +1 -0
  133. package/dist/orchestration/index.js +3 -0
  134. package/dist/orchestration/index.js.map +1 -0
  135. package/dist/orchestration/plan-executor.d.ts +28 -0
  136. package/dist/orchestration/plan-executor.d.ts.map +1 -0
  137. package/dist/orchestration/plan-executor.js +376 -0
  138. package/dist/orchestration/plan-executor.js.map +1 -0
  139. package/dist/orchestration/types.d.ts +65 -0
  140. package/dist/orchestration/types.d.ts.map +1 -0
  141. package/dist/orchestration/types.js +2 -0
  142. package/dist/orchestration/types.js.map +1 -0
  143. package/dist/orchestration/utils.d.ts +13 -0
  144. package/dist/orchestration/utils.d.ts.map +1 -0
  145. package/dist/orchestration/utils.js +81 -0
  146. package/dist/orchestration/utils.js.map +1 -0
  147. package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
  148. package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
  149. package/dist/prompts/agents/docs-search-decision.js +46 -0
  150. package/dist/prompts/agents/docs-search-decision.js.map +1 -0
  151. package/dist/prompts/agents/docs-search.d.ts +4 -0
  152. package/dist/prompts/agents/docs-search.d.ts.map +1 -0
  153. package/dist/prompts/agents/docs-search.js +70 -0
  154. package/dist/prompts/agents/docs-search.js.map +1 -0
  155. package/dist/prompts/agents/planning.d.ts +4 -0
  156. package/dist/prompts/agents/planning.d.ts.map +1 -0
  157. package/dist/prompts/agents/planning.js +179 -0
  158. package/dist/prompts/agents/planning.js.map +1 -0
  159. package/dist/prompts/index.d.ts +10 -0
  160. package/dist/prompts/index.d.ts.map +1 -0
  161. package/dist/prompts/index.js +10 -0
  162. package/dist/prompts/index.js.map +1 -0
  163. package/dist/prompts/shared/codebase-rules.d.ts +4 -0
  164. package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
  165. package/dist/prompts/shared/codebase-rules.js +16 -0
  166. package/dist/prompts/shared/codebase-rules.js.map +1 -0
  167. package/dist/prompts/shared/git-rules.d.ts +2 -0
  168. package/dist/prompts/shared/git-rules.d.ts.map +1 -0
  169. package/dist/prompts/shared/git-rules.js +87 -0
  170. package/dist/prompts/shared/git-rules.js.map +1 -0
  171. package/dist/prompts/shared/language-rules.d.ts +4 -0
  172. package/dist/prompts/shared/language-rules.d.ts.map +1 -0
  173. package/dist/prompts/shared/language-rules.js +22 -0
  174. package/dist/prompts/shared/language-rules.js.map +1 -0
  175. package/dist/prompts/shared/tool-usage.d.ts +12 -0
  176. package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
  177. package/dist/prompts/shared/tool-usage.js +51 -0
  178. package/dist/prompts/shared/tool-usage.js.map +1 -0
  179. package/dist/prompts/system/compact.d.ts +3 -0
  180. package/dist/prompts/system/compact.d.ts.map +1 -0
  181. package/dist/prompts/system/compact.js +73 -0
  182. package/dist/prompts/system/compact.js.map +1 -0
  183. package/dist/prompts/system/plan-execute.d.ts +3 -0
  184. package/dist/prompts/system/plan-execute.d.ts.map +1 -0
  185. package/dist/prompts/system/plan-execute.js +119 -0
  186. package/dist/prompts/system/plan-execute.js.map +1 -0
  187. package/dist/tools/browser/browser-client.d.ts +119 -0
  188. package/dist/tools/browser/browser-client.d.ts.map +1 -0
  189. package/dist/tools/browser/browser-client.js +1083 -0
  190. package/dist/tools/browser/browser-client.js.map +1 -0
  191. package/dist/tools/browser/browser-tools.d.ts +23 -0
  192. package/dist/tools/browser/browser-tools.d.ts.map +1 -0
  193. package/dist/tools/browser/browser-tools.js +1347 -0
  194. package/dist/tools/browser/browser-tools.js.map +1 -0
  195. package/dist/tools/browser/index.d.ts +7 -0
  196. package/dist/tools/browser/index.d.ts.map +1 -0
  197. package/dist/tools/browser/index.js +17 -0
  198. package/dist/tools/browser/index.js.map +1 -0
  199. package/dist/tools/index.d.ts +4 -0
  200. package/dist/tools/index.d.ts.map +1 -0
  201. package/dist/tools/index.js +4 -0
  202. package/dist/tools/index.js.map +1 -0
  203. package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
  204. package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
  205. package/dist/tools/llm/agents/docs-search-tools.js +265 -0
  206. package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
  207. package/dist/tools/llm/agents/index.d.ts +4 -0
  208. package/dist/tools/llm/agents/index.d.ts.map +1 -0
  209. package/dist/tools/llm/agents/index.js +3 -0
  210. package/dist/tools/llm/agents/index.js.map +1 -0
  211. package/dist/tools/llm/index.d.ts +3 -0
  212. package/dist/tools/llm/index.d.ts.map +1 -0
  213. package/dist/tools/llm/index.js +3 -0
  214. package/dist/tools/llm/index.js.map +1 -0
  215. package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
  216. package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
  217. package/dist/tools/llm/simple/ask-user-tool.js +7 -0
  218. package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
  219. package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
  220. package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
  221. package/dist/tools/llm/simple/background-bash-tool.js +320 -0
  222. package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
  223. package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
  224. package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
  225. package/dist/tools/llm/simple/background-powershell-tool.js +302 -0
  226. package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
  227. package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
  228. package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
  229. package/dist/tools/llm/simple/bash-tool.js +167 -0
  230. package/dist/tools/llm/simple/bash-tool.js.map +1 -0
  231. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
  232. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
  233. package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
  234. package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
  235. package/dist/tools/llm/simple/file-tools.d.ts +13 -0
  236. package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
  237. package/dist/tools/llm/simple/file-tools.js +751 -0
  238. package/dist/tools/llm/simple/file-tools.js.map +1 -0
  239. package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
  240. package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
  241. package/dist/tools/llm/simple/final-response-tool.js +107 -0
  242. package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
  243. package/dist/tools/llm/simple/index.d.ts +11 -0
  244. package/dist/tools/llm/simple/index.d.ts.map +1 -0
  245. package/dist/tools/llm/simple/index.js +20 -0
  246. package/dist/tools/llm/simple/index.js.map +1 -0
  247. package/dist/tools/llm/simple/planning-tools.d.ts +6 -0
  248. package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
  249. package/dist/tools/llm/simple/planning-tools.js +171 -0
  250. package/dist/tools/llm/simple/planning-tools.js.map +1 -0
  251. package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
  252. package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
  253. package/dist/tools/llm/simple/powershell-tool.js +150 -0
  254. package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
  255. package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
  256. package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
  257. package/dist/tools/llm/simple/simple-tool-executor.js +134 -0
  258. package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
  259. package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
  260. package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
  261. package/dist/tools/llm/simple/todo-tools.js +145 -0
  262. package/dist/tools/llm/simple/todo-tools.js.map +1 -0
  263. package/dist/tools/llm/simple/user-interaction-tools.d.ts +22 -0
  264. package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
  265. package/dist/tools/llm/simple/user-interaction-tools.js +168 -0
  266. package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
  267. package/dist/tools/office/common/constants.d.ts +194 -0
  268. package/dist/tools/office/common/constants.d.ts.map +1 -0
  269. package/dist/tools/office/common/constants.js +169 -0
  270. package/dist/tools/office/common/constants.js.map +1 -0
  271. package/dist/tools/office/common/index.d.ts +4 -0
  272. package/dist/tools/office/common/index.d.ts.map +1 -0
  273. package/dist/tools/office/common/index.js +3 -0
  274. package/dist/tools/office/common/index.js.map +1 -0
  275. package/dist/tools/office/common/types.d.ts +82 -0
  276. package/dist/tools/office/common/types.d.ts.map +1 -0
  277. package/dist/tools/office/common/types.js +2 -0
  278. package/dist/tools/office/common/types.js.map +1 -0
  279. package/dist/tools/office/common/utils.d.ts +14 -0
  280. package/dist/tools/office/common/utils.d.ts.map +1 -0
  281. package/dist/tools/office/common/utils.js +58 -0
  282. package/dist/tools/office/common/utils.js.map +1 -0
  283. package/dist/tools/office/excel-client.d.ts +212 -0
  284. package/dist/tools/office/excel-client.d.ts.map +1 -0
  285. package/dist/tools/office/excel-client.js +2242 -0
  286. package/dist/tools/office/excel-client.js.map +1 -0
  287. package/dist/tools/office/excel-tools/advanced.d.ts +13 -0
  288. package/dist/tools/office/excel-tools/advanced.d.ts.map +1 -0
  289. package/dist/tools/office/excel-tools/advanced.js +364 -0
  290. package/dist/tools/office/excel-tools/advanced.js.map +1 -0
  291. package/dist/tools/office/excel-tools/cells.d.ts +10 -0
  292. package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
  293. package/dist/tools/office/excel-tools/cells.js +279 -0
  294. package/dist/tools/office/excel-tools/cells.js.map +1 -0
  295. package/dist/tools/office/excel-tools/charts.d.ts +12 -0
  296. package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
  297. package/dist/tools/office/excel-tools/charts.js +373 -0
  298. package/dist/tools/office/excel-tools/charts.js.map +1 -0
  299. package/dist/tools/office/excel-tools/comments.d.ts +7 -0
  300. package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
  301. package/dist/tools/office/excel-tools/comments.js +150 -0
  302. package/dist/tools/office/excel-tools/comments.js.map +1 -0
  303. package/dist/tools/office/excel-tools/data-ops.d.ts +14 -0
  304. package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
  305. package/dist/tools/office/excel-tools/data-ops.js +420 -0
  306. package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
  307. package/dist/tools/office/excel-tools/export.d.ts +8 -0
  308. package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
  309. package/dist/tools/office/excel-tools/export.js +191 -0
  310. package/dist/tools/office/excel-tools/export.js.map +1 -0
  311. package/dist/tools/office/excel-tools/formatting.d.ts +12 -0
  312. package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
  313. package/dist/tools/office/excel-tools/formatting.js +350 -0
  314. package/dist/tools/office/excel-tools/formatting.js.map +1 -0
  315. package/dist/tools/office/excel-tools/formulas.d.ts +11 -0
  316. package/dist/tools/office/excel-tools/formulas.d.ts.map +1 -0
  317. package/dist/tools/office/excel-tools/formulas.js +313 -0
  318. package/dist/tools/office/excel-tools/formulas.js.map +1 -0
  319. package/dist/tools/office/excel-tools/index.d.ts +21 -0
  320. package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
  321. package/dist/tools/office/excel-tools/index.js +57 -0
  322. package/dist/tools/office/excel-tools/index.js.map +1 -0
  323. package/dist/tools/office/excel-tools/launch.d.ts +10 -0
  324. package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
  325. package/dist/tools/office/excel-tools/launch.js +248 -0
  326. package/dist/tools/office/excel-tools/launch.js.map +1 -0
  327. package/dist/tools/office/excel-tools/media.d.ts +10 -0
  328. package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
  329. package/dist/tools/office/excel-tools/media.js +260 -0
  330. package/dist/tools/office/excel-tools/media.js.map +1 -0
  331. package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
  332. package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
  333. package/dist/tools/office/excel-tools/named-ranges.js +113 -0
  334. package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
  335. package/dist/tools/office/excel-tools/page-setup.d.ts +6 -0
  336. package/dist/tools/office/excel-tools/page-setup.d.ts.map +1 -0
  337. package/dist/tools/office/excel-tools/page-setup.js +144 -0
  338. package/dist/tools/office/excel-tools/page-setup.js.map +1 -0
  339. package/dist/tools/office/excel-tools/pivot-table.d.ts +7 -0
  340. package/dist/tools/office/excel-tools/pivot-table.d.ts.map +1 -0
  341. package/dist/tools/office/excel-tools/pivot-table.js +151 -0
  342. package/dist/tools/office/excel-tools/pivot-table.js.map +1 -0
  343. package/dist/tools/office/excel-tools/protection.d.ts +5 -0
  344. package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
  345. package/dist/tools/office/excel-tools/protection.js +75 -0
  346. package/dist/tools/office/excel-tools/protection.js.map +1 -0
  347. package/dist/tools/office/excel-tools/rows-columns.d.ts +15 -0
  348. package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
  349. package/dist/tools/office/excel-tools/rows-columns.js +440 -0
  350. package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
  351. package/dist/tools/office/excel-tools/sheets.d.ts +16 -0
  352. package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
  353. package/dist/tools/office/excel-tools/sheets.js +465 -0
  354. package/dist/tools/office/excel-tools/sheets.js.map +1 -0
  355. package/dist/tools/office/excel-tools/tables.d.ts +7 -0
  356. package/dist/tools/office/excel-tools/tables.d.ts.map +1 -0
  357. package/dist/tools/office/excel-tools/tables.js +151 -0
  358. package/dist/tools/office/excel-tools/tables.js.map +1 -0
  359. package/dist/tools/office/excel-tools/validation.d.ts +7 -0
  360. package/dist/tools/office/excel-tools/validation.d.ts.map +1 -0
  361. package/dist/tools/office/excel-tools/validation.js +175 -0
  362. package/dist/tools/office/excel-tools/validation.js.map +1 -0
  363. package/dist/tools/office/excel-tools.d.ts +3 -0
  364. package/dist/tools/office/excel-tools.d.ts.map +1 -0
  365. package/dist/tools/office/excel-tools.js +3 -0
  366. package/dist/tools/office/excel-tools.js.map +1 -0
  367. package/dist/tools/office/index.d.ts +6 -0
  368. package/dist/tools/office/index.d.ts.map +1 -0
  369. package/dist/tools/office/index.js +9 -0
  370. package/dist/tools/office/index.js.map +1 -0
  371. package/dist/tools/office/office-client-base.d.ts +31 -0
  372. package/dist/tools/office/office-client-base.d.ts.map +1 -0
  373. package/dist/tools/office/office-client-base.js +154 -0
  374. package/dist/tools/office/office-client-base.js.map +1 -0
  375. package/dist/tools/office/office-client.d.ts +196 -0
  376. package/dist/tools/office/office-client.d.ts.map +1 -0
  377. package/dist/tools/office/office-client.js +200 -0
  378. package/dist/tools/office/office-client.js.map +1 -0
  379. package/dist/tools/office/powerpoint-client.d.ts +155 -0
  380. package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
  381. package/dist/tools/office/powerpoint-client.js +1359 -0
  382. package/dist/tools/office/powerpoint-client.js.map +1 -0
  383. package/dist/tools/office/powerpoint-tools/effects.d.ts +9 -0
  384. package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -0
  385. package/dist/tools/office/powerpoint-tools/effects.js +259 -0
  386. package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
  387. package/dist/tools/office/powerpoint-tools/export.d.ts +7 -0
  388. package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
  389. package/dist/tools/office/powerpoint-tools/export.js +151 -0
  390. package/dist/tools/office/powerpoint-tools/export.js.map +1 -0
  391. package/dist/tools/office/powerpoint-tools/index.d.ts +13 -0
  392. package/dist/tools/office/powerpoint-tools/index.d.ts.map +1 -0
  393. package/dist/tools/office/powerpoint-tools/index.js +33 -0
  394. package/dist/tools/office/powerpoint-tools/index.js.map +1 -0
  395. package/dist/tools/office/powerpoint-tools/launch.d.ts +9 -0
  396. package/dist/tools/office/powerpoint-tools/launch.d.ts.map +1 -0
  397. package/dist/tools/office/powerpoint-tools/launch.js +214 -0
  398. package/dist/tools/office/powerpoint-tools/launch.js.map +1 -0
  399. package/dist/tools/office/powerpoint-tools/media.d.ts +8 -0
  400. package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -0
  401. package/dist/tools/office/powerpoint-tools/media.js +221 -0
  402. package/dist/tools/office/powerpoint-tools/media.js.map +1 -0
  403. package/dist/tools/office/powerpoint-tools/notes.d.ts +8 -0
  404. package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -0
  405. package/dist/tools/office/powerpoint-tools/notes.js +181 -0
  406. package/dist/tools/office/powerpoint-tools/notes.js.map +1 -0
  407. package/dist/tools/office/powerpoint-tools/sections.d.ts +6 -0
  408. package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -0
  409. package/dist/tools/office/powerpoint-tools/sections.js +111 -0
  410. package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
  411. package/dist/tools/office/powerpoint-tools/shapes.d.ts +24 -0
  412. package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
  413. package/dist/tools/office/powerpoint-tools/shapes.js +817 -0
  414. package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
  415. package/dist/tools/office/powerpoint-tools/slides.d.ts +15 -0
  416. package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
  417. package/dist/tools/office/powerpoint-tools/slides.js +447 -0
  418. package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
  419. package/dist/tools/office/powerpoint-tools/tables.d.ts +12 -0
  420. package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
  421. package/dist/tools/office/powerpoint-tools/tables.js +362 -0
  422. package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
  423. package/dist/tools/office/powerpoint-tools/text.d.ts +13 -0
  424. package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
  425. package/dist/tools/office/powerpoint-tools/text.js +428 -0
  426. package/dist/tools/office/powerpoint-tools/text.js.map +1 -0
  427. package/dist/tools/office/powerpoint-tools.d.ts +3 -0
  428. package/dist/tools/office/powerpoint-tools.d.ts.map +1 -0
  429. package/dist/tools/office/powerpoint-tools.js +3 -0
  430. package/dist/tools/office/powerpoint-tools.js.map +1 -0
  431. package/dist/tools/office/word-client.d.ts +147 -0
  432. package/dist/tools/office/word-client.d.ts.map +1 -0
  433. package/dist/tools/office/word-client.js +1341 -0
  434. package/dist/tools/office/word-client.js.map +1 -0
  435. package/dist/tools/office/word-tools/bookmarks.d.ts +7 -0
  436. package/dist/tools/office/word-tools/bookmarks.d.ts.map +1 -0
  437. package/dist/tools/office/word-tools/bookmarks.js +146 -0
  438. package/dist/tools/office/word-tools/bookmarks.js.map +1 -0
  439. package/dist/tools/office/word-tools/comments.d.ts +7 -0
  440. package/dist/tools/office/word-tools/comments.d.ts.map +1 -0
  441. package/dist/tools/office/word-tools/comments.js +146 -0
  442. package/dist/tools/office/word-tools/comments.js.map +1 -0
  443. package/dist/tools/office/word-tools/content.d.ts +7 -0
  444. package/dist/tools/office/word-tools/content.d.ts.map +1 -0
  445. package/dist/tools/office/word-tools/content.js +168 -0
  446. package/dist/tools/office/word-tools/content.js.map +1 -0
  447. package/dist/tools/office/word-tools/export.d.ts +5 -0
  448. package/dist/tools/office/word-tools/export.d.ts.map +1 -0
  449. package/dist/tools/office/word-tools/export.js +73 -0
  450. package/dist/tools/office/word-tools/export.js.map +1 -0
  451. package/dist/tools/office/word-tools/find.d.ts +5 -0
  452. package/dist/tools/office/word-tools/find.d.ts.map +1 -0
  453. package/dist/tools/office/word-tools/find.js +106 -0
  454. package/dist/tools/office/word-tools/find.js.map +1 -0
  455. package/dist/tools/office/word-tools/footnotes.d.ts +9 -0
  456. package/dist/tools/office/word-tools/footnotes.d.ts.map +1 -0
  457. package/dist/tools/office/word-tools/footnotes.js +227 -0
  458. package/dist/tools/office/word-tools/footnotes.js.map +1 -0
  459. package/dist/tools/office/word-tools/formatting.d.ts +6 -0
  460. package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
  461. package/dist/tools/office/word-tools/formatting.js +129 -0
  462. package/dist/tools/office/word-tools/formatting.js.map +1 -0
  463. package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
  464. package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
  465. package/dist/tools/office/word-tools/headers-footers.js +117 -0
  466. package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
  467. package/dist/tools/office/word-tools/index.d.ts +22 -0
  468. package/dist/tools/office/word-tools/index.d.ts.map +1 -0
  469. package/dist/tools/office/word-tools/index.js +63 -0
  470. package/dist/tools/office/word-tools/index.js.map +1 -0
  471. package/dist/tools/office/word-tools/launch.d.ts +10 -0
  472. package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
  473. package/dist/tools/office/word-tools/launch.js +255 -0
  474. package/dist/tools/office/word-tools/launch.js.map +1 -0
  475. package/dist/tools/office/word-tools/lists.d.ts +5 -0
  476. package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
  477. package/dist/tools/office/word-tools/lists.js +73 -0
  478. package/dist/tools/office/word-tools/lists.js.map +1 -0
  479. package/dist/tools/office/word-tools/navigation.d.ts +5 -0
  480. package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
  481. package/dist/tools/office/word-tools/navigation.js +85 -0
  482. package/dist/tools/office/word-tools/navigation.js.map +1 -0
  483. package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
  484. package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
  485. package/dist/tools/office/word-tools/page-setup.js +152 -0
  486. package/dist/tools/office/word-tools/page-setup.js.map +1 -0
  487. package/dist/tools/office/word-tools/selection.d.ts +8 -0
  488. package/dist/tools/office/word-tools/selection.d.ts.map +1 -0
  489. package/dist/tools/office/word-tools/selection.js +193 -0
  490. package/dist/tools/office/word-tools/selection.js.map +1 -0
  491. package/dist/tools/office/word-tools/tables-advanced.d.ts +8 -0
  492. package/dist/tools/office/word-tools/tables-advanced.d.ts.map +1 -0
  493. package/dist/tools/office/word-tools/tables-advanced.js +190 -0
  494. package/dist/tools/office/word-tools/tables-advanced.js.map +1 -0
  495. package/dist/tools/office/word-tools/tables.d.ts +8 -0
  496. package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
  497. package/dist/tools/office/word-tools/tables.js +197 -0
  498. package/dist/tools/office/word-tools/tables.js.map +1 -0
  499. package/dist/tools/office/word-tools/text.d.ts +9 -0
  500. package/dist/tools/office/word-tools/text.d.ts.map +1 -0
  501. package/dist/tools/office/word-tools/text.js +235 -0
  502. package/dist/tools/office/word-tools/text.js.map +1 -0
  503. package/dist/tools/office/word-tools/toc.d.ts +6 -0
  504. package/dist/tools/office/word-tools/toc.d.ts.map +1 -0
  505. package/dist/tools/office/word-tools/toc.js +114 -0
  506. package/dist/tools/office/word-tools/toc.js.map +1 -0
  507. package/dist/tools/office/word-tools/track-changes.d.ts +8 -0
  508. package/dist/tools/office/word-tools/track-changes.d.ts.map +1 -0
  509. package/dist/tools/office/word-tools/track-changes.js +195 -0
  510. package/dist/tools/office/word-tools/track-changes.js.map +1 -0
  511. package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
  512. package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
  513. package/dist/tools/office/word-tools/undo-redo.js +73 -0
  514. package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
  515. package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
  516. package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
  517. package/dist/tools/office/word-tools/watermarks.js +81 -0
  518. package/dist/tools/office/word-tools/watermarks.js.map +1 -0
  519. package/dist/tools/office/word-tools.d.ts +3 -0
  520. package/dist/tools/office/word-tools.d.ts.map +1 -0
  521. package/dist/tools/office/word-tools.js +3 -0
  522. package/dist/tools/office/word-tools.js.map +1 -0
  523. package/dist/tools/registry.d.ts +53 -0
  524. package/dist/tools/registry.d.ts.map +1 -0
  525. package/dist/tools/registry.js +282 -0
  526. package/dist/tools/registry.js.map +1 -0
  527. package/dist/tools/types.d.ts +88 -0
  528. package/dist/tools/types.d.ts.map +1 -0
  529. package/dist/tools/types.js +19 -0
  530. package/dist/tools/types.js.map +1 -0
  531. package/dist/types/index.d.ts +123 -0
  532. package/dist/types/index.d.ts.map +1 -0
  533. package/dist/types/index.js +2 -0
  534. package/dist/types/index.js.map +1 -0
  535. package/dist/ui/PlanExecuteView.d.ts +11 -0
  536. package/dist/ui/PlanExecuteView.d.ts.map +1 -0
  537. package/dist/ui/PlanExecuteView.js +27 -0
  538. package/dist/ui/PlanExecuteView.js.map +1 -0
  539. package/dist/ui/TodoPanel.d.ts +13 -0
  540. package/dist/ui/TodoPanel.d.ts.map +1 -0
  541. package/dist/ui/TodoPanel.js +135 -0
  542. package/dist/ui/TodoPanel.js.map +1 -0
  543. package/dist/ui/UpdateNotification.d.ts +13 -0
  544. package/dist/ui/UpdateNotification.d.ts.map +1 -0
  545. package/dist/ui/UpdateNotification.js +42 -0
  546. package/dist/ui/UpdateNotification.js.map +1 -0
  547. package/dist/ui/components/ActivityIndicator.d.ts +25 -0
  548. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
  549. package/dist/ui/components/ActivityIndicator.js +115 -0
  550. package/dist/ui/components/ActivityIndicator.js.map +1 -0
  551. package/dist/ui/components/CommandBrowser.d.ts +10 -0
  552. package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
  553. package/dist/ui/components/CommandBrowser.js +53 -0
  554. package/dist/ui/components/CommandBrowser.js.map +1 -0
  555. package/dist/ui/components/CustomTextInput.d.ts +13 -0
  556. package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
  557. package/dist/ui/components/CustomTextInput.js +245 -0
  558. package/dist/ui/components/CustomTextInput.js.map +1 -0
  559. package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
  560. package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
  561. package/dist/ui/components/DocsSearchProgress.js +37 -0
  562. package/dist/ui/components/DocsSearchProgress.js.map +1 -0
  563. package/dist/ui/components/FileBrowser.d.ts +11 -0
  564. package/dist/ui/components/FileBrowser.d.ts.map +1 -0
  565. package/dist/ui/components/FileBrowser.js +45 -0
  566. package/dist/ui/components/FileBrowser.js.map +1 -0
  567. package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
  568. package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
  569. package/dist/ui/components/LLMSetupWizard.js +183 -0
  570. package/dist/ui/components/LLMSetupWizard.js.map +1 -0
  571. package/dist/ui/components/Logo.d.ts +21 -0
  572. package/dist/ui/components/Logo.d.ts.map +1 -0
  573. package/dist/ui/components/Logo.js +110 -0
  574. package/dist/ui/components/Logo.js.map +1 -0
  575. package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
  576. package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
  577. package/dist/ui/components/MarkdownRenderer.js +198 -0
  578. package/dist/ui/components/MarkdownRenderer.js.map +1 -0
  579. package/dist/ui/components/ModelSelector.d.ts +8 -0
  580. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  581. package/dist/ui/components/ModelSelector.js +111 -0
  582. package/dist/ui/components/ModelSelector.js.map +1 -0
  583. package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
  584. package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
  585. package/dist/ui/components/PlanExecuteApp.js +1433 -0
  586. package/dist/ui/components/PlanExecuteApp.js.map +1 -0
  587. package/dist/ui/components/ProgressBar.d.ts +10 -0
  588. package/dist/ui/components/ProgressBar.d.ts.map +1 -0
  589. package/dist/ui/components/ProgressBar.js +26 -0
  590. package/dist/ui/components/ProgressBar.js.map +1 -0
  591. package/dist/ui/components/StatusBar.d.ts +23 -0
  592. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  593. package/dist/ui/components/StatusBar.js +162 -0
  594. package/dist/ui/components/StatusBar.js.map +1 -0
  595. package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
  596. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  597. package/dist/ui/components/ThinkingIndicator.js +63 -0
  598. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  599. package/dist/ui/components/TodoListView.d.ts +11 -0
  600. package/dist/ui/components/TodoListView.d.ts.map +1 -0
  601. package/dist/ui/components/TodoListView.js +69 -0
  602. package/dist/ui/components/TodoListView.js.map +1 -0
  603. package/dist/ui/components/ToolSelector.d.ts +7 -0
  604. package/dist/ui/components/ToolSelector.d.ts.map +1 -0
  605. package/dist/ui/components/ToolSelector.js +112 -0
  606. package/dist/ui/components/ToolSelector.js.map +1 -0
  607. package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
  608. package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
  609. package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
  610. package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
  611. package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
  612. package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
  613. package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
  614. package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
  615. package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
  616. package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
  617. package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
  618. package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
  619. package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
  620. package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
  621. package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
  622. package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
  623. package/dist/ui/components/dialogs/index.d.ts +4 -0
  624. package/dist/ui/components/dialogs/index.d.ts.map +1 -0
  625. package/dist/ui/components/dialogs/index.js +4 -0
  626. package/dist/ui/components/dialogs/index.js.map +1 -0
  627. package/dist/ui/components/index.d.ts +12 -0
  628. package/dist/ui/components/index.d.ts.map +1 -0
  629. package/dist/ui/components/index.js +9 -0
  630. package/dist/ui/components/index.js.map +1 -0
  631. package/dist/ui/components/panels/LogPanel.d.ts +7 -0
  632. package/dist/ui/components/panels/LogPanel.d.ts.map +1 -0
  633. package/dist/ui/components/panels/LogPanel.js +280 -0
  634. package/dist/ui/components/panels/LogPanel.js.map +1 -0
  635. package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
  636. package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
  637. package/dist/ui/components/panels/SessionPanel.js +81 -0
  638. package/dist/ui/components/panels/SessionPanel.js.map +1 -0
  639. package/dist/ui/components/panels/index.d.ts +4 -0
  640. package/dist/ui/components/panels/index.d.ts.map +1 -0
  641. package/dist/ui/components/panels/index.js +4 -0
  642. package/dist/ui/components/panels/index.js.map +1 -0
  643. package/dist/ui/components/views/ChatView.d.ts +12 -0
  644. package/dist/ui/components/views/ChatView.d.ts.map +1 -0
  645. package/dist/ui/components/views/ChatView.js +289 -0
  646. package/dist/ui/components/views/ChatView.js.map +1 -0
  647. package/dist/ui/components/views/index.d.ts +2 -0
  648. package/dist/ui/components/views/index.d.ts.map +1 -0
  649. package/dist/ui/components/views/index.js +2 -0
  650. package/dist/ui/components/views/index.js.map +1 -0
  651. package/dist/ui/contexts/TokenContext.d.ts +29 -0
  652. package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
  653. package/dist/ui/contexts/TokenContext.js +79 -0
  654. package/dist/ui/contexts/TokenContext.js.map +1 -0
  655. package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
  656. package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
  657. package/dist/ui/hooks/atFileProcessor.js +88 -0
  658. package/dist/ui/hooks/atFileProcessor.js.map +1 -0
  659. package/dist/ui/hooks/index.d.ts +8 -0
  660. package/dist/ui/hooks/index.d.ts.map +1 -0
  661. package/dist/ui/hooks/index.js +8 -0
  662. package/dist/ui/hooks/index.js.map +1 -0
  663. package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
  664. package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
  665. package/dist/ui/hooks/slashCommandProcessor.js +100 -0
  666. package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
  667. package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
  668. package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
  669. package/dist/ui/hooks/useCommandBrowserState.js +66 -0
  670. package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
  671. package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
  672. package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
  673. package/dist/ui/hooks/useFileBrowserState.js +80 -0
  674. package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
  675. package/dist/ui/hooks/useFileList.d.ts +20 -0
  676. package/dist/ui/hooks/useFileList.d.ts.map +1 -0
  677. package/dist/ui/hooks/useFileList.js +57 -0
  678. package/dist/ui/hooks/useFileList.js.map +1 -0
  679. package/dist/ui/hooks/useInputHistory.d.ts +9 -0
  680. package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
  681. package/dist/ui/hooks/useInputHistory.js +68 -0
  682. package/dist/ui/hooks/useInputHistory.js.map +1 -0
  683. package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
  684. package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
  685. package/dist/ui/hooks/usePlanExecution.js +208 -0
  686. package/dist/ui/hooks/usePlanExecution.js.map +1 -0
  687. package/dist/ui/index.d.ts +7 -0
  688. package/dist/ui/index.d.ts.map +1 -0
  689. package/dist/ui/index.js +7 -0
  690. package/dist/ui/index.js.map +1 -0
  691. package/dist/ui/ink-entry.d.ts +3 -0
  692. package/dist/ui/ink-entry.d.ts.map +1 -0
  693. package/dist/ui/ink-entry.js +22 -0
  694. package/dist/ui/ink-entry.js.map +1 -0
  695. package/dist/utils/file-system.d.ts +9 -0
  696. package/dist/utils/file-system.d.ts.map +1 -0
  697. package/dist/utils/file-system.js +99 -0
  698. package/dist/utils/file-system.js.map +1 -0
  699. package/dist/utils/git-utils.d.ts +2 -0
  700. package/dist/utils/git-utils.d.ts.map +1 -0
  701. package/dist/utils/git-utils.js +16 -0
  702. package/dist/utils/git-utils.js.map +1 -0
  703. package/dist/utils/json-stream-logger.d.ts +74 -0
  704. package/dist/utils/json-stream-logger.d.ts.map +1 -0
  705. package/dist/utils/json-stream-logger.js +808 -0
  706. package/dist/utils/json-stream-logger.js.map +1 -0
  707. package/dist/utils/logger.d.ts +152 -0
  708. package/dist/utils/logger.d.ts.map +1 -0
  709. package/dist/utils/logger.js +1672 -0
  710. package/dist/utils/logger.js.map +1 -0
  711. package/dist/utils/platform-utils.d.ts +19 -0
  712. package/dist/utils/platform-utils.d.ts.map +1 -0
  713. package/dist/utils/platform-utils.js +134 -0
  714. package/dist/utils/platform-utils.js.map +1 -0
  715. package/dist/utils/wsl-utils.d.ts +4 -0
  716. package/dist/utils/wsl-utils.d.ts.map +1 -0
  717. package/dist/utils/wsl-utils.js +72 -0
  718. package/dist/utils/wsl-utils.js.map +1 -0
  719. package/package.json +148 -0
  720. package/scripts/patch-yoga.js +48 -0
@@ -0,0 +1,1341 @@
1
+ import { OfficeClientBase } from './office-client-base.js';
2
+ export class WordClient extends OfficeClientBase {
3
+ async wordLaunch() {
4
+ return this.executePowerShell(`
5
+ try {
6
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
7
+ $word.Visible = $true
8
+ @{ success = $true; message = "Connected to existing Word instance" } | ConvertTo-Json -Compress
9
+ } catch {
10
+ $word = New-Object -ComObject Word.Application
11
+ $word.Visible = $true
12
+ @{ success = $true; message = "Launched new Word instance" } | ConvertTo-Json -Compress
13
+ }
14
+ `);
15
+ }
16
+ async wordCreate() {
17
+ return this.executePowerShell(`
18
+ try {
19
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
20
+ } catch {
21
+ $word = New-Object -ComObject Word.Application
22
+ $word.Visible = $true
23
+ }
24
+ $doc = $word.Documents.Add()
25
+ @{ success = $true; message = "Created new document"; document_name = $doc.Name } | ConvertTo-Json -Compress
26
+ `);
27
+ }
28
+ async wordWrite(text, options) {
29
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
30
+ let fontName = options?.fontName?.replace(/'/g, "''") || '';
31
+ if (!fontName && hasKorean) {
32
+ fontName = 'Malgun Gothic';
33
+ }
34
+ const fontSize = options?.fontSize || 0;
35
+ const bold = options?.bold ? '$true' : '$false';
36
+ const italic = options?.italic ? '$true' : '$false';
37
+ const newParagraph = options?.newParagraph !== false;
38
+ const lines = text.split(/\\n|\n/);
39
+ const typeCommands = lines.map((line, index) => {
40
+ const escapedLine = line.replace(/'/g, "''").replace(/`/g, '``');
41
+ const isLastLine = index === lines.length - 1;
42
+ if (isLastLine && !newParagraph) {
43
+ return `$selection.TypeText('${escapedLine}')`;
44
+ }
45
+ else {
46
+ return `$selection.TypeText('${escapedLine}')\n$selection.TypeParagraph()`;
47
+ }
48
+ }).join('\n');
49
+ return this.executePowerShell(`
50
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
51
+ $selection = $word.Selection
52
+
53
+ # Set formatting options (except font name for Korean)
54
+ ${fontSize ? `$selection.Font.Size = ${fontSize}` : ''}
55
+ $selection.Font.Bold = ${bold}
56
+ $selection.Font.Italic = ${italic}
57
+
58
+ # Type text first
59
+ ${typeCommands}
60
+
61
+ # Set font after text (prevents Korean garbled text)
62
+ ${fontName ? `$selection.Font.Name = '${fontName}'` : ''}
63
+
64
+ @{ success = $true; message = "Text written successfully" } | ConvertTo-Json -Compress
65
+ `);
66
+ }
67
+ async wordRead() {
68
+ return this.executePowerShell(`
69
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
70
+ $doc = $word.ActiveDocument
71
+ $content = $doc.Content.Text
72
+ @{
73
+ success = $true
74
+ document_name = $doc.Name
75
+ content = $content
76
+ character_count = $content.Length
77
+ } | ConvertTo-Json -Compress
78
+ `);
79
+ }
80
+ async wordSave(filePath) {
81
+ const windowsPath = filePath ? this.toWindowsPath(filePath).replace(/'/g, "''") : '';
82
+ return this.executePowerShell(`
83
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
84
+ $doc = $word.ActiveDocument
85
+ ${windowsPath ? `$doc.SaveAs([ref]'${windowsPath}')` : '$doc.Save()'}
86
+ @{ success = $true; message = "Document saved"; path = $doc.FullName } | ConvertTo-Json -Compress
87
+ `);
88
+ }
89
+ async wordOpen(filePath) {
90
+ const windowsPath = this.toWindowsPath(filePath).replace(/'/g, "''");
91
+ return this.executePowerShell(`
92
+ try {
93
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
94
+ } catch {
95
+ $word = New-Object -ComObject Word.Application
96
+ $word.Visible = $true
97
+ }
98
+ $doc = $word.Documents.Open('${windowsPath}')
99
+ @{ success = $true; message = "Document opened"; document_name = $doc.Name; path = $doc.FullName } | ConvertTo-Json -Compress
100
+ `);
101
+ }
102
+ async wordClose(save = false) {
103
+ const saveOption = save ? '-1' : '0';
104
+ return this.executePowerShell(`
105
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
106
+ $word.ActiveDocument.Close(${saveOption})
107
+ @{ success = $true; message = "Document closed" } | ConvertTo-Json -Compress
108
+ `);
109
+ }
110
+ async wordQuit(save = false) {
111
+ const saveOption = save ? '-1' : '0';
112
+ return this.executePowerShell(`
113
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
114
+ $word.Quit(${saveOption})
115
+ @{ success = $true; message = "Word closed" } | ConvertTo-Json -Compress
116
+ `);
117
+ }
118
+ async wordSetFont(options) {
119
+ const commands = [];
120
+ if (options.fontName)
121
+ commands.push(`$selection.Font.Name = '${options.fontName.replace(/'/g, "''")}'`);
122
+ if (options.fontSize)
123
+ commands.push(`$selection.Font.Size = ${options.fontSize}`);
124
+ if (options.bold !== undefined)
125
+ commands.push(`$selection.Font.Bold = ${options.bold ? '$true' : '$false'}`);
126
+ if (options.italic !== undefined)
127
+ commands.push(`$selection.Font.Italic = ${options.italic ? '$true' : '$false'}`);
128
+ if (options.underline !== undefined)
129
+ commands.push(`$selection.Font.Underline = ${options.underline ? '1' : '0'}`);
130
+ if (options.color) {
131
+ const rgb = this.hexToRgb(options.color);
132
+ if (rgb)
133
+ commands.push(`$selection.Font.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
134
+ }
135
+ return this.executePowerShell(`
136
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
137
+ $selection = $word.Selection
138
+ ${commands.join('\n')}
139
+ @{ success = $true; message = "Font properties set" } | ConvertTo-Json -Compress
140
+ `);
141
+ }
142
+ async wordSetParagraph(options) {
143
+ const alignmentMap = { left: 0, center: 1, right: 2, justify: 3 };
144
+ const commands = [];
145
+ if (options.alignment)
146
+ commands.push(`$selection.ParagraphFormat.Alignment = ${alignmentMap[options.alignment]}`);
147
+ if (options.lineSpacing)
148
+ commands.push(`$selection.ParagraphFormat.LineSpacing = ${options.lineSpacing}`);
149
+ if (options.spaceBefore)
150
+ commands.push(`$selection.ParagraphFormat.SpaceBefore = ${options.spaceBefore}`);
151
+ if (options.spaceAfter)
152
+ commands.push(`$selection.ParagraphFormat.SpaceAfter = ${options.spaceAfter}`);
153
+ if (options.firstLineIndent)
154
+ commands.push(`$selection.ParagraphFormat.FirstLineIndent = ${options.firstLineIndent}`);
155
+ return this.executePowerShell(`
156
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
157
+ $selection = $word.Selection
158
+ ${commands.join('\n')}
159
+ @{ success = $true; message = "Paragraph formatting set" } | ConvertTo-Json -Compress
160
+ `);
161
+ }
162
+ async wordAddHyperlink(text, url) {
163
+ const escapedText = text.replace(/'/g, "''");
164
+ const escapedUrl = url.replace(/'/g, "''");
165
+ return this.executePowerShell(`
166
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
167
+ $selection = $word.Selection
168
+ $doc = $word.ActiveDocument
169
+ $range = $selection.Range
170
+ $doc.Hyperlinks.Add($range, '${escapedUrl}', '', '', '${escapedText}')
171
+ @{ success = $true; message = "Hyperlink added" } | ConvertTo-Json -Compress
172
+ `);
173
+ }
174
+ async wordAddTable(rows, cols, data) {
175
+ let dataScript = '';
176
+ if (data) {
177
+ const dataLines = [];
178
+ for (let i = 0; i < data.length && i < rows; i++) {
179
+ const row = data[i];
180
+ if (!row)
181
+ continue;
182
+ for (let j = 0; j < row.length && j < cols; j++) {
183
+ const cellValue = row[j];
184
+ if (cellValue === undefined)
185
+ continue;
186
+ const cellHasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(cellValue);
187
+ const val = cellValue.replace(/'/g, "''");
188
+ dataLines.push(`$table.Cell(${i + 1}, ${j + 1}).Range.Text = '${val}'`);
189
+ if (cellHasKorean) {
190
+ dataLines.push(`$table.Cell(${i + 1}, ${j + 1}).Range.Font.Name = 'Malgun Gothic'`);
191
+ }
192
+ }
193
+ }
194
+ dataScript = dataLines.join('\n');
195
+ }
196
+ return this.executePowerShell(`
197
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
198
+ $doc = $word.ActiveDocument
199
+ $range = $word.Selection.Range
200
+ $table = $doc.Tables.Add($range, ${rows}, ${cols})
201
+ $table.Borders.Enable = $true
202
+ ${dataScript}
203
+ # Move cursor after the table and add a new paragraph
204
+ $tableEnd = $table.Range
205
+ $tableEnd.Collapse(0) # wdCollapseEnd = 0
206
+ $tableEnd.Select()
207
+ $word.Selection.TypeParagraph()
208
+ @{ success = $true; message = "Table added with ${rows} rows and ${cols} columns" } | ConvertTo-Json -Compress
209
+ `);
210
+ }
211
+ async wordAddImage(imagePath, width, height) {
212
+ const windowsPath = this.toWindowsPath(imagePath).replace(/'/g, "''");
213
+ const sizeScript = width || height
214
+ ? `
215
+ ${width ? '$shape.Width = ' + width : ''}
216
+ ${height ? '$shape.Height = ' + height : ''}`
217
+ : '';
218
+ return this.executePowerShell(`
219
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
220
+ $selection = $word.Selection
221
+ $shape = $selection.InlineShapes.AddPicture('${windowsPath}')
222
+ ${sizeScript}
223
+ # Move cursor after the image
224
+ $selection.MoveRight(1, 1) # wdCharacter = 1
225
+ @{ success = $true; message = "Image added" } | ConvertTo-Json -Compress
226
+ `);
227
+ }
228
+ async wordDeleteText(start, end) {
229
+ return this.executePowerShell(`
230
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
231
+ $doc = $word.ActiveDocument
232
+ $range = $doc.Range(${start}, ${end})
233
+ $range.Delete()
234
+ @{ success = $true; message = "Text deleted from position ${start} to ${end}" } | ConvertTo-Json -Compress
235
+ `);
236
+ }
237
+ async wordFindReplace(find, replace, replaceAll = true) {
238
+ const escapedFind = find.replace(/'/g, "''");
239
+ const escapedReplace = replace.replace(/'/g, "''");
240
+ const replaceOption = replaceAll ? '2' : '1';
241
+ return this.executePowerShell(`
242
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
243
+ $doc = $word.ActiveDocument
244
+ $findObj = $doc.Content.Find
245
+ $findObj.ClearFormatting()
246
+ $findObj.Replacement.ClearFormatting()
247
+ $findObj.Text = '${escapedFind}'
248
+ $findObj.Replacement.Text = '${escapedReplace}'
249
+ $found = $findObj.Execute([ref]'${escapedFind}', [ref]$false, [ref]$false, [ref]$false, [ref]$false, [ref]$false, [ref]$true, [ref]0, [ref]$false, [ref]'${escapedReplace}', [ref]${replaceOption})
250
+ @{ success = $true; message = "Find and replace completed"; found = $found } | ConvertTo-Json -Compress
251
+ `);
252
+ }
253
+ async wordSetStyle(styleName, preserveKoreanFont = true) {
254
+ const escapedStyle = styleName.replace(/'/g, "''");
255
+ const fontPreserveScript = preserveKoreanFont ? `
256
+ # Check if selection contains Korean text and preserve font
257
+ $selectedText = $selection.Text
258
+ if ($selectedText -match '[가-힣ㄱ-ㅎㅏ-ㅣ]') {
259
+ $selection.Font.Name = 'Malgun Gothic'
260
+ }` : '';
261
+ return this.executePowerShell(`
262
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
263
+ $selection = $word.Selection
264
+ $selection.Style = '${escapedStyle}'
265
+ ${fontPreserveScript}
266
+ @{ success = $true; message = "Style '${escapedStyle}' applied" } | ConvertTo-Json -Compress
267
+ `);
268
+ }
269
+ async wordInsertBreak(breakType = 'page') {
270
+ const breakTypeMap = { page: 7, line: 6, section: 2 };
271
+ return this.executePowerShell(`
272
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
273
+ $selection = $word.Selection
274
+ $selection.InsertBreak(${breakTypeMap[breakType]})
275
+ @{ success = $true; message = "${breakType} break inserted" } | ConvertTo-Json -Compress
276
+ `);
277
+ }
278
+ async wordGetSelection() {
279
+ return this.executePowerShell(`
280
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
281
+ $selection = $word.Selection
282
+ @{
283
+ success = $true
284
+ text = $selection.Text
285
+ start = $selection.Start
286
+ end = $selection.End
287
+ font_name = $selection.Font.Name
288
+ font_size = $selection.Font.Size
289
+ } | ConvertTo-Json -Compress
290
+ `);
291
+ }
292
+ async wordSelectAll() {
293
+ return this.executePowerShell(`
294
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
295
+ $word.ActiveDocument.Content.Select()
296
+ @{ success = $true; message = "All content selected" } | ConvertTo-Json -Compress
297
+ `);
298
+ }
299
+ async wordGoto(what, target) {
300
+ const whatMap = { page: 1, line: 3, bookmark: -1 };
301
+ const isBookmark = what === 'bookmark';
302
+ return this.executePowerShell(`
303
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
304
+ $selection = $word.Selection
305
+ ${isBookmark
306
+ ? `$selection.GoTo(-1, 0, 0, '${String(target).replace(/'/g, "''")}')`
307
+ : `$selection.GoTo(${whatMap[what]}, 0, ${target})`}
308
+ @{ success = $true; message = "Moved to ${what} ${target}" } | ConvertTo-Json -Compress
309
+ `);
310
+ }
311
+ async wordInsertHeader(text, options) {
312
+ const escapedText = text.replace(/'/g, "''");
313
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
314
+ const fontName = options?.fontName || (hasKorean ? 'Malgun Gothic' : '');
315
+ return this.executePowerShell(`
316
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
317
+ $doc = $word.ActiveDocument
318
+ $section = $doc.Sections(1)
319
+ $header = $section.Headers(1).Range
320
+ # Convert \\n to actual line breaks
321
+ $headerText = '${escapedText}' -replace '\\\\n', [char]10 -replace '\\n', [char]10
322
+ $header.Text = $headerText
323
+ # TEXT FIRST, FONT AFTER pattern
324
+ ${fontName ? `$header.Font.Name = '${fontName}'` : ''}
325
+ ${options?.fontSize ? `$header.Font.Size = ${options.fontSize}` : ''}
326
+ @{ success = $true; message = "Header added" } | ConvertTo-Json -Compress
327
+ `);
328
+ }
329
+ async wordInsertFooter(text, options) {
330
+ const escapedText = text.replace(/'/g, "''");
331
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
332
+ const fontName = options?.fontName || (hasKorean ? 'Malgun Gothic' : '');
333
+ return this.executePowerShell(`
334
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
335
+ $doc = $word.ActiveDocument
336
+ $section = $doc.Sections(1)
337
+ $footer = $section.Footers(1).Range
338
+ # Convert \\n to actual line breaks
339
+ $footerText = '${escapedText}' -replace '\\\\n', [char]10 -replace '\\n', [char]10
340
+ $footer.Text = $footerText
341
+ # TEXT FIRST, FONT AFTER pattern
342
+ ${fontName ? `$footer.Font.Name = '${fontName.replace(/'/g, "''")}'` : ''}
343
+ ${options?.fontSize ? `$footer.Font.Size = ${options.fontSize}` : ''}
344
+ @{ success = $true; message = "Footer added" } | ConvertTo-Json -Compress
345
+ `);
346
+ }
347
+ async wordInsertPageNumber(alignment = 'center') {
348
+ const alignMap = { left: 0, center: 1, right: 2 };
349
+ return this.executePowerShell(`
350
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
351
+ $doc = $word.ActiveDocument
352
+ $section = $doc.Sections(1)
353
+ $footer = $section.Footers(1)
354
+ $footer.PageNumbers.Add(${alignMap[alignment]})
355
+ @{ success = $true; message = "Page numbers added" } | ConvertTo-Json -Compress
356
+ `);
357
+ }
358
+ async wordExportToPDF(outputPath) {
359
+ const windowsPath = this.toWindowsPath(outputPath).replace(/'/g, "''");
360
+ return this.executePowerShell(`
361
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
362
+ $doc = $word.ActiveDocument
363
+ $doc.ExportAsFixedFormat('${windowsPath}', 17) # 17 = wdExportFormatPDF
364
+ @{ success = $true; message = "Exported to PDF"; path = '${windowsPath}' } | ConvertTo-Json -Compress
365
+ `);
366
+ }
367
+ async wordPrint(copies = 1) {
368
+ return this.executePowerShell(`
369
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
370
+ $doc = $word.ActiveDocument
371
+ $doc.PrintOut([ref]$false, [ref]$false, [ref]0, [ref]"", [ref]"", [ref]"", [ref]0, [ref]${copies})
372
+ @{ success = $true; message = "Print job sent (${copies} copies)" } | ConvertTo-Json -Compress
373
+ `);
374
+ }
375
+ async wordScreenshot() {
376
+ const result = await this.executePowerShell(`
377
+ Add-Type -AssemblyName System.Windows.Forms
378
+ Add-Type -AssemblyName System.Drawing
379
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
380
+ $doc = $word.ActiveDocument
381
+
382
+ # Switch to Print Preview to get a good screenshot
383
+ $originalView = $word.ActiveWindow.View.Type
384
+ $word.ActiveWindow.View.Type = 3 # wdPrintView
385
+
386
+ try {
387
+ # Method 1: Try CopyAsPicture on content
388
+ $doc.Content.Select()
389
+ $word.Selection.CopyAsPicture()
390
+ Start-Sleep -Milliseconds 300
391
+
392
+ $img = [System.Windows.Forms.Clipboard]::GetImage()
393
+
394
+ if ($img -eq $null) {
395
+ # Method 2: Fallback - capture the Word window
396
+ $hwnd = $word.Application.Hwnd
397
+ if ($hwnd -gt 0) {
398
+ Add-Type @"
399
+ using System;
400
+ using System.Drawing;
401
+ using System.Runtime.InteropServices;
402
+ public class Screenshot {
403
+ [DllImport("user32.dll")]
404
+ public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
405
+ [DllImport("user32.dll")]
406
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
407
+ public struct RECT { public int Left, Top, Right, Bottom; }
408
+ public static Bitmap CaptureWindow(IntPtr hwnd) {
409
+ RECT rect;
410
+ GetWindowRect(hwnd, out rect);
411
+ int width = rect.Right - rect.Left;
412
+ int height = rect.Bottom - rect.Top;
413
+ if (width <= 0 || height <= 0) return null;
414
+ Bitmap bmp = new Bitmap(width, height);
415
+ using (Graphics g = Graphics.FromImage(bmp)) {
416
+ g.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(width, height));
417
+ }
418
+ return bmp;
419
+ }
420
+ }
421
+ "@
422
+ [Screenshot]::SetForegroundWindow([IntPtr]$hwnd)
423
+ Start-Sleep -Milliseconds 500
424
+ $img = [Screenshot]::CaptureWindow([IntPtr]$hwnd)
425
+ }
426
+ }
427
+
428
+ if ($img -eq $null) {
429
+ @{ success = $false; error = "Failed to capture screenshot" } | ConvertTo-Json -Compress
430
+ return
431
+ }
432
+
433
+ # Convert to base64
434
+ $ms = New-Object System.IO.MemoryStream
435
+ $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
436
+ $bytes = $ms.ToArray()
437
+ $base64 = [Convert]::ToBase64String($bytes)
438
+ $ms.Dispose()
439
+ $img.Dispose()
440
+
441
+ # Deselect
442
+ $word.Selection.Collapse(1)
443
+
444
+ @{
445
+ success = $true
446
+ image = $base64
447
+ format = "png"
448
+ encoding = "base64"
449
+ } | ConvertTo-Json -Compress
450
+ } finally {
451
+ # Restore original view
452
+ $word.ActiveWindow.View.Type = $originalView
453
+ }
454
+ `);
455
+ return result;
456
+ }
457
+ async wordSetTableCell(tableIndex, row, col, text, options) {
458
+ const escapedText = text.replace(/'/g, "''");
459
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
460
+ let fontName = options?.fontName?.replace(/'/g, "''") || '';
461
+ if (!fontName && hasKorean) {
462
+ fontName = 'Malgun Gothic';
463
+ }
464
+ return this.executePowerShell(`
465
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
466
+ $doc = $word.ActiveDocument
467
+ $table = $doc.Tables(${tableIndex})
468
+ $cell = $table.Cell(${row}, ${col})
469
+ # Convert \\n to actual line breaks, then set text
470
+ $cellText = '${escapedText}' -replace '\\\\n', [char]10 -replace '\\n', [char]10
471
+ $cell.Range.Text = $cellText
472
+ # TEXT FIRST, FONT AFTER pattern
473
+ ${fontName ? `$cell.Range.Font.Name = '${fontName}'` : ''}
474
+ ${options?.fontSize ? `$cell.Range.Font.Size = ${options.fontSize}` : ''}
475
+ ${options?.bold ? '$cell.Range.Font.Bold = -1' : ''}
476
+ @{ success = $true; message = "Table cell (${row},${col}) updated" } | ConvertTo-Json -Compress
477
+ `);
478
+ }
479
+ async wordMergeTableCells(tableIndex, startRow, startCol, endRow, endCol) {
480
+ return this.executePowerShell(`
481
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
482
+ $doc = $word.ActiveDocument
483
+ $table = $doc.Tables(${tableIndex})
484
+ $startCell = $table.Cell(${startRow}, ${startCol})
485
+ $endCell = $table.Cell(${endRow}, ${endCol})
486
+ $startCell.Merge($endCell)
487
+ @{ success = $true; message = "Table cells merged" } | ConvertTo-Json -Compress
488
+ `);
489
+ }
490
+ async wordSetTableStyle(tableIndex, styleName, preserveKoreanFont = true) {
491
+ const escapedStyle = styleName.replace(/'/g, "''");
492
+ const styleConstMap = {
493
+ 'table grid': -176,
494
+ 'table normal': -106,
495
+ '표 눈금': -176,
496
+ '표 보통': -106,
497
+ };
498
+ const lowerStyleName = styleName.toLowerCase();
499
+ const styleConst = styleConstMap[lowerStyleName];
500
+ const fontPreserveScript = preserveKoreanFont ? `
501
+ # Check if table contains Korean text and preserve font
502
+ $tableText = $table.Range.Text
503
+ if ($tableText -match '[가-힣ㄱ-ㅎㅏ-ㅣ]') {
504
+ $table.Range.Font.Name = 'Malgun Gothic'
505
+ }` : '';
506
+ return this.executePowerShell(`
507
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
508
+ $doc = $word.ActiveDocument
509
+ $table = $doc.Tables(${tableIndex})
510
+ try {
511
+ ${styleConst !== undefined
512
+ ? `$table.Style = ${styleConst}`
513
+ : `$table.Style = '${escapedStyle}'`}
514
+ ${fontPreserveScript}
515
+ @{ success = $true; message = "Table style set" } | ConvertTo-Json -Compress
516
+ } catch {
517
+ # Try with style name directly if constant fails
518
+ try {
519
+ $table.Style = '${escapedStyle}'
520
+ ${fontPreserveScript}
521
+ @{ success = $true; message = "Table style set to '${escapedStyle}'" } | ConvertTo-Json -Compress
522
+ } catch {
523
+ @{ success = $false; error = "Style '${escapedStyle}' not found. Try: 'Table Grid', 'Table Normal', or numeric style index." } | ConvertTo-Json -Compress
524
+ }
525
+ }
526
+ `);
527
+ }
528
+ async wordSetTableBorder(tableIndex, options) {
529
+ const styleMap = {
530
+ single: 1,
531
+ double: 7,
532
+ thick: 14,
533
+ none: 0,
534
+ };
535
+ const lineStyle = styleMap[options.style || 'single'] ?? 1;
536
+ const colorValue = options.color ? (() => {
537
+ const rgb = this.hexToRgb(options.color);
538
+ return rgb ? rgb.r + rgb.g * 256 + rgb.b * 65536 : 0;
539
+ })() : 0;
540
+ return this.executePowerShell(`
541
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
542
+ $doc = $word.ActiveDocument
543
+ $table = $doc.Tables(${tableIndex})
544
+
545
+ # Border indices: wdBorderTop=-1, wdBorderLeft=-2, wdBorderBottom=-3, wdBorderRight=-4
546
+ # wdBorderHorizontal=-5, wdBorderVertical=-6
547
+ $borderIndices = @(-1, -2, -3, -4)
548
+ foreach ($idx in $borderIndices) {
549
+ $table.Borders.Item($idx).LineStyle = ${lineStyle}
550
+ ${colorValue ? `$table.Borders.Item($idx).Color = ${colorValue}` : ''}
551
+ }
552
+
553
+ # Inside borders (may not exist for 1-row or 1-column tables)
554
+ try {
555
+ $table.Borders.Item(-5).LineStyle = ${lineStyle} # Horizontal inside
556
+ ${colorValue ? `$table.Borders.Item(-5).Color = ${colorValue}` : ''}
557
+ } catch {}
558
+ try {
559
+ $table.Borders.Item(-6).LineStyle = ${lineStyle} # Vertical inside
560
+ ${colorValue ? `$table.Borders.Item(-6).Color = ${colorValue}` : ''}
561
+ } catch {}
562
+
563
+ @{ success = $true; message = "Table border set" } | ConvertTo-Json -Compress
564
+ `);
565
+ }
566
+ async wordAddBookmark(name, text) {
567
+ const escapedName = name.replace(/'/g, "''");
568
+ const escapedText = text ? text.replace(/'/g, "''") : '';
569
+ const originalTextLength = text ? text.length : 0;
570
+ const hasKorean = text ? /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text) : false;
571
+ return this.executePowerShell(`
572
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
573
+ $doc = $word.ActiveDocument
574
+ $selection = $word.Selection
575
+ ${text ? `${hasKorean ? "$selection.Font.Name = 'Malgun Gothic'" : ''}
576
+ $selection.TypeText('${escapedText}')
577
+ $selection.MoveLeft(1, ${originalTextLength}, 1)` : ''}
578
+ $doc.Bookmarks.Add('${escapedName}', $selection.Range)
579
+ @{ success = $true; message = "Bookmark '${escapedName}' added" } | ConvertTo-Json -Compress
580
+ `);
581
+ }
582
+ async wordGetBookmarks() {
583
+ return this.executePowerShell(`
584
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
585
+ $doc = $word.ActiveDocument
586
+ $bookmarks = @()
587
+ foreach ($bm in $doc.Bookmarks) {
588
+ $bookmarks += @{
589
+ name = $bm.Name
590
+ start = $bm.Range.Start
591
+ end = $bm.Range.End
592
+ text = $bm.Range.Text
593
+ }
594
+ }
595
+ @{ success = $true; bookmarks = $bookmarks } | ConvertTo-Json -Compress -Depth 5
596
+ `);
597
+ }
598
+ async wordDeleteBookmark(name) {
599
+ const escapedName = name.replace(/'/g, "''");
600
+ return this.executePowerShell(`
601
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
602
+ $doc = $word.ActiveDocument
603
+ if ($doc.Bookmarks.Exists('${escapedName}')) {
604
+ $doc.Bookmarks('${escapedName}').Delete()
605
+ @{ success = $true; message = "Bookmark '${escapedName}' deleted" } | ConvertTo-Json -Compress
606
+ } else {
607
+ @{ success = $false; error = "Bookmark '${escapedName}' not found" } | ConvertTo-Json -Compress
608
+ }
609
+ `);
610
+ }
611
+ async wordGotoBookmark(name) {
612
+ const escapedName = name.replace(/'/g, "''");
613
+ return this.executePowerShell(`
614
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
615
+ $doc = $word.ActiveDocument
616
+ if ($doc.Bookmarks.Exists('${escapedName}')) {
617
+ $doc.Bookmarks('${escapedName}').Select()
618
+ @{ success = $true; message = "Moved to bookmark '${escapedName}'" } | ConvertTo-Json -Compress
619
+ } else {
620
+ @{ success = $false; error = "Bookmark '${escapedName}' not found" } | ConvertTo-Json -Compress
621
+ }
622
+ `);
623
+ }
624
+ async wordAddComment(commentText, author) {
625
+ const escapedText = commentText.replace(/'/g, "''");
626
+ const escapedAuthor = author?.replace(/'/g, "''") || '';
627
+ return this.executePowerShell(`
628
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
629
+ $doc = $word.ActiveDocument
630
+ $selection = $word.Selection
631
+ $comment = $doc.Comments.Add($selection.Range, '${escapedText}')
632
+ ${escapedAuthor ? `$comment.Author = '${escapedAuthor}'` : ''}
633
+ @{ success = $true; message = "Comment added" } | ConvertTo-Json -Compress
634
+ `);
635
+ }
636
+ async wordGetComments() {
637
+ return this.executePowerShell(`
638
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
639
+ $doc = $word.ActiveDocument
640
+ $comments = @()
641
+ foreach ($c in $doc.Comments) {
642
+ $comments += @{
643
+ index = $c.Index
644
+ author = $c.Author
645
+ text = $c.Range.Text
646
+ date = $c.Date.ToString("yyyy-MM-dd HH:mm:ss")
647
+ scope = $c.Scope.Text
648
+ }
649
+ }
650
+ @{ success = $true; comments = $comments; count = $doc.Comments.Count } | ConvertTo-Json -Compress -Depth 5
651
+ `);
652
+ }
653
+ async wordDeleteComment(index) {
654
+ return this.executePowerShell(`
655
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
656
+ $doc = $word.ActiveDocument
657
+ if (${index} -le $doc.Comments.Count) {
658
+ $doc.Comments(${index}).Delete()
659
+ @{ success = $true; message = "Comment ${index} deleted" } | ConvertTo-Json -Compress
660
+ } else {
661
+ @{ success = $false; error = "Comment index ${index} out of range" } | ConvertTo-Json -Compress
662
+ }
663
+ `);
664
+ }
665
+ async wordDeleteAllComments() {
666
+ return this.executePowerShell(`
667
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
668
+ $doc = $word.ActiveDocument
669
+ $count = $doc.Comments.Count
670
+ while ($doc.Comments.Count -gt 0) {
671
+ $doc.Comments(1).Delete()
672
+ }
673
+ @{ success = $true; message = "Deleted $count comments" } | ConvertTo-Json -Compress
674
+ `);
675
+ }
676
+ async wordCreateBulletList(items) {
677
+ const itemsScript = items.map(item => {
678
+ const escaped = item.replace(/'/g, "''");
679
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(item);
680
+ return `$selection.TypeText('${escaped}')
681
+ ${hasKorean ? "$selection.Font.Name = 'Malgun Gothic'" : ''}
682
+ $selection.TypeParagraph()`;
683
+ }).join('\n');
684
+ return this.executePowerShell(`
685
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
686
+ $selection = $word.Selection
687
+ $selection.Range.ListFormat.ApplyBulletDefault()
688
+ ${itemsScript}
689
+ $selection.Range.ListFormat.RemoveNumbers()
690
+ @{ success = $true; message = "Bullet list created with ${items.length} items" } | ConvertTo-Json -Compress
691
+ `);
692
+ }
693
+ async wordCreateNumberedList(items) {
694
+ const itemsScript = items.map(item => {
695
+ const escaped = item.replace(/'/g, "''");
696
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(item);
697
+ return `$selection.TypeText('${escaped}')
698
+ ${hasKorean ? "$selection.Font.Name = 'Malgun Gothic'" : ''}
699
+ $selection.TypeParagraph()`;
700
+ }).join('\n');
701
+ return this.executePowerShell(`
702
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
703
+ $selection = $word.Selection
704
+ $selection.Range.ListFormat.ApplyNumberDefault()
705
+ ${itemsScript}
706
+ $selection.Range.ListFormat.RemoveNumbers()
707
+ @{ success = $true; message = "Numbered list created with ${items.length} items" } | ConvertTo-Json -Compress
708
+ `);
709
+ }
710
+ async wordSetPageMargins(options) {
711
+ const commands = [];
712
+ if (options.top !== undefined)
713
+ commands.push(`$pageSetup.TopMargin = ${options.top}`);
714
+ if (options.bottom !== undefined)
715
+ commands.push(`$pageSetup.BottomMargin = ${options.bottom}`);
716
+ if (options.left !== undefined)
717
+ commands.push(`$pageSetup.LeftMargin = ${options.left}`);
718
+ if (options.right !== undefined)
719
+ commands.push(`$pageSetup.RightMargin = ${options.right}`);
720
+ return this.executePowerShell(`
721
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
722
+ $doc = $word.ActiveDocument
723
+ $pageSetup = $doc.PageSetup
724
+ ${commands.join('\n')}
725
+ @{ success = $true; message = "Page margins updated" } | ConvertTo-Json -Compress
726
+ `);
727
+ }
728
+ async wordSetPageOrientation(orientation) {
729
+ const value = orientation === 'landscape' ? 1 : 0;
730
+ return this.executePowerShell(`
731
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
732
+ $doc = $word.ActiveDocument
733
+ $doc.PageSetup.Orientation = ${value}
734
+ @{ success = $true; message = "Page orientation set to ${orientation}" } | ConvertTo-Json -Compress
735
+ `);
736
+ }
737
+ async wordSetPageSize(size, width, height) {
738
+ const sizeMap = {
739
+ A4: 7,
740
+ Letter: 2,
741
+ Legal: 4,
742
+ A3: 6,
743
+ B5: 13,
744
+ };
745
+ if (size === 'custom' && width && height) {
746
+ return this.executePowerShell(`
747
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
748
+ $doc = $word.ActiveDocument
749
+ $doc.PageSetup.PageWidth = ${width}
750
+ $doc.PageSetup.PageHeight = ${height}
751
+ @{ success = $true; message = "Page size set to custom (${width}x${height})" } | ConvertTo-Json -Compress
752
+ `);
753
+ }
754
+ const paperSize = sizeMap[size] ?? 7;
755
+ return this.executePowerShell(`
756
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
757
+ $doc = $word.ActiveDocument
758
+ $doc.PageSetup.PaperSize = ${paperSize}
759
+ @{ success = $true; message = "Page size set to ${size}" } | ConvertTo-Json -Compress
760
+ `);
761
+ }
762
+ async wordAddWatermark(text, options) {
763
+ const escapedText = text.replace(/'/g, "''");
764
+ const fontName = options?.fontName?.replace(/'/g, "''") || 'Arial';
765
+ const fontSize = options?.fontSize || 72;
766
+ const colorValue = options?.color ? (() => {
767
+ const rgb = this.hexToRgb(options.color);
768
+ return rgb ? rgb.r + rgb.g * 256 + rgb.b * 65536 : 12632256;
769
+ })() : 12632256;
770
+ const semitransparent = options?.semitransparent !== false ? '0.5' : '0';
771
+ return this.executePowerShell(`
772
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
773
+ $doc = $word.ActiveDocument
774
+
775
+ # Store original view and switch to Print Layout to access headers
776
+ $originalView = $word.ActiveWindow.View.Type
777
+ $word.ActiveWindow.View.Type = 3 # wdPrintView
778
+
779
+ try {
780
+ # Add watermark to header
781
+ $section = $doc.Sections(1)
782
+ $header = $section.Headers(1) # wdHeaderFooterPrimary = 1
783
+
784
+ # Create text effect shape (without Select to avoid view access issues)
785
+ $shape = $header.Shapes.AddTextEffect(0, '${escapedText}', '${fontName}', ${fontSize}, 0, 0, 0, 0)
786
+ $shape.Name = "PowerPlusWaterMarkObject"
787
+ $shape.TextEffect.NormalizedHeight = 0
788
+ $shape.Line.Visible = 0
789
+ $shape.Fill.Visible = -1
790
+ $shape.Fill.Solid()
791
+ $shape.Fill.ForeColor.RGB = ${colorValue}
792
+ $shape.Fill.Transparency = ${semitransparent}
793
+ $shape.Rotation = 315
794
+ $shape.LockAspectRatio = -1
795
+ $shape.Height = 100
796
+ $shape.Width = 350
797
+ $shape.Left = -999995 # wdShapeCenter
798
+ $shape.Top = -999995 # wdShapeCenter
799
+ $shape.WrapFormat.AllowOverlap = -1
800
+ $shape.WrapFormat.Type = 3 # wdWrapBehind
801
+
802
+ @{ success = $true; message = "Watermark added" } | ConvertTo-Json -Compress
803
+ } finally {
804
+ # Restore original view
805
+ $word.ActiveWindow.View.Type = $originalView
806
+ }
807
+ `);
808
+ }
809
+ async wordRemoveWatermark() {
810
+ return this.executePowerShell(`
811
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
812
+ $doc = $word.ActiveDocument
813
+
814
+ # Switch to Print Layout view to access headers (wdPrintView = 3)
815
+ $word.ActiveWindow.View.Type = 3
816
+
817
+ foreach ($section in $doc.Sections) {
818
+ $header = $section.Headers(1)
819
+ foreach ($shape in $header.Shapes) {
820
+ if ($shape.Name -like "*WaterMark*") {
821
+ $shape.Delete()
822
+ }
823
+ }
824
+ }
825
+ @{ success = $true; message = "Watermark removed" } | ConvertTo-Json -Compress
826
+ `);
827
+ }
828
+ async wordAddTextbox(text, left, top, width, height, options) {
829
+ const escapedText = text.replace(/'/g, "''");
830
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
831
+ let fontName = options?.fontName?.replace(/'/g, "''") || '';
832
+ if (!fontName && hasKorean) {
833
+ fontName = 'Malgun Gothic';
834
+ }
835
+ const commands = [];
836
+ if (fontName)
837
+ commands.push(`$shape.TextFrame.TextRange.Font.Name = '${fontName}'`);
838
+ if (options?.fontSize)
839
+ commands.push(`$shape.TextFrame.TextRange.Font.Size = ${options.fontSize}`);
840
+ if (options?.borderColor) {
841
+ const rgb = this.hexToRgb(options.borderColor);
842
+ if (rgb) {
843
+ commands.push('$shape.Line.Visible = -1');
844
+ commands.push(`$shape.Line.ForeColor.RGB = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
845
+ }
846
+ }
847
+ if (options?.fillColor) {
848
+ const rgb = this.hexToRgb(options.fillColor);
849
+ if (rgb) {
850
+ commands.push('$shape.Fill.Visible = -1');
851
+ commands.push(`$shape.Fill.ForeColor.RGB = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
852
+ }
853
+ }
854
+ else {
855
+ commands.push('$shape.Fill.Visible = 0');
856
+ }
857
+ return this.executePowerShell(`
858
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
859
+ $doc = $word.ActiveDocument
860
+ $shape = $doc.Shapes.AddTextbox(1, ${left}, ${top}, ${width}, ${height})
861
+ $textContent = '${escapedText}' -replace '\\\\n', [char]10 -replace '\\n', [char]10
862
+ $shape.TextFrame.TextRange.Text = $textContent
863
+ ${fontName ? `$shape.TextFrame.TextRange.Font.Name = '${fontName}'` : ''}
864
+ ${commands.filter(c => !c.includes('Font.Name')).join('\n')}
865
+ @{ success = $true; message = "Textbox added"; shape_name = $shape.Name } | ConvertTo-Json -Compress
866
+ `);
867
+ }
868
+ async wordAddShape(shapeType, left, top, width, height, options) {
869
+ if (shapeType === 'line') {
870
+ return this.wordAddLine(left, top, left + width, top + height, options);
871
+ }
872
+ const shapeMap = {
873
+ rectangle: 1,
874
+ oval: 9,
875
+ roundedRectangle: 5,
876
+ triangle: 7,
877
+ diamond: 4,
878
+ arrow: 33,
879
+ };
880
+ const shapeTypeValue = shapeMap[shapeType] ?? 1;
881
+ const commands = [];
882
+ if (options?.fillColor) {
883
+ const rgb = this.hexToRgb(options.fillColor);
884
+ if (rgb) {
885
+ commands.push('$shape.Fill.Visible = -1');
886
+ commands.push('$shape.Fill.Solid()');
887
+ commands.push(`$shape.Fill.ForeColor.RGB = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
888
+ }
889
+ }
890
+ if (options?.lineColor) {
891
+ const rgb = this.hexToRgb(options.lineColor);
892
+ if (rgb) {
893
+ commands.push('$shape.Line.Visible = -1');
894
+ commands.push(`$shape.Line.ForeColor.RGB = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
895
+ }
896
+ }
897
+ if (options?.lineWeight) {
898
+ commands.push(`$shape.Line.Weight = ${options.lineWeight}`);
899
+ }
900
+ return this.executePowerShell(`
901
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
902
+ $doc = $word.ActiveDocument
903
+ $shape = $doc.Shapes.AddShape(${shapeTypeValue}, ${left}, ${top}, ${width}, ${height})
904
+ ${commands.join('\n')}
905
+ @{ success = $true; message = "Shape added"; shape_name = $shape.Name } | ConvertTo-Json -Compress
906
+ `);
907
+ }
908
+ async wordAddLine(startX, startY, endX, endY, options) {
909
+ const commands = [];
910
+ if (options?.lineColor) {
911
+ const rgb = this.hexToRgb(options.lineColor);
912
+ if (rgb) {
913
+ commands.push('$shape.Line.Visible = -1');
914
+ commands.push(`$shape.Line.ForeColor.RGB = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
915
+ }
916
+ }
917
+ if (options?.lineWeight) {
918
+ commands.push(`$shape.Line.Weight = ${options.lineWeight}`);
919
+ }
920
+ return this.executePowerShell(`
921
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
922
+ $doc = $word.ActiveDocument
923
+ $shape = $doc.Shapes.AddLine(${startX}, ${startY}, ${endX}, ${endY})
924
+ ${commands.join('\n')}
925
+ @{ success = $true; message = "Line added"; shape_name = $shape.Name } | ConvertTo-Json -Compress
926
+ `);
927
+ }
928
+ async wordGetDocumentInfo() {
929
+ return this.executePowerShell(`
930
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
931
+ $doc = $word.ActiveDocument
932
+ $stats = $doc.ComputeStatistics(0) # wdStatisticWords
933
+
934
+ @{
935
+ success = $true
936
+ name = $doc.Name
937
+ path = $doc.FullName
938
+ pages = $doc.ComputeStatistics(2) # wdStatisticPages
939
+ words = $doc.ComputeStatistics(0) # wdStatisticWords
940
+ characters = $doc.ComputeStatistics(3) # wdStatisticCharacters
941
+ characters_with_spaces = $doc.ComputeStatistics(5) # wdStatisticCharactersWithSpaces
942
+ paragraphs = $doc.ComputeStatistics(4) # wdStatisticParagraphs
943
+ lines = $doc.ComputeStatistics(1) # wdStatisticLines
944
+ saved = $doc.Saved
945
+ read_only = $doc.ReadOnly
946
+ } | ConvertTo-Json -Compress
947
+ `);
948
+ }
949
+ async wordSetColumns(count, spacing) {
950
+ const spacingScript = spacing !== undefined ? `$pageSetup.TextColumns.Spacing = ${spacing}` : '';
951
+ return this.executePowerShell(`
952
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
953
+ $doc = $word.ActiveDocument
954
+ $pageSetup = $doc.PageSetup
955
+ $pageSetup.TextColumns.SetCount(${count})
956
+ ${spacingScript}
957
+ @{ success = $true; message = "Columns set to ${count}${spacing !== undefined ? ` with spacing ${spacing}pt` : ''}" } | ConvertTo-Json -Compress
958
+ `);
959
+ }
960
+ async wordUndo(times = 1) {
961
+ return this.executePowerShell(`
962
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
963
+ $doc = $word.ActiveDocument
964
+ for ($i = 0; $i -lt ${times}; $i++) {
965
+ $doc.Undo()
966
+ }
967
+ @{ success = $true; message = "Undo performed ${times} time(s)" } | ConvertTo-Json -Compress
968
+ `);
969
+ }
970
+ async wordRedo(times = 1) {
971
+ return this.executePowerShell(`
972
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
973
+ $doc = $word.ActiveDocument
974
+ for ($i = 0; $i -lt ${times}; $i++) {
975
+ $doc.Redo()
976
+ }
977
+ @{ success = $true; message = "Redo performed ${times} time(s)" } | ConvertTo-Json -Compress
978
+ `);
979
+ }
980
+ async wordGetSelectedText() {
981
+ return this.executePowerShell(`
982
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
983
+ $selection = $word.Selection
984
+ @{
985
+ success = $true
986
+ text = $selection.Text
987
+ start = $selection.Start
988
+ end = $selection.End
989
+ type = $selection.Type # 0=none, 1=normal, 2=IP (insertion point)
990
+ } | ConvertTo-Json -Compress
991
+ `);
992
+ }
993
+ async wordSelectRange(start, end) {
994
+ return this.executePowerShell(`
995
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
996
+ $doc = $word.ActiveDocument
997
+ $range = $doc.Range(${start}, ${end})
998
+ $range.Select()
999
+ @{ success = $true; message = "Selected range from ${start} to ${end}"; text = $range.Text } | ConvertTo-Json -Compress
1000
+ `);
1001
+ }
1002
+ async wordMoveCursor(unit, count, extend = false) {
1003
+ const unitMap = { character: 1, word: 2, line: 5, paragraph: 4 };
1004
+ const unitValue = unitMap[unit] ?? 1;
1005
+ const direction = count >= 0 ? 'MoveRight' : 'MoveLeft';
1006
+ const absCount = Math.abs(count);
1007
+ const extendMode = extend ? '1' : '0';
1008
+ return this.executePowerShell(`
1009
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1010
+ $selection = $word.Selection
1011
+ $selection.${direction}(${unitValue}, ${absCount}, ${extendMode})
1012
+ @{
1013
+ success = $true
1014
+ message = "Cursor moved ${count} ${unit}(s)"
1015
+ position = $selection.Start
1016
+ end_position = $selection.End
1017
+ } | ConvertTo-Json -Compress
1018
+ `);
1019
+ }
1020
+ async wordMoveCursorTo(position) {
1021
+ const method = position === 'start' ? 'HomeKey' : 'EndKey';
1022
+ return this.executePowerShell(`
1023
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1024
+ $selection = $word.Selection
1025
+ $selection.${method}(6) # wdStory = 6
1026
+ @{ success = $true; message = "Cursor moved to ${position} of document"; position = $selection.Start } | ConvertTo-Json -Compress
1027
+ `);
1028
+ }
1029
+ async wordAddTableRow(tableIndex, position) {
1030
+ const positionScript = position !== undefined
1031
+ ? `$row = $table.Rows(${position})\n$table.Rows.Add($row)`
1032
+ : '$table.Rows.Add()';
1033
+ return this.executePowerShell(`
1034
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1035
+ $doc = $word.ActiveDocument
1036
+ $table = $doc.Tables(${tableIndex})
1037
+ ${positionScript}
1038
+ @{ success = $true; message = "Row added to table ${tableIndex}"; total_rows = $table.Rows.Count } | ConvertTo-Json -Compress
1039
+ `);
1040
+ }
1041
+ async wordAddTableColumn(tableIndex, position) {
1042
+ const positionScript = position !== undefined
1043
+ ? `$col = $table.Columns(${position})\n$table.Columns.Add($col)`
1044
+ : '$table.Columns.Add()';
1045
+ return this.executePowerShell(`
1046
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1047
+ $doc = $word.ActiveDocument
1048
+ $table = $doc.Tables(${tableIndex})
1049
+ ${positionScript}
1050
+ @{ success = $true; message = "Column added to table ${tableIndex}"; total_columns = $table.Columns.Count } | ConvertTo-Json -Compress
1051
+ `);
1052
+ }
1053
+ async wordDeleteTableRow(tableIndex, rowIndex) {
1054
+ return this.executePowerShell(`
1055
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1056
+ $doc = $word.ActiveDocument
1057
+ $table = $doc.Tables(${tableIndex})
1058
+ if (${rowIndex} -le $table.Rows.Count) {
1059
+ $table.Rows(${rowIndex}).Delete()
1060
+ @{ success = $true; message = "Row ${rowIndex} deleted from table ${tableIndex}"; remaining_rows = $table.Rows.Count } | ConvertTo-Json -Compress
1061
+ } else {
1062
+ @{ success = $false; error = "Row index ${rowIndex} out of range (table has $($table.Rows.Count) rows)" } | ConvertTo-Json -Compress
1063
+ }
1064
+ `);
1065
+ }
1066
+ async wordDeleteTableColumn(tableIndex, colIndex) {
1067
+ return this.executePowerShell(`
1068
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1069
+ $doc = $word.ActiveDocument
1070
+ $table = $doc.Tables(${tableIndex})
1071
+ if (${colIndex} -le $table.Columns.Count) {
1072
+ $table.Columns(${colIndex}).Delete()
1073
+ @{ success = $true; message = "Column ${colIndex} deleted from table ${tableIndex}"; remaining_columns = $table.Columns.Count } | ConvertTo-Json -Compress
1074
+ } else {
1075
+ @{ success = $false; error = "Column index ${colIndex} out of range (table has $($table.Columns.Count) columns)" } | ConvertTo-Json -Compress
1076
+ }
1077
+ `);
1078
+ }
1079
+ async wordGetTableInfo(tableIndex) {
1080
+ return this.executePowerShell(`
1081
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1082
+ $doc = $word.ActiveDocument
1083
+ if (${tableIndex} -le $doc.Tables.Count) {
1084
+ $table = $doc.Tables(${tableIndex})
1085
+ @{
1086
+ success = $true
1087
+ table_index = ${tableIndex}
1088
+ rows = $table.Rows.Count
1089
+ columns = $table.Columns.Count
1090
+ style = $table.Style
1091
+ } | ConvertTo-Json -Compress
1092
+ } else {
1093
+ @{ success = $false; error = "Table index ${tableIndex} out of range (document has $($doc.Tables.Count) tables)" } | ConvertTo-Json -Compress
1094
+ }
1095
+ `);
1096
+ }
1097
+ async wordSetTrackChanges(enabled) {
1098
+ return this.executePowerShell(`
1099
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1100
+ $doc = $word.ActiveDocument
1101
+ $doc.TrackRevisions = ${enabled ? '$true' : '$false'}
1102
+ @{ success = $true; message = "Track changes ${enabled ? 'enabled' : 'disabled'}"; track_revisions = $doc.TrackRevisions } | ConvertTo-Json -Compress
1103
+ `);
1104
+ }
1105
+ async wordGetTrackChanges() {
1106
+ return this.executePowerShell(`
1107
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1108
+ $doc = $word.ActiveDocument
1109
+ $revisions = @()
1110
+ foreach ($rev in $doc.Revisions) {
1111
+ $revisions += @{
1112
+ index = $rev.Index
1113
+ author = $rev.Author
1114
+ type = $rev.Type
1115
+ text = $rev.Range.Text
1116
+ date = $rev.Date.ToString("yyyy-MM-dd HH:mm:ss")
1117
+ }
1118
+ }
1119
+ @{
1120
+ success = $true
1121
+ track_revisions = $doc.TrackRevisions
1122
+ revision_count = $doc.Revisions.Count
1123
+ revisions = $revisions
1124
+ } | ConvertTo-Json -Compress -Depth 5
1125
+ `);
1126
+ }
1127
+ async wordAcceptAllRevisions() {
1128
+ return this.executePowerShell(`
1129
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1130
+ $doc = $word.ActiveDocument
1131
+ $count = $doc.Revisions.Count
1132
+ $doc.AcceptAllRevisions()
1133
+ @{ success = $true; message = "Accepted $count revisions" } | ConvertTo-Json -Compress
1134
+ `);
1135
+ }
1136
+ async wordRejectAllRevisions() {
1137
+ return this.executePowerShell(`
1138
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1139
+ $doc = $word.ActiveDocument
1140
+ $count = $doc.Revisions.Count
1141
+ $doc.RejectAllRevisions()
1142
+ @{ success = $true; message = "Rejected $count revisions" } | ConvertTo-Json -Compress
1143
+ `);
1144
+ }
1145
+ async wordHandleRevision(index, accept) {
1146
+ const method = accept ? 'Accept' : 'Reject';
1147
+ return this.executePowerShell(`
1148
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1149
+ $doc = $word.ActiveDocument
1150
+ if (${index} -le $doc.Revisions.Count) {
1151
+ $doc.Revisions(${index}).${method}()
1152
+ @{ success = $true; message = "Revision ${index} ${accept ? 'accepted' : 'rejected'}" } | ConvertTo-Json -Compress
1153
+ } else {
1154
+ @{ success = $false; error = "Revision index ${index} out of range" } | ConvertTo-Json -Compress
1155
+ }
1156
+ `);
1157
+ }
1158
+ async wordInsertTOC(options) {
1159
+ const useHeadingStyles = options?.useHeadingStyles !== false ? '$true' : '$false';
1160
+ const upperLevel = options?.upperHeadingLevel ?? 1;
1161
+ const lowerLevel = options?.lowerHeadingLevel ?? 3;
1162
+ const useHyperlinks = options?.useHyperlinks !== false ? '$true' : '$false';
1163
+ return this.executePowerShell(`
1164
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1165
+ $doc = $word.ActiveDocument
1166
+ $selection = $word.Selection
1167
+ $range = $selection.Range
1168
+ $toc = $doc.TablesOfContents.Add($range, ${useHeadingStyles}, ${upperLevel}, ${lowerLevel}, $false, "", $true, ${useHyperlinks})
1169
+ @{ success = $true; message = "Table of contents inserted (Heading ${upperLevel}-${lowerLevel})" } | ConvertTo-Json -Compress
1170
+ `);
1171
+ }
1172
+ async wordUpdateTOC() {
1173
+ return this.executePowerShell(`
1174
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1175
+ $doc = $word.ActiveDocument
1176
+ $count = $doc.TablesOfContents.Count
1177
+ foreach ($toc in $doc.TablesOfContents) {
1178
+ $toc.Update()
1179
+ }
1180
+ @{ success = $true; message = "Updated $count table(s) of contents" } | ConvertTo-Json -Compress
1181
+ `);
1182
+ }
1183
+ async wordDeleteTOC() {
1184
+ return this.executePowerShell(`
1185
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1186
+ $doc = $word.ActiveDocument
1187
+ $count = $doc.TablesOfContents.Count
1188
+ while ($doc.TablesOfContents.Count -gt 0) {
1189
+ $doc.TablesOfContents(1).Delete()
1190
+ }
1191
+ @{ success = $true; message = "Deleted $count table(s) of contents" } | ConvertTo-Json -Compress
1192
+ `);
1193
+ }
1194
+ async wordAddFootnote(text) {
1195
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
1196
+ const base64Text = this.encodeTextForPowerShell(text);
1197
+ const decodeExpr = this.getPowerShellDecodeExpr(base64Text);
1198
+ return this.executePowerShell(`
1199
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1200
+ $doc = $word.ActiveDocument
1201
+ $selection = $word.Selection
1202
+ $footnote = $doc.Footnotes.Add($selection.Range)
1203
+ $footnote.Range.Text = ${decodeExpr}
1204
+ ${hasKorean ? "$footnote.Range.Font.Name = 'Malgun Gothic'" : ''}
1205
+ @{ success = $true; message = "Footnote added"; index = $footnote.Index } | ConvertTo-Json -Compress
1206
+ `);
1207
+ }
1208
+ async wordAddEndnote(text) {
1209
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(text);
1210
+ const base64Text = this.encodeTextForPowerShell(text);
1211
+ const decodeExpr = this.getPowerShellDecodeExpr(base64Text);
1212
+ return this.executePowerShell(`
1213
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1214
+ $doc = $word.ActiveDocument
1215
+ $selection = $word.Selection
1216
+ $endnote = $doc.Endnotes.Add($selection.Range)
1217
+ $endnote.Range.Text = ${decodeExpr}
1218
+ ${hasKorean ? "$endnote.Range.Font.Name = 'Malgun Gothic'" : ''}
1219
+ @{ success = $true; message = "Endnote added"; index = $endnote.Index } | ConvertTo-Json -Compress
1220
+ `);
1221
+ }
1222
+ async wordGetFootnotes() {
1223
+ return this.executePowerShell(`
1224
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1225
+ $doc = $word.ActiveDocument
1226
+ $footnotes = @()
1227
+ foreach ($fn in $doc.Footnotes) {
1228
+ $footnotes += @{
1229
+ index = $fn.Index
1230
+ text = $fn.Range.Text
1231
+ reference_text = $fn.Reference.Text
1232
+ }
1233
+ }
1234
+ @{ success = $true; footnotes = $footnotes; count = $doc.Footnotes.Count } | ConvertTo-Json -Compress -Depth 5
1235
+ `);
1236
+ }
1237
+ async wordGetEndnotes() {
1238
+ return this.executePowerShell(`
1239
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1240
+ $doc = $word.ActiveDocument
1241
+ $endnotes = @()
1242
+ foreach ($en in $doc.Endnotes) {
1243
+ $endnotes += @{
1244
+ index = $en.Index
1245
+ text = $en.Range.Text
1246
+ reference_text = $en.Reference.Text
1247
+ }
1248
+ }
1249
+ @{ success = $true; endnotes = $endnotes; count = $doc.Endnotes.Count } | ConvertTo-Json -Compress -Depth 5
1250
+ `);
1251
+ }
1252
+ async wordDeleteFootnote(index) {
1253
+ return this.executePowerShell(`
1254
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1255
+ $doc = $word.ActiveDocument
1256
+ if (${index} -le $doc.Footnotes.Count) {
1257
+ $doc.Footnotes(${index}).Delete()
1258
+ @{ success = $true; message = "Footnote ${index} deleted" } | ConvertTo-Json -Compress
1259
+ } else {
1260
+ @{ success = $false; error = "Footnote index ${index} out of range" } | ConvertTo-Json -Compress
1261
+ }
1262
+ `);
1263
+ }
1264
+ async wordDeleteEndnote(index) {
1265
+ return this.executePowerShell(`
1266
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1267
+ $doc = $word.ActiveDocument
1268
+ if (${index} -le $doc.Endnotes.Count) {
1269
+ $doc.Endnotes(${index}).Delete()
1270
+ @{ success = $true; message = "Endnote ${index} deleted" } | ConvertTo-Json -Compress
1271
+ } else {
1272
+ @{ success = $false; error = "Endnote index ${index} out of range" } | ConvertTo-Json -Compress
1273
+ }
1274
+ `);
1275
+ }
1276
+ async wordFind(text, options) {
1277
+ const base64Text = this.encodeTextForPowerShell(text);
1278
+ const decodeExpr = this.getPowerShellDecodeExpr(base64Text);
1279
+ const matchCase = options?.matchCase ? '$true' : '$false';
1280
+ const matchWholeWord = options?.matchWholeWord ? '$true' : '$false';
1281
+ return this.executePowerShell(`
1282
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1283
+ $doc = $word.ActiveDocument
1284
+ $selection = $word.Selection
1285
+ $selection.HomeKey(6) # Move to start of document
1286
+ $searchText = ${decodeExpr}
1287
+ $find = $selection.Find
1288
+ $find.ClearFormatting()
1289
+ $find.Text = $searchText
1290
+ $find.MatchCase = ${matchCase}
1291
+ $find.MatchWholeWord = ${matchWholeWord}
1292
+ $find.Forward = $true
1293
+ $find.Wrap = 0 # wdFindStop
1294
+
1295
+ $found = $find.Execute()
1296
+ if ($found) {
1297
+ @{
1298
+ success = $true
1299
+ found = $true
1300
+ start = $selection.Start
1301
+ end = $selection.End
1302
+ text = $selection.Text
1303
+ } | ConvertTo-Json -Compress
1304
+ } else {
1305
+ @{ success = $true; found = $false; message = "Text not found" } | ConvertTo-Json -Compress
1306
+ }
1307
+ `);
1308
+ }
1309
+ async wordFindAll(text, options) {
1310
+ const base64Text = this.encodeTextForPowerShell(text);
1311
+ const decodeExpr = this.getPowerShellDecodeExpr(base64Text);
1312
+ const matchCase = options?.matchCase ? '$true' : '$false';
1313
+ const matchWholeWord = options?.matchWholeWord ? '$true' : '$false';
1314
+ return this.executePowerShell(`
1315
+ $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application")
1316
+ $doc = $word.ActiveDocument
1317
+ $range = $doc.Content
1318
+ $searchText = ${decodeExpr}
1319
+ $find = $range.Find
1320
+ $find.ClearFormatting()
1321
+ $find.Text = $searchText
1322
+ $find.MatchCase = ${matchCase}
1323
+ $find.MatchWholeWord = ${matchWholeWord}
1324
+ $find.Forward = $true
1325
+
1326
+ $matches = @()
1327
+ while ($find.Execute()) {
1328
+ $matches += @{
1329
+ start = $range.Start
1330
+ end = $range.End
1331
+ text = $range.Text
1332
+ }
1333
+ $range.Collapse(0) # wdCollapseEnd
1334
+ }
1335
+
1336
+ @{ success = $true; count = $matches.Count; matches = $matches } | ConvertTo-Json -Compress -Depth 5
1337
+ `);
1338
+ }
1339
+ }
1340
+ export const wordClient = new WordClient();
1341
+ //# sourceMappingURL=word-client.js.map