hanseol 3.2.7

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 (696) 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 +15 -0
  16. package/dist/agents/planner/index.d.ts.map +1 -0
  17. package/dist/agents/planner/index.js +270 -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 +97 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/constants.d.ts +8 -0
  24. package/dist/constants.d.ts.map +1 -0
  25. package/dist/constants.js +10 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/core/auth/auth-manager.d.ts +23 -0
  28. package/dist/core/auth/auth-manager.d.ts.map +1 -0
  29. package/dist/core/auth/auth-manager.js +159 -0
  30. package/dist/core/auth/auth-manager.js.map +1 -0
  31. package/dist/core/auth/index.d.ts +4 -0
  32. package/dist/core/auth/index.d.ts.map +1 -0
  33. package/dist/core/auth/index.js +4 -0
  34. package/dist/core/auth/index.js.map +1 -0
  35. package/dist/core/auth/jwt-decoder.d.ts +7 -0
  36. package/dist/core/auth/jwt-decoder.d.ts.map +1 -0
  37. package/dist/core/auth/jwt-decoder.js +101 -0
  38. package/dist/core/auth/jwt-decoder.js.map +1 -0
  39. package/dist/core/auth/sso-client.d.ts +20 -0
  40. package/dist/core/auth/sso-client.d.ts.map +1 -0
  41. package/dist/core/auth/sso-client.js +164 -0
  42. package/dist/core/auth/sso-client.js.map +1 -0
  43. package/dist/core/auth/types.d.ts +45 -0
  44. package/dist/core/auth/types.d.ts.map +1 -0
  45. package/dist/core/auth/types.js +2 -0
  46. package/dist/core/auth/types.js.map +1 -0
  47. package/dist/core/compact/compact-manager.d.ts +22 -0
  48. package/dist/core/compact/compact-manager.d.ts.map +1 -0
  49. package/dist/core/compact/compact-manager.js +74 -0
  50. package/dist/core/compact/compact-manager.js.map +1 -0
  51. package/dist/core/compact/compact-prompts.d.ts +11 -0
  52. package/dist/core/compact/compact-prompts.d.ts.map +1 -0
  53. package/dist/core/compact/compact-prompts.js +80 -0
  54. package/dist/core/compact/compact-prompts.js.map +1 -0
  55. package/dist/core/compact/context-tracker.d.ts +28 -0
  56. package/dist/core/compact/context-tracker.d.ts.map +1 -0
  57. package/dist/core/compact/context-tracker.js +71 -0
  58. package/dist/core/compact/context-tracker.js.map +1 -0
  59. package/dist/core/compact/index.d.ts +4 -0
  60. package/dist/core/compact/index.d.ts.map +1 -0
  61. package/dist/core/compact/index.js +4 -0
  62. package/dist/core/compact/index.js.map +1 -0
  63. package/dist/core/config/config-manager.d.ts +43 -0
  64. package/dist/core/config/config-manager.d.ts.map +1 -0
  65. package/dist/core/config/config-manager.js +247 -0
  66. package/dist/core/config/config-manager.js.map +1 -0
  67. package/dist/core/config/index.d.ts +2 -0
  68. package/dist/core/config/index.d.ts.map +1 -0
  69. package/dist/core/config/index.js +2 -0
  70. package/dist/core/config/index.js.map +1 -0
  71. package/dist/core/docs-manager.d.ts +46 -0
  72. package/dist/core/docs-manager.d.ts.map +1 -0
  73. package/dist/core/docs-manager.js +475 -0
  74. package/dist/core/docs-manager.js.map +1 -0
  75. package/dist/core/llm/index.d.ts +2 -0
  76. package/dist/core/llm/index.d.ts.map +1 -0
  77. package/dist/core/llm/index.js +2 -0
  78. package/dist/core/llm/index.js.map +1 -0
  79. package/dist/core/llm/llm-client.d.ts +97 -0
  80. package/dist/core/llm/llm-client.d.ts.map +1 -0
  81. package/dist/core/llm/llm-client.js +1002 -0
  82. package/dist/core/llm/llm-client.js.map +1 -0
  83. package/dist/core/model-sync.d.ts +20 -0
  84. package/dist/core/model-sync.d.ts.map +1 -0
  85. package/dist/core/model-sync.js +182 -0
  86. package/dist/core/model-sync.js.map +1 -0
  87. package/dist/core/notification-manager.d.ts +23 -0
  88. package/dist/core/notification-manager.d.ts.map +1 -0
  89. package/dist/core/notification-manager.js +76 -0
  90. package/dist/core/notification-manager.js.map +1 -0
  91. package/dist/core/s3-auto-updater.d.ts +51 -0
  92. package/dist/core/s3-auto-updater.d.ts.map +1 -0
  93. package/dist/core/s3-auto-updater.js +292 -0
  94. package/dist/core/s3-auto-updater.js.map +1 -0
  95. package/dist/core/session/index.d.ts +2 -0
  96. package/dist/core/session/index.d.ts.map +1 -0
  97. package/dist/core/session/index.js +2 -0
  98. package/dist/core/session/index.js.map +1 -0
  99. package/dist/core/session/session-manager.d.ts +71 -0
  100. package/dist/core/session/session-manager.d.ts.map +1 -0
  101. package/dist/core/session/session-manager.js +235 -0
  102. package/dist/core/session/session-manager.js.map +1 -0
  103. package/dist/core/slash-command-handler.d.ts +32 -0
  104. package/dist/core/slash-command-handler.d.ts.map +1 -0
  105. package/dist/core/slash-command-handler.js +402 -0
  106. package/dist/core/slash-command-handler.js.map +1 -0
  107. package/dist/core/usage-tracker.d.ts +70 -0
  108. package/dist/core/usage-tracker.d.ts.map +1 -0
  109. package/dist/core/usage-tracker.js +251 -0
  110. package/dist/core/usage-tracker.js.map +1 -0
  111. package/dist/errors/base.d.ts +22 -0
  112. package/dist/errors/base.d.ts.map +1 -0
  113. package/dist/errors/base.js +43 -0
  114. package/dist/errors/base.js.map +1 -0
  115. package/dist/errors/file.d.ts +31 -0
  116. package/dist/errors/file.d.ts.map +1 -0
  117. package/dist/errors/file.js +110 -0
  118. package/dist/errors/file.js.map +1 -0
  119. package/dist/errors/index.d.ts +10 -0
  120. package/dist/errors/index.d.ts.map +1 -0
  121. package/dist/errors/index.js +41 -0
  122. package/dist/errors/index.js.map +1 -0
  123. package/dist/errors/llm.d.ts +26 -0
  124. package/dist/errors/llm.d.ts.map +1 -0
  125. package/dist/errors/llm.js +86 -0
  126. package/dist/errors/llm.js.map +1 -0
  127. package/dist/errors/network.d.ts +19 -0
  128. package/dist/errors/network.d.ts.map +1 -0
  129. package/dist/errors/network.js +82 -0
  130. package/dist/errors/network.js.map +1 -0
  131. package/dist/errors/validation.d.ts +19 -0
  132. package/dist/errors/validation.d.ts.map +1 -0
  133. package/dist/errors/validation.js +62 -0
  134. package/dist/errors/validation.js.map +1 -0
  135. package/dist/eval/eval-runner.d.ts +24 -0
  136. package/dist/eval/eval-runner.d.ts.map +1 -0
  137. package/dist/eval/eval-runner.js +291 -0
  138. package/dist/eval/eval-runner.js.map +1 -0
  139. package/dist/eval/index.d.ts +3 -0
  140. package/dist/eval/index.d.ts.map +1 -0
  141. package/dist/eval/index.js +3 -0
  142. package/dist/eval/index.js.map +1 -0
  143. package/dist/eval/types.d.ts +77 -0
  144. package/dist/eval/types.d.ts.map +1 -0
  145. package/dist/eval/types.js +2 -0
  146. package/dist/eval/types.js.map +1 -0
  147. package/dist/index.d.ts +4 -0
  148. package/dist/index.d.ts.map +1 -0
  149. package/dist/index.js +6 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/orchestration/index.d.ts +4 -0
  152. package/dist/orchestration/index.d.ts.map +1 -0
  153. package/dist/orchestration/index.js +3 -0
  154. package/dist/orchestration/index.js.map +1 -0
  155. package/dist/orchestration/plan-executor.d.ts +28 -0
  156. package/dist/orchestration/plan-executor.d.ts.map +1 -0
  157. package/dist/orchestration/plan-executor.js +368 -0
  158. package/dist/orchestration/plan-executor.js.map +1 -0
  159. package/dist/orchestration/types.d.ts +65 -0
  160. package/dist/orchestration/types.d.ts.map +1 -0
  161. package/dist/orchestration/types.js +2 -0
  162. package/dist/orchestration/types.js.map +1 -0
  163. package/dist/orchestration/utils.d.ts +13 -0
  164. package/dist/orchestration/utils.d.ts.map +1 -0
  165. package/dist/orchestration/utils.js +81 -0
  166. package/dist/orchestration/utils.js.map +1 -0
  167. package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
  168. package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
  169. package/dist/prompts/agents/docs-search-decision.js +46 -0
  170. package/dist/prompts/agents/docs-search-decision.js.map +1 -0
  171. package/dist/prompts/agents/docs-search.d.ts +4 -0
  172. package/dist/prompts/agents/docs-search.d.ts.map +1 -0
  173. package/dist/prompts/agents/docs-search.js +70 -0
  174. package/dist/prompts/agents/docs-search.js.map +1 -0
  175. package/dist/prompts/agents/planning.d.ts +4 -0
  176. package/dist/prompts/agents/planning.d.ts.map +1 -0
  177. package/dist/prompts/agents/planning.js +119 -0
  178. package/dist/prompts/agents/planning.js.map +1 -0
  179. package/dist/prompts/index.d.ts +10 -0
  180. package/dist/prompts/index.d.ts.map +1 -0
  181. package/dist/prompts/index.js +10 -0
  182. package/dist/prompts/index.js.map +1 -0
  183. package/dist/prompts/shared/codebase-rules.d.ts +4 -0
  184. package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
  185. package/dist/prompts/shared/codebase-rules.js +16 -0
  186. package/dist/prompts/shared/codebase-rules.js.map +1 -0
  187. package/dist/prompts/shared/git-rules.d.ts +2 -0
  188. package/dist/prompts/shared/git-rules.d.ts.map +1 -0
  189. package/dist/prompts/shared/git-rules.js +87 -0
  190. package/dist/prompts/shared/git-rules.js.map +1 -0
  191. package/dist/prompts/shared/language-rules.d.ts +4 -0
  192. package/dist/prompts/shared/language-rules.d.ts.map +1 -0
  193. package/dist/prompts/shared/language-rules.js +22 -0
  194. package/dist/prompts/shared/language-rules.js.map +1 -0
  195. package/dist/prompts/shared/tool-usage.d.ts +12 -0
  196. package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
  197. package/dist/prompts/shared/tool-usage.js +49 -0
  198. package/dist/prompts/shared/tool-usage.js.map +1 -0
  199. package/dist/prompts/system/compact.d.ts +3 -0
  200. package/dist/prompts/system/compact.d.ts.map +1 -0
  201. package/dist/prompts/system/compact.js +73 -0
  202. package/dist/prompts/system/compact.js.map +1 -0
  203. package/dist/prompts/system/plan-execute.d.ts +3 -0
  204. package/dist/prompts/system/plan-execute.d.ts.map +1 -0
  205. package/dist/prompts/system/plan-execute.js +83 -0
  206. package/dist/prompts/system/plan-execute.js.map +1 -0
  207. package/dist/tools/browser/browser-client.d.ts +107 -0
  208. package/dist/tools/browser/browser-client.d.ts.map +1 -0
  209. package/dist/tools/browser/browser-client.js +958 -0
  210. package/dist/tools/browser/browser-client.js.map +1 -0
  211. package/dist/tools/browser/browser-tools.d.ts +17 -0
  212. package/dist/tools/browser/browser-tools.d.ts.map +1 -0
  213. package/dist/tools/browser/browser-tools.js +888 -0
  214. package/dist/tools/browser/browser-tools.js.map +1 -0
  215. package/dist/tools/browser/index.d.ts +7 -0
  216. package/dist/tools/browser/index.d.ts.map +1 -0
  217. package/dist/tools/browser/index.js +17 -0
  218. package/dist/tools/browser/index.js.map +1 -0
  219. package/dist/tools/index.d.ts +4 -0
  220. package/dist/tools/index.d.ts.map +1 -0
  221. package/dist/tools/index.js +4 -0
  222. package/dist/tools/index.js.map +1 -0
  223. package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
  224. package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
  225. package/dist/tools/llm/agents/docs-search-tools.js +265 -0
  226. package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
  227. package/dist/tools/llm/agents/index.d.ts +4 -0
  228. package/dist/tools/llm/agents/index.d.ts.map +1 -0
  229. package/dist/tools/llm/agents/index.js +3 -0
  230. package/dist/tools/llm/agents/index.js.map +1 -0
  231. package/dist/tools/llm/index.d.ts +3 -0
  232. package/dist/tools/llm/index.d.ts.map +1 -0
  233. package/dist/tools/llm/index.js +3 -0
  234. package/dist/tools/llm/index.js.map +1 -0
  235. package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
  236. package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
  237. package/dist/tools/llm/simple/ask-user-tool.js +7 -0
  238. package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
  239. package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
  240. package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
  241. package/dist/tools/llm/simple/background-bash-tool.js +320 -0
  242. package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
  243. package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
  244. package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
  245. package/dist/tools/llm/simple/background-powershell-tool.js +302 -0
  246. package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
  247. package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
  248. package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
  249. package/dist/tools/llm/simple/bash-tool.js +167 -0
  250. package/dist/tools/llm/simple/bash-tool.js.map +1 -0
  251. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
  252. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
  253. package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
  254. package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
  255. package/dist/tools/llm/simple/file-tools.d.ts +12 -0
  256. package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
  257. package/dist/tools/llm/simple/file-tools.js +597 -0
  258. package/dist/tools/llm/simple/file-tools.js.map +1 -0
  259. package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
  260. package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
  261. package/dist/tools/llm/simple/final-response-tool.js +107 -0
  262. package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
  263. package/dist/tools/llm/simple/index.d.ts +11 -0
  264. package/dist/tools/llm/simple/index.d.ts.map +1 -0
  265. package/dist/tools/llm/simple/index.js +20 -0
  266. package/dist/tools/llm/simple/index.js.map +1 -0
  267. package/dist/tools/llm/simple/planning-tools.d.ts +5 -0
  268. package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
  269. package/dist/tools/llm/simple/planning-tools.js +117 -0
  270. package/dist/tools/llm/simple/planning-tools.js.map +1 -0
  271. package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
  272. package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
  273. package/dist/tools/llm/simple/powershell-tool.js +150 -0
  274. package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
  275. package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
  276. package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
  277. package/dist/tools/llm/simple/simple-tool-executor.js +132 -0
  278. package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
  279. package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
  280. package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
  281. package/dist/tools/llm/simple/todo-tools.js +145 -0
  282. package/dist/tools/llm/simple/todo-tools.js.map +1 -0
  283. package/dist/tools/llm/simple/user-interaction-tools.d.ts +21 -0
  284. package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
  285. package/dist/tools/llm/simple/user-interaction-tools.js +167 -0
  286. package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
  287. package/dist/tools/office/common/constants.d.ts +194 -0
  288. package/dist/tools/office/common/constants.d.ts.map +1 -0
  289. package/dist/tools/office/common/constants.js +169 -0
  290. package/dist/tools/office/common/constants.js.map +1 -0
  291. package/dist/tools/office/common/index.d.ts +4 -0
  292. package/dist/tools/office/common/index.d.ts.map +1 -0
  293. package/dist/tools/office/common/index.js +3 -0
  294. package/dist/tools/office/common/index.js.map +1 -0
  295. package/dist/tools/office/common/types.d.ts +82 -0
  296. package/dist/tools/office/common/types.d.ts.map +1 -0
  297. package/dist/tools/office/common/types.js +2 -0
  298. package/dist/tools/office/common/types.js.map +1 -0
  299. package/dist/tools/office/common/utils.d.ts +14 -0
  300. package/dist/tools/office/common/utils.d.ts.map +1 -0
  301. package/dist/tools/office/common/utils.js +58 -0
  302. package/dist/tools/office/common/utils.js.map +1 -0
  303. package/dist/tools/office/excel-client.d.ts +123 -0
  304. package/dist/tools/office/excel-client.d.ts.map +1 -0
  305. package/dist/tools/office/excel-client.js +1037 -0
  306. package/dist/tools/office/excel-client.js.map +1 -0
  307. package/dist/tools/office/excel-tools/cells.d.ts +10 -0
  308. package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
  309. package/dist/tools/office/excel-tools/cells.js +279 -0
  310. package/dist/tools/office/excel-tools/cells.js.map +1 -0
  311. package/dist/tools/office/excel-tools/charts.d.ts +6 -0
  312. package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
  313. package/dist/tools/office/excel-tools/charts.js +124 -0
  314. package/dist/tools/office/excel-tools/charts.js.map +1 -0
  315. package/dist/tools/office/excel-tools/comments.d.ts +6 -0
  316. package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
  317. package/dist/tools/office/excel-tools/comments.js +114 -0
  318. package/dist/tools/office/excel-tools/comments.js.map +1 -0
  319. package/dist/tools/office/excel-tools/data-ops.d.ts +10 -0
  320. package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
  321. package/dist/tools/office/excel-tools/data-ops.js +266 -0
  322. package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
  323. package/dist/tools/office/excel-tools/export.d.ts +5 -0
  324. package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
  325. package/dist/tools/office/excel-tools/export.js +75 -0
  326. package/dist/tools/office/excel-tools/export.js.map +1 -0
  327. package/dist/tools/office/excel-tools/formatting.d.ts +10 -0
  328. package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
  329. package/dist/tools/office/excel-tools/formatting.js +276 -0
  330. package/dist/tools/office/excel-tools/formatting.js.map +1 -0
  331. package/dist/tools/office/excel-tools/index.d.ts +16 -0
  332. package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
  333. package/dist/tools/office/excel-tools/index.js +42 -0
  334. package/dist/tools/office/excel-tools/index.js.map +1 -0
  335. package/dist/tools/office/excel-tools/launch.d.ts +10 -0
  336. package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
  337. package/dist/tools/office/excel-tools/launch.js +248 -0
  338. package/dist/tools/office/excel-tools/launch.js.map +1 -0
  339. package/dist/tools/office/excel-tools/media.d.ts +5 -0
  340. package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
  341. package/dist/tools/office/excel-tools/media.js +84 -0
  342. package/dist/tools/office/excel-tools/media.js.map +1 -0
  343. package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
  344. package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
  345. package/dist/tools/office/excel-tools/named-ranges.js +113 -0
  346. package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
  347. package/dist/tools/office/excel-tools/protection.d.ts +5 -0
  348. package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
  349. package/dist/tools/office/excel-tools/protection.js +75 -0
  350. package/dist/tools/office/excel-tools/protection.js.map +1 -0
  351. package/dist/tools/office/excel-tools/rows-columns.d.ts +11 -0
  352. package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
  353. package/dist/tools/office/excel-tools/rows-columns.js +293 -0
  354. package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
  355. package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
  356. package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
  357. package/dist/tools/office/excel-tools/sheets.js +177 -0
  358. package/dist/tools/office/excel-tools/sheets.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 +29 -0
  372. package/dist/tools/office/office-client-base.d.ts.map +1 -0
  373. package/dist/tools/office/office-client-base.js +148 -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 +135 -0
  380. package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
  381. package/dist/tools/office/powerpoint-client.js +1136 -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 +246 -0
  386. package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
  387. package/dist/tools/office/powerpoint-tools/export.d.ts +6 -0
  388. package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
  389. package/dist/tools/office/powerpoint-tools/export.js +108 -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 +211 -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 +171 -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 +104 -0
  410. package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
  411. package/dist/tools/office/powerpoint-tools/shapes.d.ts +22 -0
  412. package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
  413. package/dist/tools/office/powerpoint-tools/shapes.js +681 -0
  414. package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
  415. package/dist/tools/office/powerpoint-tools/slides.d.ts +11 -0
  416. package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
  417. package/dist/tools/office/powerpoint-tools/slides.js +283 -0
  418. package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
  419. package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
  420. package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
  421. package/dist/tools/office/powerpoint-tools/tables.js +132 -0
  422. package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
  423. package/dist/tools/office/powerpoint-tools/text.d.ts +12 -0
  424. package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
  425. package/dist/tools/office/powerpoint-tools/text.js +366 -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 +111 -0
  432. package/dist/tools/office/word-client.d.ts.map +1 -0
  433. package/dist/tools/office/word-client.js +995 -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/formatting.d.ts +6 -0
  452. package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
  453. package/dist/tools/office/word-tools/formatting.js +129 -0
  454. package/dist/tools/office/word-tools/formatting.js.map +1 -0
  455. package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
  456. package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
  457. package/dist/tools/office/word-tools/headers-footers.js +117 -0
  458. package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
  459. package/dist/tools/office/word-tools/index.d.ts +16 -0
  460. package/dist/tools/office/word-tools/index.d.ts.map +1 -0
  461. package/dist/tools/office/word-tools/index.js +45 -0
  462. package/dist/tools/office/word-tools/index.js.map +1 -0
  463. package/dist/tools/office/word-tools/launch.d.ts +10 -0
  464. package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
  465. package/dist/tools/office/word-tools/launch.js +255 -0
  466. package/dist/tools/office/word-tools/launch.js.map +1 -0
  467. package/dist/tools/office/word-tools/lists.d.ts +5 -0
  468. package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
  469. package/dist/tools/office/word-tools/lists.js +73 -0
  470. package/dist/tools/office/word-tools/lists.js.map +1 -0
  471. package/dist/tools/office/word-tools/navigation.d.ts +5 -0
  472. package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
  473. package/dist/tools/office/word-tools/navigation.js +85 -0
  474. package/dist/tools/office/word-tools/navigation.js.map +1 -0
  475. package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
  476. package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
  477. package/dist/tools/office/word-tools/page-setup.js +152 -0
  478. package/dist/tools/office/word-tools/page-setup.js.map +1 -0
  479. package/dist/tools/office/word-tools/tables.d.ts +8 -0
  480. package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
  481. package/dist/tools/office/word-tools/tables.js +197 -0
  482. package/dist/tools/office/word-tools/tables.js.map +1 -0
  483. package/dist/tools/office/word-tools/text.d.ts +9 -0
  484. package/dist/tools/office/word-tools/text.d.ts.map +1 -0
  485. package/dist/tools/office/word-tools/text.js +235 -0
  486. package/dist/tools/office/word-tools/text.js.map +1 -0
  487. package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
  488. package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
  489. package/dist/tools/office/word-tools/undo-redo.js +73 -0
  490. package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
  491. package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
  492. package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
  493. package/dist/tools/office/word-tools/watermarks.js +81 -0
  494. package/dist/tools/office/word-tools/watermarks.js.map +1 -0
  495. package/dist/tools/office/word-tools.d.ts +3 -0
  496. package/dist/tools/office/word-tools.d.ts.map +1 -0
  497. package/dist/tools/office/word-tools.js +3 -0
  498. package/dist/tools/office/word-tools.js.map +1 -0
  499. package/dist/tools/registry.d.ts +46 -0
  500. package/dist/tools/registry.d.ts.map +1 -0
  501. package/dist/tools/registry.js +258 -0
  502. package/dist/tools/registry.js.map +1 -0
  503. package/dist/tools/types.d.ts +88 -0
  504. package/dist/tools/types.d.ts.map +1 -0
  505. package/dist/tools/types.js +19 -0
  506. package/dist/tools/types.js.map +1 -0
  507. package/dist/types/index.d.ts +122 -0
  508. package/dist/types/index.d.ts.map +1 -0
  509. package/dist/types/index.js +2 -0
  510. package/dist/types/index.js.map +1 -0
  511. package/dist/ui/PlanExecuteView.d.ts +11 -0
  512. package/dist/ui/PlanExecuteView.d.ts.map +1 -0
  513. package/dist/ui/PlanExecuteView.js +27 -0
  514. package/dist/ui/PlanExecuteView.js.map +1 -0
  515. package/dist/ui/TodoPanel.d.ts +13 -0
  516. package/dist/ui/TodoPanel.d.ts.map +1 -0
  517. package/dist/ui/TodoPanel.js +135 -0
  518. package/dist/ui/TodoPanel.js.map +1 -0
  519. package/dist/ui/UpdateNotification.d.ts +13 -0
  520. package/dist/ui/UpdateNotification.d.ts.map +1 -0
  521. package/dist/ui/UpdateNotification.js +42 -0
  522. package/dist/ui/UpdateNotification.js.map +1 -0
  523. package/dist/ui/components/ActivityIndicator.d.ts +25 -0
  524. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
  525. package/dist/ui/components/ActivityIndicator.js +115 -0
  526. package/dist/ui/components/ActivityIndicator.js.map +1 -0
  527. package/dist/ui/components/CommandBrowser.d.ts +10 -0
  528. package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
  529. package/dist/ui/components/CommandBrowser.js +53 -0
  530. package/dist/ui/components/CommandBrowser.js.map +1 -0
  531. package/dist/ui/components/CustomTextInput.d.ts +13 -0
  532. package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
  533. package/dist/ui/components/CustomTextInput.js +245 -0
  534. package/dist/ui/components/CustomTextInput.js.map +1 -0
  535. package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
  536. package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
  537. package/dist/ui/components/DocsSearchProgress.js +37 -0
  538. package/dist/ui/components/DocsSearchProgress.js.map +1 -0
  539. package/dist/ui/components/FileBrowser.d.ts +11 -0
  540. package/dist/ui/components/FileBrowser.d.ts.map +1 -0
  541. package/dist/ui/components/FileBrowser.js +45 -0
  542. package/dist/ui/components/FileBrowser.js.map +1 -0
  543. package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
  544. package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
  545. package/dist/ui/components/LLMSetupWizard.js +183 -0
  546. package/dist/ui/components/LLMSetupWizard.js.map +1 -0
  547. package/dist/ui/components/Logo.d.ts +19 -0
  548. package/dist/ui/components/Logo.d.ts.map +1 -0
  549. package/dist/ui/components/Logo.js +99 -0
  550. package/dist/ui/components/Logo.js.map +1 -0
  551. package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
  552. package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
  553. package/dist/ui/components/MarkdownRenderer.js +198 -0
  554. package/dist/ui/components/MarkdownRenderer.js.map +1 -0
  555. package/dist/ui/components/ModelSelector.d.ts +8 -0
  556. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  557. package/dist/ui/components/ModelSelector.js +111 -0
  558. package/dist/ui/components/ModelSelector.js.map +1 -0
  559. package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
  560. package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
  561. package/dist/ui/components/PlanExecuteApp.js +1432 -0
  562. package/dist/ui/components/PlanExecuteApp.js.map +1 -0
  563. package/dist/ui/components/ProgressBar.d.ts +10 -0
  564. package/dist/ui/components/ProgressBar.d.ts.map +1 -0
  565. package/dist/ui/components/ProgressBar.js +26 -0
  566. package/dist/ui/components/ProgressBar.js.map +1 -0
  567. package/dist/ui/components/StatusBar.d.ts +23 -0
  568. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  569. package/dist/ui/components/StatusBar.js +162 -0
  570. package/dist/ui/components/StatusBar.js.map +1 -0
  571. package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
  572. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  573. package/dist/ui/components/ThinkingIndicator.js +63 -0
  574. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  575. package/dist/ui/components/TodoListView.d.ts +11 -0
  576. package/dist/ui/components/TodoListView.d.ts.map +1 -0
  577. package/dist/ui/components/TodoListView.js +69 -0
  578. package/dist/ui/components/TodoListView.js.map +1 -0
  579. package/dist/ui/components/ToolSelector.d.ts +7 -0
  580. package/dist/ui/components/ToolSelector.d.ts.map +1 -0
  581. package/dist/ui/components/ToolSelector.js +112 -0
  582. package/dist/ui/components/ToolSelector.js.map +1 -0
  583. package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
  584. package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
  585. package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
  586. package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
  587. package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
  588. package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
  589. package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
  590. package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
  591. package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
  592. package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
  593. package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
  594. package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
  595. package/dist/ui/components/dialogs/RatingDialog.d.ts +9 -0
  596. package/dist/ui/components/dialogs/RatingDialog.d.ts.map +1 -0
  597. package/dist/ui/components/dialogs/RatingDialog.js +54 -0
  598. package/dist/ui/components/dialogs/RatingDialog.js.map +1 -0
  599. package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
  600. package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
  601. package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
  602. package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
  603. package/dist/ui/components/dialogs/index.d.ts +4 -0
  604. package/dist/ui/components/dialogs/index.d.ts.map +1 -0
  605. package/dist/ui/components/dialogs/index.js +4 -0
  606. package/dist/ui/components/dialogs/index.js.map +1 -0
  607. package/dist/ui/components/index.d.ts +12 -0
  608. package/dist/ui/components/index.d.ts.map +1 -0
  609. package/dist/ui/components/index.js +9 -0
  610. package/dist/ui/components/index.js.map +1 -0
  611. package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
  612. package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
  613. package/dist/ui/components/panels/SessionPanel.js +81 -0
  614. package/dist/ui/components/panels/SessionPanel.js.map +1 -0
  615. package/dist/ui/components/panels/index.d.ts +3 -0
  616. package/dist/ui/components/panels/index.d.ts.map +1 -0
  617. package/dist/ui/components/panels/index.js +3 -0
  618. package/dist/ui/components/panels/index.js.map +1 -0
  619. package/dist/ui/components/views/ChatView.d.ts +12 -0
  620. package/dist/ui/components/views/ChatView.d.ts.map +1 -0
  621. package/dist/ui/components/views/ChatView.js +289 -0
  622. package/dist/ui/components/views/ChatView.js.map +1 -0
  623. package/dist/ui/components/views/index.d.ts +2 -0
  624. package/dist/ui/components/views/index.d.ts.map +1 -0
  625. package/dist/ui/components/views/index.js +2 -0
  626. package/dist/ui/components/views/index.js.map +1 -0
  627. package/dist/ui/contexts/TokenContext.d.ts +29 -0
  628. package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
  629. package/dist/ui/contexts/TokenContext.js +79 -0
  630. package/dist/ui/contexts/TokenContext.js.map +1 -0
  631. package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
  632. package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
  633. package/dist/ui/hooks/atFileProcessor.js +88 -0
  634. package/dist/ui/hooks/atFileProcessor.js.map +1 -0
  635. package/dist/ui/hooks/index.d.ts +8 -0
  636. package/dist/ui/hooks/index.d.ts.map +1 -0
  637. package/dist/ui/hooks/index.js +8 -0
  638. package/dist/ui/hooks/index.js.map +1 -0
  639. package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
  640. package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
  641. package/dist/ui/hooks/slashCommandProcessor.js +100 -0
  642. package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
  643. package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
  644. package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
  645. package/dist/ui/hooks/useCommandBrowserState.js +66 -0
  646. package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
  647. package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
  648. package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
  649. package/dist/ui/hooks/useFileBrowserState.js +79 -0
  650. package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
  651. package/dist/ui/hooks/useFileList.d.ts +20 -0
  652. package/dist/ui/hooks/useFileList.d.ts.map +1 -0
  653. package/dist/ui/hooks/useFileList.js +56 -0
  654. package/dist/ui/hooks/useFileList.js.map +1 -0
  655. package/dist/ui/hooks/useInputHistory.d.ts +9 -0
  656. package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
  657. package/dist/ui/hooks/useInputHistory.js +68 -0
  658. package/dist/ui/hooks/useInputHistory.js.map +1 -0
  659. package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
  660. package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
  661. package/dist/ui/hooks/usePlanExecution.js +208 -0
  662. package/dist/ui/hooks/usePlanExecution.js.map +1 -0
  663. package/dist/ui/index.d.ts +7 -0
  664. package/dist/ui/index.d.ts.map +1 -0
  665. package/dist/ui/index.js +7 -0
  666. package/dist/ui/index.js.map +1 -0
  667. package/dist/ui/ink-entry.d.ts +3 -0
  668. package/dist/ui/ink-entry.d.ts.map +1 -0
  669. package/dist/ui/ink-entry.js +21 -0
  670. package/dist/ui/ink-entry.js.map +1 -0
  671. package/dist/utils/file-system.d.ts +9 -0
  672. package/dist/utils/file-system.d.ts.map +1 -0
  673. package/dist/utils/file-system.js +99 -0
  674. package/dist/utils/file-system.js.map +1 -0
  675. package/dist/utils/git-utils.d.ts +2 -0
  676. package/dist/utils/git-utils.d.ts.map +1 -0
  677. package/dist/utils/git-utils.js +16 -0
  678. package/dist/utils/git-utils.js.map +1 -0
  679. package/dist/utils/json-stream-logger.d.ts +52 -0
  680. package/dist/utils/json-stream-logger.d.ts.map +1 -0
  681. package/dist/utils/json-stream-logger.js +442 -0
  682. package/dist/utils/json-stream-logger.js.map +1 -0
  683. package/dist/utils/logger.d.ts +86 -0
  684. package/dist/utils/logger.d.ts.map +1 -0
  685. package/dist/utils/logger.js +588 -0
  686. package/dist/utils/logger.js.map +1 -0
  687. package/dist/utils/platform-utils.d.ts +19 -0
  688. package/dist/utils/platform-utils.d.ts.map +1 -0
  689. package/dist/utils/platform-utils.js +134 -0
  690. package/dist/utils/platform-utils.js.map +1 -0
  691. package/dist/utils/wsl-utils.d.ts +4 -0
  692. package/dist/utils/wsl-utils.d.ts.map +1 -0
  693. package/dist/utils/wsl-utils.js +72 -0
  694. package/dist/utils/wsl-utils.js.map +1 -0
  695. package/package.json +150 -0
  696. package/scripts/patch-yoga.js +48 -0
@@ -0,0 +1,1037 @@
1
+ import { OfficeClientBase } from './office-client-base.js';
2
+ function columnLetterToNumber(column) {
3
+ let result = 0;
4
+ for (let i = 0; i < column.length; i++) {
5
+ result = result * 26 + (column.charCodeAt(i) - 'A'.charCodeAt(0) + 1);
6
+ }
7
+ return result;
8
+ }
9
+ function columnNumberToLetter(num) {
10
+ let result = '';
11
+ while (num > 0) {
12
+ num--;
13
+ result = String.fromCharCode('A'.charCodeAt(0) + (num % 26)) + result;
14
+ num = Math.floor(num / 26);
15
+ }
16
+ return result;
17
+ }
18
+ export class ExcelClient extends OfficeClientBase {
19
+ async excelLaunch() {
20
+ return this.executePowerShell(`
21
+ try {
22
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
23
+ $excel.Visible = $true
24
+ @{ success = $true; message = "Connected to existing Excel instance" } | ConvertTo-Json -Compress
25
+ } catch {
26
+ $excel = New-Object -ComObject Excel.Application
27
+ $excel.Visible = $true
28
+ @{ success = $true; message = "Launched new Excel instance" } | ConvertTo-Json -Compress
29
+ }
30
+ `);
31
+ }
32
+ async excelCreate() {
33
+ return this.executePowerShell(`
34
+ try {
35
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
36
+ } catch {
37
+ $excel = New-Object -ComObject Excel.Application
38
+ $excel.Visible = $true
39
+ }
40
+ $workbook = $excel.Workbooks.Add()
41
+ @{ success = $true; message = "Created new workbook"; workbook_name = $workbook.Name } | ConvertTo-Json -Compress
42
+ `);
43
+ }
44
+ async excelOpen(filePath) {
45
+ const windowsPath = this.toWindowsPath(filePath).replace(/'/g, "''");
46
+ return this.executePowerShell(`
47
+ try {
48
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
49
+ } catch {
50
+ $excel = New-Object -ComObject Excel.Application
51
+ $excel.Visible = $true
52
+ }
53
+ $workbook = $excel.Workbooks.Open('${windowsPath}')
54
+ @{ success = $true; message = "Workbook opened"; workbook_name = $workbook.Name; path = $workbook.FullName } | ConvertTo-Json -Compress
55
+ `);
56
+ }
57
+ async excelWriteCell(cell, value, sheet, options) {
58
+ const strValue = String(value);
59
+ const escapedValue = strValue.replace(/'/g, "''");
60
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
61
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(strValue);
62
+ const fontName = options?.fontName || (hasKorean ? 'Malgun Gothic' : '');
63
+ const fontScript = [];
64
+ if (fontName)
65
+ fontScript.push(`$range.Font.Name = '${fontName.replace(/'/g, "''")}'`);
66
+ if (options?.fontSize)
67
+ fontScript.push(`$range.Font.Size = ${options.fontSize}`);
68
+ if (options?.bold !== undefined)
69
+ fontScript.push(`$range.Font.Bold = ${options.bold ? '$true' : '$false'}`);
70
+ let valueScript;
71
+ if (options?.asText) {
72
+ valueScript = `$range.NumberFormat = '@'; $range.Value = '${escapedValue}'`;
73
+ }
74
+ else if (typeof value === 'number' || (strValue !== '' && !isNaN(Number(strValue)) && strValue.trim() !== '')) {
75
+ valueScript = `$range.Value = ${strValue}`;
76
+ }
77
+ else if (/^\d{4}-\d{2}-\d{2}$/.test(strValue)) {
78
+ const [year, month, day] = strValue.split('-');
79
+ valueScript = `$range.Value = (Get-Date -Year ${year} -Month ${month} -Day ${day}).ToOADate()`;
80
+ }
81
+ else if (/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(strValue)) {
82
+ valueScript = `$range.Value = '${escapedValue}'`;
83
+ }
84
+ else {
85
+ valueScript = `$range.Value = '${escapedValue}'`;
86
+ }
87
+ return this.executePowerShell(`
88
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
89
+ $workbook = $excel.ActiveWorkbook
90
+ ${sheetScript}
91
+ $range = $sheet.Range('${cell}')
92
+ ${valueScript}
93
+ ${fontScript.join('\n')}
94
+ @{ success = $true; message = "Value written to ${cell}" } | ConvertTo-Json -Compress
95
+ `);
96
+ }
97
+ async excelReadCell(cell, sheet) {
98
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
99
+ return this.executePowerShell(`
100
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
101
+ $workbook = $excel.ActiveWorkbook
102
+ ${sheetScript}
103
+ $value = $sheet.Range('${cell}').Value2
104
+ @{ success = $true; cell = '${cell}'; value = $value } | ConvertTo-Json -Compress
105
+ `);
106
+ }
107
+ async excelWriteRange(startCell, values, sheet) {
108
+ const rows = values.length;
109
+ const cols = values[0]?.length || 0;
110
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
111
+ let hasKorean = false;
112
+ const toPsValue = (v) => {
113
+ const str = String(v);
114
+ if (/[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(str))
115
+ hasKorean = true;
116
+ if (typeof v === 'number' || (str !== '' && !isNaN(Number(str)) && str.trim() !== '')) {
117
+ return str;
118
+ }
119
+ if (/^\d{4}-\d{2}-\d{2}$/.test(str)) {
120
+ const [year, month, day] = str.split('-');
121
+ return `([DateTime]::new(${year},${month},${day})).ToOADate()`;
122
+ }
123
+ return `'${str.replace(/'/g, "''")}'`;
124
+ };
125
+ const arrayLines = [];
126
+ for (let i = 0; i < values.length; i++) {
127
+ const row = values[i];
128
+ if (!row)
129
+ continue;
130
+ const rowValues = row.map(v => toPsValue(v)).join(',');
131
+ arrayLines.push(`@(${rowValues})`);
132
+ }
133
+ const arrayScript = `@(${arrayLines.join(',')})`;
134
+ const fontScript = hasKorean ? "$range.Font.Name = 'Malgun Gothic'" : '';
135
+ return this.executePowerShell(`
136
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
137
+ $workbook = $excel.ActiveWorkbook
138
+ ${sheetScript}
139
+ $startRange = $sheet.Range('${startCell}')
140
+ $endCell = $sheet.Cells($startRange.Row + ${rows - 1}, $startRange.Column + ${cols - 1})
141
+ $range = $sheet.Range($startRange, $endCell)
142
+ $data = ${arrayScript}
143
+ $range.Value = $data
144
+ ${fontScript}
145
+ @{ success = $true; message = "Range written from ${startCell} (${rows}x${cols})" } | ConvertTo-Json -Compress
146
+ `);
147
+ }
148
+ async excelReadRange(range, sheet) {
149
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
150
+ return this.executePowerShell(`
151
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
152
+ $workbook = $excel.ActiveWorkbook
153
+ ${sheetScript}
154
+ $range = $sheet.Range('${range}')
155
+ $values = $range.Value2
156
+ $rows = $range.Rows.Count
157
+ $cols = $range.Columns.Count
158
+ @{ success = $true; range = '${range}'; values = $values; rows = $rows; columns = $cols } | ConvertTo-Json -Compress -Depth 10
159
+ `);
160
+ }
161
+ async excelSave(filePath) {
162
+ const windowsPath = filePath ? this.toWindowsPath(filePath).replace(/'/g, "''") : '';
163
+ return this.executePowerShell(`
164
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
165
+ $workbook = $excel.ActiveWorkbook
166
+ ${windowsPath ? `$workbook.SaveAs('${windowsPath}')` : '$workbook.Save()'}
167
+ @{ success = $true; message = "Workbook saved"; path = $workbook.FullName } | ConvertTo-Json -Compress
168
+ `);
169
+ }
170
+ async excelClose(save = false) {
171
+ return this.executePowerShell(`
172
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
173
+ $workbook = $excel.ActiveWorkbook
174
+ $workbook.Close(${save ? '$true' : '$false'})
175
+ @{ success = $true; message = "Workbook closed" } | ConvertTo-Json -Compress
176
+ `);
177
+ }
178
+ async excelQuit(save = false) {
179
+ return this.executePowerShell(`
180
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
181
+ if (${save ? '$true' : '$false'}) {
182
+ foreach ($wb in $excel.Workbooks) { $wb.Save() }
183
+ }
184
+ $excel.Quit()
185
+ @{ success = $true; message = "Excel closed" } | ConvertTo-Json -Compress
186
+ `);
187
+ }
188
+ async excelSetFormula(cell, formula, sheet) {
189
+ const escapedFormula = formula.replace(/'/g, "''");
190
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
191
+ return this.executePowerShell(`
192
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
193
+ $workbook = $excel.ActiveWorkbook
194
+ ${sheetScript}
195
+ $sheet.Range('${cell}').Formula = '${escapedFormula}'
196
+ @{ success = $true; message = "Formula set in ${cell}" } | ConvertTo-Json -Compress
197
+ `);
198
+ }
199
+ async excelSetFont(range, options, sheet) {
200
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
201
+ const commands = [];
202
+ if (options.fontName)
203
+ commands.push(`$range.Font.Name = '${options.fontName.replace(/'/g, "''")}'`);
204
+ if (options.fontSize)
205
+ commands.push(`$range.Font.Size = ${options.fontSize}`);
206
+ if (options.bold !== undefined)
207
+ commands.push(`$range.Font.Bold = ${options.bold ? '$true' : '$false'}`);
208
+ if (options.italic !== undefined)
209
+ commands.push(`$range.Font.Italic = ${options.italic ? '$true' : '$false'}`);
210
+ if (options.underline !== undefined)
211
+ commands.push(`$range.Font.Underline = ${options.underline ? '2' : '0'}`);
212
+ if (options.color) {
213
+ const rgb = this.hexToRgb(options.color);
214
+ if (rgb)
215
+ commands.push(`$range.Font.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`);
216
+ }
217
+ return this.executePowerShell(`
218
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
219
+ $workbook = $excel.ActiveWorkbook
220
+ ${sheetScript}
221
+ $range = $sheet.Range('${range}')
222
+ ${commands.join('\n')}
223
+ @{ success = $true; message = "Font properties set for ${range}" } | ConvertTo-Json -Compress
224
+ `);
225
+ }
226
+ async excelSetAlignment(range, options, sheet) {
227
+ const hAlignMap = { left: -4131, center: -4108, right: -4152 };
228
+ const vAlignMap = { top: -4160, center: -4108, bottom: -4107 };
229
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
230
+ const commands = [];
231
+ if (options.horizontal)
232
+ commands.push(`$range.HorizontalAlignment = ${hAlignMap[options.horizontal]}`);
233
+ if (options.vertical)
234
+ commands.push(`$range.VerticalAlignment = ${vAlignMap[options.vertical]}`);
235
+ if (options.wrapText !== undefined)
236
+ commands.push(`$range.WrapText = ${options.wrapText ? '$true' : '$false'}`);
237
+ if (options.orientation !== undefined)
238
+ commands.push(`$range.Orientation = ${options.orientation}`);
239
+ return this.executePowerShell(`
240
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
241
+ $workbook = $excel.ActiveWorkbook
242
+ ${sheetScript}
243
+ $range = $sheet.Range('${range}')
244
+ ${commands.join('\n')}
245
+ @{ success = $true; message = "Alignment set for ${range}" } | ConvertTo-Json -Compress
246
+ `);
247
+ }
248
+ async excelSetColumnWidth(column, width, autoFit, sheet) {
249
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
250
+ return this.executePowerShell(`
251
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
252
+ $workbook = $excel.ActiveWorkbook
253
+ ${sheetScript}
254
+ $col = $sheet.Columns('${column}')
255
+ ${autoFit ? '$col.AutoFit()' : `$col.ColumnWidth = ${width || 10}`}
256
+ @{ success = $true; message = "Column ${column} width set" } | ConvertTo-Json -Compress
257
+ `);
258
+ }
259
+ async excelSetRowHeight(row, height, autoFit, sheet) {
260
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
261
+ return this.executePowerShell(`
262
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
263
+ $workbook = $excel.ActiveWorkbook
264
+ ${sheetScript}
265
+ $row = $sheet.Rows(${row})
266
+ ${autoFit ? '$row.AutoFit()' : `$row.RowHeight = ${height || 15}`}
267
+ @{ success = $true; message = "Row ${row} height set" } | ConvertTo-Json -Compress
268
+ `);
269
+ }
270
+ async excelMergeCells(range, sheet) {
271
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
272
+ return this.executePowerShell(`
273
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
274
+ $workbook = $excel.ActiveWorkbook
275
+ ${sheetScript}
276
+ $sheet.Range('${range}').Merge()
277
+ @{ success = $true; message = "Cells merged: ${range}" } | ConvertTo-Json -Compress
278
+ `);
279
+ }
280
+ async excelSetBorder(range, options, sheet) {
281
+ const styleMap = { thin: 1, medium: 1, thick: 1, double: -4119, dotted: -4118, dashed: -4115 };
282
+ const weightMap = { thin: 2, medium: -4138, thick: 4, double: 2, dotted: 2, dashed: 2 };
283
+ const edgeMap = { left: 7, right: 10, top: 8, bottom: 9, all: -1 };
284
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
285
+ const edges = options.edges || ['all'];
286
+ const borderStyle = options.style ? styleMap[options.style] : 1;
287
+ const borderWeight = options.style ? weightMap[options.style] : 2;
288
+ let borderScript = '';
289
+ if (edges.includes('all')) {
290
+ borderScript = `
291
+ $range.Borders.LineStyle = ${borderStyle}
292
+ $range.Borders.Weight = ${borderWeight}`;
293
+ }
294
+ else {
295
+ borderScript = edges.map(e => `$range.Borders(${edgeMap[e]}).LineStyle = ${borderStyle}
296
+ $range.Borders(${edgeMap[e]}).Weight = ${borderWeight}`).join('\n');
297
+ }
298
+ return this.executePowerShell(`
299
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
300
+ $workbook = $excel.ActiveWorkbook
301
+ ${sheetScript}
302
+ $range = $sheet.Range('${range}')
303
+ ${borderScript}
304
+ @{ success = $true; message = "Border set for ${range}" } | ConvertTo-Json -Compress
305
+ `);
306
+ }
307
+ async excelSetFill(range, color, sheet) {
308
+ const rgb = this.hexToRgb(color);
309
+ const colorValue = rgb ? rgb.r + rgb.g * 256 + rgb.b * 65536 : 0;
310
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
311
+ return this.executePowerShell(`
312
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
313
+ $workbook = $excel.ActiveWorkbook
314
+ ${sheetScript}
315
+ $sheet.Range('${range}').Interior.Color = ${colorValue}
316
+ @{ success = $true; message = "Fill color set for ${range}" } | ConvertTo-Json -Compress
317
+ `);
318
+ }
319
+ async excelSetNumberFormat(range, format, sheet) {
320
+ const escapedFormat = format.replace(/'/g, "''");
321
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
322
+ return this.executePowerShell(`
323
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
324
+ $workbook = $excel.ActiveWorkbook
325
+ ${sheetScript}
326
+ $sheet.Range('${range}').NumberFormat = '${escapedFormat}'
327
+ @{ success = $true; message = "Number format set for ${range}" } | ConvertTo-Json -Compress
328
+ `);
329
+ }
330
+ async excelAddSheet(name, position) {
331
+ const escapedName = name?.replace(/'/g, "''") || '';
332
+ let positionScript = '';
333
+ if (position === 'start') {
334
+ positionScript = ', [ref]$workbook.Sheets(1)';
335
+ }
336
+ else if (position === 'end') {
337
+ positionScript = ', , [ref]$workbook.Sheets($workbook.Sheets.Count)';
338
+ }
339
+ else if (position) {
340
+ positionScript = `, , [ref]$workbook.Sheets('${position.replace(/'/g, "''")}')`;
341
+ }
342
+ return this.executePowerShell(`
343
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
344
+ $workbook = $excel.ActiveWorkbook
345
+ $newSheet = $workbook.Sheets.Add(${positionScript})
346
+ ${escapedName ? `$newSheet.Name = '${escapedName}'` : ''}
347
+ @{ success = $true; message = "Sheet added"; sheet_name = $newSheet.Name } | ConvertTo-Json -Compress
348
+ `);
349
+ }
350
+ async excelDeleteSheet(name) {
351
+ const escapedName = name.replace(/'/g, "''");
352
+ return this.executePowerShell(`
353
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
354
+ $workbook = $excel.ActiveWorkbook
355
+ $excel.DisplayAlerts = $false
356
+ $workbook.Sheets('${escapedName}').Delete()
357
+ $excel.DisplayAlerts = $true
358
+ @{ success = $true; message = "Sheet '${escapedName}' deleted" } | ConvertTo-Json -Compress
359
+ `);
360
+ }
361
+ async excelRenameSheet(oldName, newName) {
362
+ const escapedOld = oldName.replace(/'/g, "''");
363
+ const escapedNew = newName.replace(/'/g, "''");
364
+ return this.executePowerShell(`
365
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
366
+ $workbook = $excel.ActiveWorkbook
367
+ $workbook.Sheets('${escapedOld}').Name = '${escapedNew}'
368
+ @{ success = $true; message = "Sheet renamed from '${escapedOld}' to '${escapedNew}'" } | ConvertTo-Json -Compress
369
+ `);
370
+ }
371
+ async excelGetSheets() {
372
+ return this.executePowerShell(`
373
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
374
+ $workbook = $excel.ActiveWorkbook
375
+ $sheets = @()
376
+ foreach ($sheet in $workbook.Sheets) {
377
+ $sheets += $sheet.Name
378
+ }
379
+ @{ success = $true; sheets = $sheets; count = $sheets.Count } | ConvertTo-Json -Compress
380
+ `);
381
+ }
382
+ async excelSortRange(range, sortColumn, ascending = true, hasHeader = true, sheet) {
383
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
384
+ const order = ascending ? 1 : 2;
385
+ const header = hasHeader ? 1 : 2;
386
+ return this.executePowerShell(`
387
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
388
+ $workbook = $excel.ActiveWorkbook
389
+ ${sheetScript}
390
+ $range = $sheet.Range('${range}')
391
+ $sortKey = $sheet.Range('${sortColumn}1')
392
+
393
+ # Use Sort object for better compatibility
394
+ $sheet.Sort.SortFields.Clear()
395
+ $sheet.Sort.SortFields.Add($sortKey, 0, ${order})
396
+ $sheet.Sort.SetRange($range)
397
+ $sheet.Sort.Header = ${header}
398
+ $sheet.Sort.Apply()
399
+
400
+ @{ success = $true; message = "Range sorted by column ${sortColumn}" } | ConvertTo-Json -Compress
401
+ `);
402
+ }
403
+ async excelInsertRow(row, count = 1, sheet) {
404
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
405
+ return this.executePowerShell(`
406
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
407
+ $workbook = $excel.ActiveWorkbook
408
+ ${sheetScript}
409
+ for ($i = 0; $i -lt ${count}; $i++) {
410
+ $sheet.Rows(${row}).Insert()
411
+ }
412
+ @{ success = $true; message = "${count} row(s) inserted at row ${row}" } | ConvertTo-Json -Compress
413
+ `);
414
+ }
415
+ async excelDeleteRow(row, count = 1, sheet) {
416
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
417
+ return this.executePowerShell(`
418
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
419
+ $workbook = $excel.ActiveWorkbook
420
+ ${sheetScript}
421
+ $sheet.Rows("${row}:${row + count - 1}").Delete()
422
+ @{ success = $true; message = "${count} row(s) deleted starting at row ${row}" } | ConvertTo-Json -Compress
423
+ `);
424
+ }
425
+ async excelInsertColumn(column, count = 1, sheet) {
426
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
427
+ return this.executePowerShell(`
428
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
429
+ $workbook = $excel.ActiveWorkbook
430
+ ${sheetScript}
431
+ for ($i = 0; $i -lt ${count}; $i++) {
432
+ $sheet.Columns('${column}').Insert()
433
+ }
434
+ @{ success = $true; message = "${count} column(s) inserted at column ${column}" } | ConvertTo-Json -Compress
435
+ `);
436
+ }
437
+ async excelDeleteColumn(column, count = 1, sheet) {
438
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
439
+ const startColNum = columnLetterToNumber(column.toUpperCase());
440
+ const endCol = columnNumberToLetter(startColNum + count - 1);
441
+ return this.executePowerShell(`
442
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
443
+ $workbook = $excel.ActiveWorkbook
444
+ ${sheetScript}
445
+ $sheet.Columns("${column}:${endCol}").Delete()
446
+ @{ success = $true; message = "${count} column(s) deleted starting at column ${column}" } | ConvertTo-Json -Compress
447
+ `);
448
+ }
449
+ async excelFreezePanes(row, column, sheet) {
450
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
451
+ const cellRef = `${column || 'A'}${row || 1}`;
452
+ return this.executePowerShell(`
453
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
454
+ $workbook = $excel.ActiveWorkbook
455
+ ${sheetScript}
456
+ $sheet.Activate()
457
+ $sheet.Range('${cellRef}').Select()
458
+ $excel.ActiveWindow.FreezePanes = $true
459
+ @{ success = $true; message = "Panes frozen at ${cellRef}" } | ConvertTo-Json -Compress
460
+ `);
461
+ }
462
+ async excelAutoFilter(range, sheet) {
463
+ const sheetScript = sheet ? `$sheet = $workbook.Sheets('${sheet.replace(/'/g, "''")}')` : '$sheet = $workbook.ActiveSheet';
464
+ return this.executePowerShell(`
465
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
466
+ $workbook = $excel.ActiveWorkbook
467
+ ${sheetScript}
468
+ $sheet.Range('${range}').AutoFilter()
469
+ @{ success = $true; message = "AutoFilter applied to ${range}" } | ConvertTo-Json -Compress
470
+ `);
471
+ }
472
+ async excelScreenshot() {
473
+ const result = await this.executePowerShell(`
474
+ Add-Type -AssemblyName System.Windows.Forms
475
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
476
+ $sheet = $excel.ActiveWorkbook.ActiveSheet
477
+
478
+ # Get used range and copy as picture
479
+ $usedRange = $sheet.UsedRange
480
+ $usedRange.CopyPicture(1, 2) # xlScreen=1, xlBitmap=2
481
+
482
+ # Get image from clipboard
483
+ Start-Sleep -Milliseconds 500
484
+ $img = [System.Windows.Forms.Clipboard]::GetImage()
485
+ if ($img -eq $null) {
486
+ @{ success = $false; error = "Failed to capture screenshot" } | ConvertTo-Json -Compress
487
+ return
488
+ }
489
+
490
+ # Convert to base64
491
+ $ms = New-Object System.IO.MemoryStream
492
+ $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
493
+ $bytes = $ms.ToArray()
494
+ $base64 = [Convert]::ToBase64String($bytes)
495
+ $ms.Dispose()
496
+ $img.Dispose()
497
+
498
+ @{
499
+ success = $true
500
+ image = $base64
501
+ format = "png"
502
+ encoding = "base64"
503
+ } | ConvertTo-Json -Compress
504
+ `);
505
+ return result;
506
+ }
507
+ async excelAddChart(dataRange, chartType, options) {
508
+ const chartTypeMap = {
509
+ column: 51,
510
+ bar: 57,
511
+ line: 4,
512
+ pie: 5,
513
+ area: 1,
514
+ scatter: -4169,
515
+ doughnut: -4120,
516
+ };
517
+ const xlChartType = chartTypeMap[chartType] ?? 51;
518
+ const escapedTitle = options?.title?.replace(/'/g, "''") || '';
519
+ const hasKorean = options?.title ? /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(options.title) : false;
520
+ const sheetScript = options?.sheet ?
521
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${options.sheet.replace(/'/g, "''")}')` :
522
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
523
+ const left = options?.left ?? 100;
524
+ const top = options?.top ?? 100;
525
+ const width = options?.width ?? 400;
526
+ const height = options?.height ?? 300;
527
+ const titleScript = escapedTitle ? `
528
+ $chart.HasTitle = $true
529
+ $chart.ChartTitle.Text = '${escapedTitle}'
530
+ ${hasKorean ? "$chart.ChartTitle.Font.Name = 'Malgun Gothic'" : ''}` : '';
531
+ return this.executePowerShell(`
532
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
533
+ ${sheetScript}
534
+ $range = $sheet.Range('${dataRange}')
535
+ $chartObj = $sheet.ChartObjects().Add(${left}, ${top}, ${width}, ${height})
536
+ $chart = $chartObj.Chart
537
+ $chart.SetSourceData($range)
538
+ $chart.ChartType = ${xlChartType}
539
+ ${titleScript}
540
+ @{ success = $true; message = "Chart added"; chart_name = $chartObj.Name } | ConvertTo-Json -Compress
541
+ `);
542
+ }
543
+ async excelSetChartTitle(chartIndex, title, sheet) {
544
+ const escapedTitle = title.replace(/'/g, "''");
545
+ const hasKorean = /[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(title);
546
+ const sheetScript = sheet ?
547
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
548
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
549
+ return this.executePowerShell(`
550
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
551
+ ${sheetScript}
552
+ $chartObj = $sheet.ChartObjects(${chartIndex})
553
+ $chart = $chartObj.Chart
554
+ $chart.HasTitle = $true
555
+ $chart.ChartTitle.Text = '${escapedTitle}'
556
+ ${hasKorean ? "$chart.ChartTitle.Font.Name = 'Malgun Gothic'" : ''}
557
+ @{ success = $true; message = "Chart title set" } | ConvertTo-Json -Compress
558
+ `);
559
+ }
560
+ async excelDeleteChart(chartIndex, sheet) {
561
+ const sheetScript = sheet ?
562
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
563
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
564
+ return this.executePowerShell(`
565
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
566
+ ${sheetScript}
567
+ $sheet.ChartObjects(${chartIndex}).Delete()
568
+ @{ success = $true; message = "Chart deleted" } | ConvertTo-Json -Compress
569
+ `);
570
+ }
571
+ async excelAddConditionalFormat(range, formatType, options) {
572
+ const sheetScript = options?.sheet ?
573
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${options.sheet.replace(/'/g, "''")}')` :
574
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
575
+ const typeMap = {
576
+ cellValue: 1,
577
+ colorScale: 3,
578
+ dataBar: 4,
579
+ iconSet: 6,
580
+ duplicates: 8,
581
+ top10: 5,
582
+ };
583
+ const conditionType = typeMap[formatType] ?? 1;
584
+ const operatorMap = {
585
+ greater: 5,
586
+ less: 6,
587
+ equal: 3,
588
+ between: 1,
589
+ notBetween: 2,
590
+ };
591
+ const xlOperator = options?.operator ? operatorMap[options.operator] : 5;
592
+ let formatScript = '';
593
+ if (formatType === 'cellValue') {
594
+ const formula1 = typeof options?.value1 === 'string' ? `"${options.value1}"` : options?.value1 ?? 0;
595
+ const formula2 = options?.value2 !== undefined ?
596
+ (typeof options.value2 === 'string' ? `"${options.value2}"` : options.value2) : '';
597
+ formatScript = `
598
+ $fc = $range.FormatConditions.Add(${conditionType}, ${xlOperator}, ${formula1}${formula2 ? `, ${formula2}` : ''})`;
599
+ if (options?.fillColor) {
600
+ const rgb = this.hexToRgb(options.fillColor);
601
+ if (rgb) {
602
+ formatScript += `\n$fc.Interior.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`;
603
+ }
604
+ }
605
+ if (options?.fontColor) {
606
+ const rgb = this.hexToRgb(options.fontColor);
607
+ if (rgb) {
608
+ formatScript += `\n$fc.Font.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`;
609
+ }
610
+ }
611
+ }
612
+ else if (formatType === 'colorScale') {
613
+ formatScript = '$range.FormatConditions.AddColorScale(3)';
614
+ }
615
+ else if (formatType === 'dataBar') {
616
+ formatScript = '$range.FormatConditions.AddDataBar()';
617
+ }
618
+ else if (formatType === 'iconSet') {
619
+ formatScript = '$range.FormatConditions.AddIconSetCondition()';
620
+ }
621
+ else if (formatType === 'duplicates') {
622
+ formatScript = `$fc = $range.FormatConditions.AddUniqueValues()
623
+ $fc.DupeUnique = 1`;
624
+ if (options?.fillColor) {
625
+ const rgb = this.hexToRgb(options.fillColor);
626
+ if (rgb) {
627
+ formatScript += `\n$fc.Interior.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`;
628
+ }
629
+ }
630
+ }
631
+ else if (formatType === 'top10') {
632
+ formatScript = `$fc = $range.FormatConditions.AddTop10()
633
+ $fc.TopBottom = 1
634
+ $fc.Rank = 10`;
635
+ if (options?.fillColor) {
636
+ const rgb = this.hexToRgb(options.fillColor);
637
+ if (rgb) {
638
+ formatScript += `\n$fc.Interior.Color = ${rgb.r + rgb.g * 256 + rgb.b * 65536}`;
639
+ }
640
+ }
641
+ }
642
+ return this.executePowerShell(`
643
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
644
+ ${sheetScript}
645
+ $range = $sheet.Range('${range}')
646
+ ${formatScript}
647
+ @{ success = $true; message = "Conditional format added to ${range}" } | ConvertTo-Json -Compress
648
+ `);
649
+ }
650
+ async excelClearConditionalFormat(range, sheet) {
651
+ const sheetScript = sheet ?
652
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
653
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
654
+ return this.executePowerShell(`
655
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
656
+ ${sheetScript}
657
+ $sheet.Range('${range}').FormatConditions.Delete()
658
+ @{ success = $true; message = "Conditional formatting cleared from ${range}" } | ConvertTo-Json -Compress
659
+ `);
660
+ }
661
+ async excelSetDataValidation(range, validationType, options) {
662
+ const sheetScript = options?.sheet ?
663
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${options.sheet.replace(/'/g, "''")}')` :
664
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
665
+ const typeMap = {
666
+ list: 3,
667
+ whole: 1,
668
+ decimal: 2,
669
+ date: 4,
670
+ textLength: 6,
671
+ custom: 7,
672
+ };
673
+ const dvType = typeMap[validationType] ?? 3;
674
+ const operatorMap = {
675
+ between: 1,
676
+ notBetween: 2,
677
+ equal: 3,
678
+ notEqual: 4,
679
+ greater: 5,
680
+ less: 6,
681
+ greaterEqual: 7,
682
+ lessEqual: 8,
683
+ };
684
+ const xlOperator = options.operator ? operatorMap[options.operator] : 1;
685
+ const formula1 = options.formula1?.replace(/'/g, "''") || '';
686
+ const formula2 = options.formula2?.replace(/'/g, "''") || '';
687
+ const additionalSettings = [];
688
+ if (options.showInputMessage !== false && (options.inputTitle || options.inputMessage)) {
689
+ additionalSettings.push('$validation.ShowInput = $true');
690
+ if (options.inputTitle)
691
+ additionalSettings.push(`$validation.InputTitle = '${options.inputTitle.replace(/'/g, "''")}'`);
692
+ if (options.inputMessage)
693
+ additionalSettings.push(`$validation.InputMessage = '${options.inputMessage.replace(/'/g, "''")}'`);
694
+ }
695
+ if (options.showErrorMessage !== false && (options.errorTitle || options.errorMessage)) {
696
+ additionalSettings.push('$validation.ShowError = $true');
697
+ if (options.errorTitle)
698
+ additionalSettings.push(`$validation.ErrorTitle = '${options.errorTitle.replace(/'/g, "''")}'`);
699
+ if (options.errorMessage)
700
+ additionalSettings.push(`$validation.ErrorMessage = '${options.errorMessage.replace(/'/g, "''")}'`);
701
+ }
702
+ const validationParams = validationType === 'list'
703
+ ? `${dvType}, 1, 1, '${formula1}'`
704
+ : `${dvType}, 1, ${xlOperator}, '${formula1}'${formula2 ? `, '${formula2}'` : ''}`;
705
+ return this.executePowerShell(`
706
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
707
+ ${sheetScript}
708
+ $range = $sheet.Range('${range}')
709
+ $range.Validation.Delete()
710
+ $range.Validation.Add(${validationParams})
711
+ $validation = $range.Validation
712
+ ${additionalSettings.join('\n')}
713
+ @{ success = $true; message = "Data validation set on ${range}" } | ConvertTo-Json -Compress
714
+ `);
715
+ }
716
+ async excelClearDataValidation(range, sheet) {
717
+ const sheetScript = sheet ?
718
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
719
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
720
+ return this.executePowerShell(`
721
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
722
+ ${sheetScript}
723
+ $sheet.Range('${range}').Validation.Delete()
724
+ @{ success = $true; message = "Data validation cleared from ${range}" } | ConvertTo-Json -Compress
725
+ `);
726
+ }
727
+ async excelCreateNamedRange(name, range, sheet) {
728
+ const escapedName = name.replace(/'/g, "''");
729
+ const sheetScript = sheet ?
730
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
731
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
732
+ return this.executePowerShell(`
733
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
734
+ $workbook = $excel.ActiveWorkbook
735
+ ${sheetScript}
736
+ $range = $sheet.Range('${range}')
737
+ $workbook.Names.Add('${escapedName}', $range)
738
+ @{ success = $true; message = "Named range '${escapedName}' created" } | ConvertTo-Json -Compress
739
+ `);
740
+ }
741
+ async excelGetNamedRanges() {
742
+ return this.executePowerShell(`
743
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
744
+ $workbook = $excel.ActiveWorkbook
745
+ $names = @()
746
+ foreach ($n in $workbook.Names) {
747
+ $names += @{
748
+ name = $n.Name
749
+ refersTo = $n.RefersTo
750
+ value = $n.Value
751
+ }
752
+ }
753
+ @{ success = $true; named_ranges = $names } | ConvertTo-Json -Compress -Depth 5
754
+ `);
755
+ }
756
+ async excelDeleteNamedRange(name) {
757
+ const escapedName = name.replace(/'/g, "''");
758
+ return this.executePowerShell(`
759
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
760
+ $workbook = $excel.ActiveWorkbook
761
+ $workbook.Names('${escapedName}').Delete()
762
+ @{ success = $true; message = "Named range '${escapedName}' deleted" } | ConvertTo-Json -Compress
763
+ `);
764
+ }
765
+ async excelCopyRange(range, sheet) {
766
+ const sheetScript = sheet ?
767
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
768
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
769
+ return this.executePowerShell(`
770
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
771
+ ${sheetScript}
772
+ $sheet.Range('${range}').Copy()
773
+ @{ success = $true; message = "Range ${range} copied to clipboard" } | ConvertTo-Json -Compress
774
+ `);
775
+ }
776
+ async excelPasteRange(destination, sheet) {
777
+ const sheetScript = sheet ?
778
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
779
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
780
+ return this.executePowerShell(`
781
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
782
+ ${sheetScript}
783
+ $sheet.Range('${destination}').Select()
784
+ $sheet.Paste()
785
+ @{ success = $true; message = "Pasted to ${destination}" } | ConvertTo-Json -Compress
786
+ `);
787
+ }
788
+ async excelClearRange(range, clearType = 'all', sheet) {
789
+ const sheetScript = sheet ?
790
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
791
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
792
+ const clearMethod = {
793
+ all: 'Clear()',
794
+ contents: 'ClearContents()',
795
+ formats: 'ClearFormats()',
796
+ comments: 'ClearComments()',
797
+ }[clearType];
798
+ return this.executePowerShell(`
799
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
800
+ ${sheetScript}
801
+ $sheet.Range('${range}').${clearMethod}
802
+ @{ success = $true; message = "Range ${range} cleared (${clearType})" } | ConvertTo-Json -Compress
803
+ `);
804
+ }
805
+ async excelHideColumn(column, sheet) {
806
+ const sheetScript = sheet ?
807
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
808
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
809
+ return this.executePowerShell(`
810
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
811
+ ${sheetScript}
812
+ $sheet.Columns('${column}').Hidden = $true
813
+ @{ success = $true; message = "Column ${column} hidden" } | ConvertTo-Json -Compress
814
+ `);
815
+ }
816
+ async excelShowColumn(column, sheet) {
817
+ const sheetScript = sheet ?
818
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
819
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
820
+ return this.executePowerShell(`
821
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
822
+ ${sheetScript}
823
+ $sheet.Columns('${column}').Hidden = $false
824
+ @{ success = $true; message = "Column ${column} shown" } | ConvertTo-Json -Compress
825
+ `);
826
+ }
827
+ async excelHideRow(row, sheet) {
828
+ const sheetScript = sheet ?
829
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
830
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
831
+ return this.executePowerShell(`
832
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
833
+ ${sheetScript}
834
+ $sheet.Rows(${row}).Hidden = $true
835
+ @{ success = $true; message = "Row ${row} hidden" } | ConvertTo-Json -Compress
836
+ `);
837
+ }
838
+ async excelShowRow(row, sheet) {
839
+ const sheetScript = sheet ?
840
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
841
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
842
+ return this.executePowerShell(`
843
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
844
+ ${sheetScript}
845
+ $sheet.Rows(${row}).Hidden = $false
846
+ @{ success = $true; message = "Row ${row} shown" } | ConvertTo-Json -Compress
847
+ `);
848
+ }
849
+ async excelAddImage(imagePath, cell, options) {
850
+ const windowsPath = this.toWindowsPath(imagePath).replace(/'/g, "''");
851
+ const sheetScript = options?.sheet ?
852
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${options.sheet.replace(/'/g, "''")}')` :
853
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
854
+ const sizeScript = [];
855
+ if (options?.width)
856
+ sizeScript.push(`$pic.Width = ${options.width}`);
857
+ if (options?.height)
858
+ sizeScript.push(`$pic.Height = ${options.height}`);
859
+ return this.executePowerShell(`
860
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
861
+ ${sheetScript}
862
+ $cell = $sheet.Range('${cell}')
863
+ $pic = $sheet.Shapes.AddPicture('${windowsPath}', 0, -1, $cell.Left, $cell.Top, -1, -1)
864
+ ${sizeScript.join('\n')}
865
+ @{ success = $true; message = "Image added at ${cell}" } | ConvertTo-Json -Compress
866
+ `);
867
+ }
868
+ async excelAddHyperlink(cell, url, displayText, sheet) {
869
+ const escapedUrl = url.replace(/'/g, "''");
870
+ const escapedText = displayText?.replace(/'/g, "''") || url;
871
+ const sheetScript = sheet ?
872
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
873
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
874
+ return this.executePowerShell(`
875
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
876
+ ${sheetScript}
877
+ $range = $sheet.Range('${cell}')
878
+ $sheet.Hyperlinks.Add($range, '${escapedUrl}', '', '', '${escapedText}')
879
+ @{ success = $true; message = "Hyperlink added to ${cell}" } | ConvertTo-Json -Compress
880
+ `);
881
+ }
882
+ async excelExportPDF(outputPath, sheet) {
883
+ const windowsPath = this.toWindowsPath(outputPath).replace(/'/g, "''");
884
+ const sheetScript = sheet ?
885
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')
886
+ $sheet.ExportAsFixedFormat(0, '${windowsPath}')` :
887
+ `$excel.ActiveWorkbook.ExportAsFixedFormat(0, '${windowsPath}')`;
888
+ return this.executePowerShell(`
889
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
890
+ ${sheetScript}
891
+ @{ success = $true; message = "Exported to PDF"; path = '${windowsPath}' } | ConvertTo-Json -Compress
892
+ `);
893
+ }
894
+ async excelPrint(copies = 1, sheet) {
895
+ const sheetScript = sheet ?
896
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')
897
+ $sheet.PrintOut(1, 9999, ${copies})` :
898
+ `$excel.ActiveWorkbook.PrintOut(1, 9999, ${copies})`;
899
+ return this.executePowerShell(`
900
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
901
+ ${sheetScript}
902
+ @{ success = $true; message = "Print job sent (${copies} copies)" } | ConvertTo-Json -Compress
903
+ `);
904
+ }
905
+ async excelAddComment(cell, text, _author, sheet) {
906
+ const escapedText = text.replace(/'/g, "''");
907
+ const sheetScript = sheet ?
908
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
909
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
910
+ return this.executePowerShell(`
911
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
912
+ ${sheetScript}
913
+ $cell = $sheet.Range('${cell}')
914
+ if ($cell.Comment -ne $null) { $cell.Comment.Delete() }
915
+ $comment = $cell.AddComment('${escapedText}')
916
+ $comment.Visible = $false
917
+ @{ success = $true; message = "Comment added to ${cell}" } | ConvertTo-Json -Compress
918
+ `);
919
+ }
920
+ async excelGetComment(cell, sheet) {
921
+ const sheetScript = sheet ?
922
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
923
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
924
+ return this.executePowerShell(`
925
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
926
+ ${sheetScript}
927
+ $cell = $sheet.Range('${cell}')
928
+ if ($cell.Comment -ne $null) {
929
+ @{ success = $true; has_comment = $true; text = $cell.Comment.Text() } | ConvertTo-Json -Compress
930
+ } else {
931
+ @{ success = $true; has_comment = $false } | ConvertTo-Json -Compress
932
+ }
933
+ `);
934
+ }
935
+ async excelDeleteComment(cell, sheet) {
936
+ const sheetScript = sheet ?
937
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
938
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
939
+ return this.executePowerShell(`
940
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
941
+ ${sheetScript}
942
+ $cell = $sheet.Range('${cell}')
943
+ if ($cell.Comment -ne $null) {
944
+ $cell.Comment.Delete()
945
+ @{ success = $true; message = "Comment deleted from ${cell}" } | ConvertTo-Json -Compress
946
+ } else {
947
+ @{ success = $false; error = "No comment found at ${cell}" } | ConvertTo-Json -Compress
948
+ }
949
+ `);
950
+ }
951
+ async excelProtectSheet(password, sheet) {
952
+ const escapedPassword = password?.replace(/'/g, "''") || '';
953
+ const sheetScript = sheet ?
954
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
955
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
956
+ return this.executePowerShell(`
957
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
958
+ ${sheetScript}
959
+ $sheet.Protect('${escapedPassword}')
960
+ @{ success = $true; message = "Sheet protected" } | ConvertTo-Json -Compress
961
+ `);
962
+ }
963
+ async excelUnprotectSheet(password, sheet) {
964
+ const escapedPassword = password?.replace(/'/g, "''") || '';
965
+ const sheetScript = sheet ?
966
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
967
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
968
+ return this.executePowerShell(`
969
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
970
+ ${sheetScript}
971
+ $sheet.Unprotect('${escapedPassword}')
972
+ @{ success = $true; message = "Sheet unprotected" } | ConvertTo-Json -Compress
973
+ `);
974
+ }
975
+ async excelUnmergeCells(range, sheet) {
976
+ const sheetScript = sheet ?
977
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
978
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
979
+ return this.executePowerShell(`
980
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
981
+ ${sheetScript}
982
+ $sheet.Range('${range}').UnMerge()
983
+ @{ success = $true; message = "Cells unmerged: ${range}" } | ConvertTo-Json -Compress
984
+ `);
985
+ }
986
+ async excelSelectSheet(name) {
987
+ const escapedName = name.replace(/'/g, "''");
988
+ return this.executePowerShell(`
989
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
990
+ $excel.ActiveWorkbook.Worksheets('${escapedName}').Activate()
991
+ @{ success = $true; message = "Sheet '${escapedName}' activated" } | ConvertTo-Json -Compress
992
+ `);
993
+ }
994
+ async excelFindReplace(find, replace, options) {
995
+ const escapedFind = find.replace(/'/g, "''");
996
+ const escapedReplace = replace.replace(/'/g, "''");
997
+ const sheetScript = options?.sheet ?
998
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${options.sheet.replace(/'/g, "''")}')` :
999
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
1000
+ const rangeScript = options?.range ?
1001
+ `$range = $sheet.Range('${options.range}')` :
1002
+ '$range = $sheet.UsedRange';
1003
+ const matchCase = options?.matchCase ? '$true' : '$false';
1004
+ const lookAt = options?.matchEntireCell ? '1' : '2';
1005
+ return this.executePowerShell(`
1006
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
1007
+ ${sheetScript}
1008
+ ${rangeScript}
1009
+ $replaced = $range.Replace('${escapedFind}', '${escapedReplace}', ${lookAt}, 1, ${matchCase})
1010
+ @{ success = $true; message = "Find and replace completed" } | ConvertTo-Json -Compress
1011
+ `);
1012
+ }
1013
+ async excelGroupRows(startRow, endRow, sheet) {
1014
+ const sheetScript = sheet ?
1015
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
1016
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
1017
+ return this.executePowerShell(`
1018
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
1019
+ ${sheetScript}
1020
+ $sheet.Rows("${startRow}:${endRow}").Group()
1021
+ @{ success = $true; message = "Rows ${startRow}-${endRow} grouped" } | ConvertTo-Json -Compress
1022
+ `);
1023
+ }
1024
+ async excelUngroupRows(startRow, endRow, sheet) {
1025
+ const sheetScript = sheet ?
1026
+ `$sheet = $excel.ActiveWorkbook.Worksheets('${sheet.replace(/'/g, "''")}')` :
1027
+ '$sheet = $excel.ActiveWorkbook.ActiveSheet';
1028
+ return this.executePowerShell(`
1029
+ $excel = [Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
1030
+ ${sheetScript}
1031
+ $sheet.Rows("${startRow}:${endRow}").Ungroup()
1032
+ @{ success = $true; message = "Rows ${startRow}-${endRow} ungrouped" } | ConvertTo-Json -Compress
1033
+ `);
1034
+ }
1035
+ }
1036
+ export const excelClient = new ExcelClient();
1037
+ //# sourceMappingURL=excel-client.js.map