@uipath/delegate-sdk 1.203.1 → 1.203.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/README.md +41 -3
  2. package/dist/index.mjs +2 -2
  3. package/dist/skills/business-analysis/SKILL.md +722 -0
  4. package/dist/skills/business-analysis/as-is-capture.md +440 -0
  5. package/dist/skills/business-analysis/assets/progress.yaml +19 -0
  6. package/dist/skills/business-analysis/assets/task-list.md +34 -0
  7. package/dist/skills/business-analysis/automation-hub-publishing.md +47 -0
  8. package/dist/skills/business-analysis/bpmn-to-be-design.md +274 -0
  9. package/dist/skills/business-analysis/case-to-be-design.md +223 -0
  10. package/dist/skills/business-analysis/diagram-authoring.md +215 -0
  11. package/dist/skills/business-analysis/industry-gaps.md +134 -0
  12. package/dist/skills/business-analysis/interview-spine.md +297 -0
  13. package/dist/skills/business-analysis/locales/de.json +54 -0
  14. package/dist/skills/business-analysis/locales/en.json +54 -0
  15. package/dist/skills/business-analysis/locales/es-MX.json +54 -0
  16. package/dist/skills/business-analysis/locales/es.json +54 -0
  17. package/dist/skills/business-analysis/locales/fr.json +54 -0
  18. package/dist/skills/business-analysis/locales/ja.json +54 -0
  19. package/dist/skills/business-analysis/locales/ko.json +54 -0
  20. package/dist/skills/business-analysis/locales/pt-BR.json +54 -0
  21. package/dist/skills/business-analysis/locales/pt.json +54 -0
  22. package/dist/skills/business-analysis/locales/ro.json +54 -0
  23. package/dist/skills/business-analysis/locales/tr.json +54 -0
  24. package/dist/skills/business-analysis/locales/zh-CN.json +54 -0
  25. package/dist/skills/business-analysis/locales/zh-TW.json +54 -0
  26. package/dist/skills/business-analysis/pdd-generation.md +204 -0
  27. package/dist/skills/business-analysis/pdd-template.md +562 -0
  28. package/dist/skills/business-analysis/progress-presentation.json +13 -0
  29. package/dist/skills/business-analysis/recording-first.md +19 -0
  30. package/dist/skills/business-analysis/recording-processing.md +152 -0
  31. package/dist/skills/business-analysis/references/automation-hub-open-api.md +57 -0
  32. package/dist/skills/business-analysis/references/case-definition-spec.md +90 -0
  33. package/dist/skills/business-analysis/references/case-design-patterns/loan-origination-spec.md +86 -0
  34. package/dist/skills/business-analysis/references/component-type-mapping.md +52 -0
  35. package/dist/skills/business-analysis/references/uipath-products/case-management-schema.md +62 -0
  36. package/dist/skills/business-analysis/references/uipath-products/maestro-case-framework.md +65 -0
  37. package/dist/skills/business-analysis/references/uipath-products/maestro-case-management.md +49 -0
  38. package/dist/skills/business-analysis/research-offer.md +104 -0
  39. package/dist/skills/business-analysis/research-pass.md +149 -0
  40. package/dist/skills/business-analysis/scripts/assemble-pdd.ps1 +294 -0
  41. package/dist/skills/business-analysis/scripts/assemble-pdd.sh +453 -0
  42. package/dist/skills/business-analysis/scripts/check-phase-ready.ps1 +72 -0
  43. package/dist/skills/business-analysis/scripts/check-phase-ready.sh +98 -0
  44. package/dist/skills/business-analysis/scripts/lint-diagram.ps1 +524 -0
  45. package/dist/skills/business-analysis/scripts/lint-diagram.sh +519 -0
  46. package/dist/skills/business-analysis/scripts/stamp-pages.ps1 +363 -0
  47. package/dist/skills/business-analysis/scripts/stamp-pages.sh +360 -0
  48. package/dist/skills/business-analysis/to-be-design.md +199 -0
  49. package/dist/skills/confluence/SKILL.md +386 -0
  50. package/dist/skills/doc-coauthoring/SKILL.md +295 -0
  51. package/dist/skills/excel-architect/SKILL.macos.md +161 -0
  52. package/dist/skills/excel-architect/SKILL.md +180 -0
  53. package/dist/skills/excel-architect/SKILL.windows.md +61 -0
  54. package/dist/skills/excel-architect/archetypes/01-financial-model-advanced.md +332 -0
  55. package/dist/skills/excel-architect/archetypes/01-financial-model.md +248 -0
  56. package/dist/skills/excel-architect/archetypes/02-data-analysis.md +171 -0
  57. package/dist/skills/excel-architect/archetypes/03-tracking-dashboard.md +160 -0
  58. package/dist/skills/excel-architect/archetypes/04-project-planning.md +193 -0
  59. package/dist/skills/excel-architect/archetypes/05-simple-table.md +111 -0
  60. package/dist/skills/excel-architect/building.md +279 -0
  61. package/dist/skills/excel-architect/create.md +64 -0
  62. package/dist/skills/excel-architect/data-and-formulas.md +186 -0
  63. package/dist/skills/excel-architect/generator.md +272 -0
  64. package/dist/skills/excel-architect/macos/scripts/add-data-validation.applescript +242 -0
  65. package/dist/skills/excel-architect/macos/scripts/append-rows.applescript +310 -0
  66. package/dist/skills/excel-architect/macos/scripts/apply-conditional-format.applescript +565 -0
  67. package/dist/skills/excel-architect/macos/scripts/autofit-columns.applescript +79 -0
  68. package/dist/skills/excel-architect/macos/scripts/benchmark.sh +135 -0
  69. package/dist/skills/excel-architect/macos/scripts/check-compile.sh +30 -0
  70. package/dist/skills/excel-architect/macos/scripts/clear-range.applescript +152 -0
  71. package/dist/skills/excel-architect/macos/scripts/copy-paste.applescript +179 -0
  72. package/dist/skills/excel-architect/macos/scripts/create-chart.applescript +531 -0
  73. package/dist/skills/excel-architect/macos/scripts/create-pivot.applescript +443 -0
  74. package/dist/skills/excel-architect/macos/scripts/create-sheets.applescript +264 -0
  75. package/dist/skills/excel-architect/macos/scripts/create-workbook.applescript +92 -0
  76. package/dist/skills/excel-architect/macos/scripts/delete-chart.applescript +105 -0
  77. package/dist/skills/excel-architect/macos/scripts/delete-sheet.applescript +127 -0
  78. package/dist/skills/excel-architect/macos/scripts/filter-data.applescript +213 -0
  79. package/dist/skills/excel-architect/macos/scripts/find-replace.applescript +238 -0
  80. package/dist/skills/excel-architect/macos/scripts/format-range.applescript +531 -0
  81. package/dist/skills/excel-architect/macos/scripts/freeze-panes.applescript +133 -0
  82. package/dist/skills/excel-architect/macos/scripts/get-current-file.applescript +24 -0
  83. package/dist/skills/excel-architect/macos/scripts/get-sheet-dimensions.applescript +115 -0
  84. package/dist/skills/excel-architect/macos/scripts/health-check.applescript +704 -0
  85. package/dist/skills/excel-architect/macos/scripts/list-open-workbooks.applescript +80 -0
  86. package/dist/skills/excel-architect/macos/scripts/maximize-window.applescript +47 -0
  87. package/dist/skills/excel-architect/macos/scripts/merge-cells.applescript +227 -0
  88. package/dist/skills/excel-architect/macos/scripts/open-workbook.applescript +139 -0
  89. package/dist/skills/excel-architect/macos/scripts/read-range.applescript +267 -0
  90. package/dist/skills/excel-architect/macos/scripts/rename-sheet.applescript +231 -0
  91. package/dist/skills/excel-architect/macos/scripts/select-sheet.applescript +133 -0
  92. package/dist/skills/excel-architect/macos/scripts/set-tab-color.applescript +109 -0
  93. package/dist/skills/excel-architect/macos/scripts/sort-data.applescript +136 -0
  94. package/dist/skills/excel-architect/macos/scripts/undo.applescript +59 -0
  95. package/dist/skills/excel-architect/macos/scripts/workbook-lifecycle.applescript +149 -0
  96. package/dist/skills/excel-architect/macos/scripts/write-formula.applescript +225 -0
  97. package/dist/skills/excel-architect/macos/scripts/write-range.applescript +351 -0
  98. package/dist/skills/excel-architect/reference/api/advanced.md +381 -0
  99. package/dist/skills/excel-architect/reference/api/basic.md +747 -0
  100. package/dist/skills/excel-architect/reference/guides.md +348 -0
  101. package/dist/skills/excel-architect/reference/repair.md +174 -0
  102. package/dist/skills/excel-architect/reference/troubleshooting.md +46 -0
  103. package/dist/skills/excel-architect/scripting.md +266 -0
  104. package/dist/skills/excel-architect/styling-and-features.md +433 -0
  105. package/dist/skills/excel-architect/windows/api/composites.md +337 -0
  106. package/dist/skills/excel-architect/windows/api/scripting.md +139 -0
  107. package/dist/skills/excel-architect/windows/examples/level-1-workflows.md +485 -0
  108. package/dist/skills/excel-architect/windows/examples/level-2-advanced.md +690 -0
  109. package/dist/skills/excel-architect/windows/examples/level-3-scripting.md +337 -0
  110. package/dist/skills/github/SKILL.md +446 -0
  111. package/dist/skills/github/recipes/add-comment.md +85 -0
  112. package/dist/skills/github/recipes/check-pr-status.md +122 -0
  113. package/dist/skills/github/recipes/compare-branches.md +79 -0
  114. package/dist/skills/github/recipes/create-issue.md +103 -0
  115. package/dist/skills/github/recipes/create-pr.md +97 -0
  116. package/dist/skills/github/recipes/get-file-contents.md +76 -0
  117. package/dist/skills/github/recipes/get-last-commit.md +128 -0
  118. package/dist/skills/github/recipes/list-my-open-prs.md +105 -0
  119. package/dist/skills/github/recipes/list-recent-commits.md +84 -0
  120. package/dist/skills/github/recipes/search-issues.md +115 -0
  121. package/dist/skills/google-workspace/SKILL.md +217 -0
  122. package/dist/skills/google-workspace/services/calendar.md +311 -0
  123. package/dist/skills/google-workspace/services/docs.md +426 -0
  124. package/dist/skills/google-workspace/services/drive.md +504 -0
  125. package/dist/skills/google-workspace/services/gmail.md +466 -0
  126. package/dist/skills/google-workspace/services/sheets.md +370 -0
  127. package/dist/skills/internal-comms/SKILL.md +35 -0
  128. package/dist/skills/internal-comms/examples/3p-updates.md +47 -0
  129. package/dist/skills/internal-comms/examples/company-newsletter.md +65 -0
  130. package/dist/skills/internal-comms/examples/faq-answers.md +30 -0
  131. package/dist/skills/internal-comms/examples/general-comms.md +15 -0
  132. package/dist/skills/jira/SKILL.md +397 -0
  133. package/dist/skills/jira/recipes/add-comment.md +123 -0
  134. package/dist/skills/jira/recipes/assign-issue.md +157 -0
  135. package/dist/skills/jira/recipes/create-issue.md +274 -0
  136. package/dist/skills/jira/recipes/get-issue-details.md +154 -0
  137. package/dist/skills/jira/recipes/list-projects.md +151 -0
  138. package/dist/skills/jira/recipes/my-issues.md +180 -0
  139. package/dist/skills/jira/recipes/search-issues.md +215 -0
  140. package/dist/skills/jira/recipes/transition-issue.md +154 -0
  141. package/dist/skills/jira/recipes/troubleshooting.md +387 -0
  142. package/dist/skills/knowledge-base/SKILL.md +289 -0
  143. package/dist/skills/media-tools/SKILL.md +204 -0
  144. package/dist/skills/media-tools/references/encode-runbook.md +24 -0
  145. package/dist/skills/media-tools/references/resolve-binaries.md +81 -0
  146. package/dist/skills/media-tools/scripts/macos/ff-launch.sh +22 -0
  147. package/dist/skills/media-tools/scripts/macos/ff-poll.sh +10 -0
  148. package/dist/skills/media-tools/scripts/windows/ff-launch.ps1 +34 -0
  149. package/dist/skills/media-tools/scripts/windows/ff-poll.ps1 +20 -0
  150. package/dist/skills/office-download/SKILL.md +161 -0
  151. package/dist/skills/outlook-365/SKILL.macos.md +331 -0
  152. package/dist/skills/outlook-365/SKILL.md +171 -0
  153. package/dist/skills/outlook-365/SKILL.windows.md +124 -0
  154. package/dist/skills/outlook-365/api/bulk-email-operations.md +178 -0
  155. package/dist/skills/outlook-365/api/check-availability.md +87 -0
  156. package/dist/skills/outlook-365/api/create-inbox-rule.md +182 -0
  157. package/dist/skills/outlook-365/api/download-attachments.md +149 -0
  158. package/dist/skills/outlook-365/api/find-and-email-contact.md +185 -0
  159. package/dist/skills/outlook-365/api/manage-calendar-events.md +189 -0
  160. package/dist/skills/outlook-365/api/organize-with-folders.md +178 -0
  161. package/dist/skills/outlook-365/api/reply-to-conversation.md +68 -0
  162. package/dist/skills/outlook-365/api/schedule-meeting.md +73 -0
  163. package/dist/skills/outlook-365/api/search-and-read-email.md +93 -0
  164. package/dist/skills/outlook-365/api/send-email-with-attachments.md +94 -0
  165. package/dist/skills/outlook-365/api/send-email.md +396 -0
  166. package/dist/skills/outlook-365/api/set-out-of-office.md +196 -0
  167. package/dist/skills/outlook-365/macos/scripts/bulk-operations.applescript +429 -0
  168. package/dist/skills/outlook-365/macos/scripts/calendar.applescript +642 -0
  169. package/dist/skills/outlook-365/macos/scripts/contacts.applescript +635 -0
  170. package/dist/skills/outlook-365/macos/scripts/helpers.applescript +227 -0
  171. package/dist/skills/outlook-365/macos/scripts/read-emails.applescript +299 -0
  172. package/dist/skills/outlook-365/macos/scripts/search-emails.applescript +339 -0
  173. package/dist/skills/outlook-365/macos/scripts/send-email.applescript +245 -0
  174. package/dist/skills/outlook-365/uia/BASIC_OPERATIONS.md +278 -0
  175. package/dist/skills/outlook-365/uia/CALENDAR_OPERATIONS.md +386 -0
  176. package/dist/skills/outlook-365/uia/COMPOSE_EMAIL.md +426 -0
  177. package/dist/skills/outlook-365/uia/README.md +75 -0
  178. package/dist/skills/outlook-365/windows/com/bulk-operations.ps1 +241 -0
  179. package/dist/skills/outlook-365/windows/com/calendar.ps1 +227 -0
  180. package/dist/skills/outlook-365/windows/com/contacts.ps1 +270 -0
  181. package/dist/skills/outlook-365/windows/com/helpers.ps1 +158 -0
  182. package/dist/skills/outlook-365/windows/com/read-emails.ps1 +115 -0
  183. package/dist/skills/outlook-365/windows/com/search-emails.ps1 +141 -0
  184. package/dist/skills/outlook-365/windows/com/send-email.ps1 +121 -0
  185. package/dist/skills/pdf-architect/SKILL.md +640 -0
  186. package/dist/skills/powerpoint-architect/SKILL.macos.md +271 -0
  187. package/dist/skills/powerpoint-architect/SKILL.md +853 -0
  188. package/dist/skills/powerpoint-architect/SKILL.windows.md +458 -0
  189. package/dist/skills/powerpoint-architect/custom_themes.md +141 -0
  190. package/dist/skills/powerpoint-architect/editing-guide.md +424 -0
  191. package/dist/skills/powerpoint-architect/generator-reference.md +668 -0
  192. package/dist/skills/powerpoint-architect/images-guide.md +207 -0
  193. package/dist/skills/powerpoint-architect/issue-fix-mapping.md +768 -0
  194. package/dist/skills/powerpoint-architect/macos/scripts/add-html-to-slide.applescript +389 -0
  195. package/dist/skills/powerpoint-architect/macos/scripts/add-slide.applescript +255 -0
  196. package/dist/skills/powerpoint-architect/macos/scripts/add-speaker-notes.applescript +132 -0
  197. package/dist/skills/powerpoint-architect/macos/scripts/add-text.applescript +245 -0
  198. package/dist/skills/powerpoint-architect/macos/scripts/apply-slide-layout.applescript +80 -0
  199. package/dist/skills/powerpoint-architect/macos/scripts/apply-theme.applescript +122 -0
  200. package/dist/skills/powerpoint-architect/macos/scripts/autofit-placeholders.applescript +62 -0
  201. package/dist/skills/powerpoint-architect/macos/scripts/close-presentation.applescript +24 -0
  202. package/dist/skills/powerpoint-architect/macos/scripts/copy-slides.applescript +303 -0
  203. package/dist/skills/powerpoint-architect/macos/scripts/create-chart-with-data.applescript +305 -0
  204. package/dist/skills/powerpoint-architect/macos/scripts/create-with-theme.applescript +56 -0
  205. package/dist/skills/powerpoint-architect/macos/scripts/delete-slides.applescript +137 -0
  206. package/dist/skills/powerpoint-architect/macos/scripts/export-presentation.applescript +100 -0
  207. package/dist/skills/powerpoint-architect/macos/scripts/extract-slide-data.applescript +138 -0
  208. package/dist/skills/powerpoint-architect/macos/scripts/format-shape.applescript +192 -0
  209. package/dist/skills/powerpoint-architect/macos/scripts/format-slide-content.applescript +336 -0
  210. package/dist/skills/powerpoint-architect/macos/scripts/get-current-slide-number.applescript +38 -0
  211. package/dist/skills/powerpoint-architect/macos/scripts/get-file-path.applescript +94 -0
  212. package/dist/skills/powerpoint-architect/macos/scripts/get-layout-elements.applescript +141 -0
  213. package/dist/skills/powerpoint-architect/macos/scripts/get-layouts.applescript +58 -0
  214. package/dist/skills/powerpoint-architect/macos/scripts/get-opened-files.applescript +50 -0
  215. package/dist/skills/powerpoint-architect/macos/scripts/get-presentation-info.applescript +150 -0
  216. package/dist/skills/powerpoint-architect/macos/scripts/get-recent-files.applescript +68 -0
  217. package/dist/skills/powerpoint-architect/macos/scripts/get-slide-count.applescript +37 -0
  218. package/dist/skills/powerpoint-architect/macos/scripts/get-slide-info.applescript +105 -0
  219. package/dist/skills/powerpoint-architect/macos/scripts/health-check.applescript +690 -0
  220. package/dist/skills/powerpoint-architect/macos/scripts/insert-shape.applescript +188 -0
  221. package/dist/skills/powerpoint-architect/macos/scripts/insert-table.applescript +112 -0
  222. package/dist/skills/powerpoint-architect/macos/scripts/insert-text-box.applescript +225 -0
  223. package/dist/skills/powerpoint-architect/macos/scripts/manage-image.applescript +486 -0
  224. package/dist/skills/powerpoint-architect/macos/scripts/maximize-window.applescript +48 -0
  225. package/dist/skills/powerpoint-architect/macos/scripts/navigate-to-slide.applescript +84 -0
  226. package/dist/skills/powerpoint-architect/macos/scripts/open-presentation.applescript +38 -0
  227. package/dist/skills/powerpoint-architect/macos/scripts/reorder-slides.applescript +106 -0
  228. package/dist/skills/powerpoint-architect/macos/scripts/replace-text.applescript +193 -0
  229. package/dist/skills/powerpoint-architect/macos/scripts/save-presentation.applescript +54 -0
  230. package/dist/skills/powerpoint-architect/macos/scripts/set-animation.applescript +203 -0
  231. package/dist/skills/powerpoint-architect/macos/scripts/set-transition.applescript +130 -0
  232. package/dist/skills/powerpoint-architect/visual-styling-guide.md +206 -0
  233. package/dist/skills/powerpoint-architect/windows/api/advanced.md +317 -0
  234. package/dist/skills/powerpoint-architect/windows/api/basic.md +392 -0
  235. package/dist/skills/powerpoint-architect/windows/examples/10-slide-presentation.md +140 -0
  236. package/dist/skills/powerpoint-architect/windows/examples/custom-theme-workflow.md +219 -0
  237. package/dist/skills/powerpoint-architect/windows/examples/level-1-workflows.md +531 -0
  238. package/dist/skills/powerpoint-architect/windows/examples/level-2-scripting.md +239 -0
  239. package/dist/skills/powerpoint-architect/windows/scripts/create-with-theme.ps1 +81 -0
  240. package/dist/skills/project-task-list/SKILL.md +174 -0
  241. package/dist/skills/slack-operation/SKILL.md +97 -0
  242. package/dist/skills/slack-operation/api/advanced-api/GUIDE.md +277 -0
  243. package/dist/skills/slack-operation/api/search-and-read/EXAMPLE.md +75 -0
  244. package/dist/skills/slack-operation/api/search-and-read/GUIDE.md +108 -0
  245. package/dist/skills/slack-operation/api/send-message/EXAMPLE.md +112 -0
  246. package/dist/skills/slack-operation/api/send-message/GUIDE.md +63 -0
  247. package/dist/skills/slack-operation/api/share-files/EXAMPLE.md +94 -0
  248. package/dist/skills/slack-operation/api/share-files/GUIDE.md +63 -0
  249. package/dist/skills/slack-operation/ui/desktop-automation/GUIDE.md +55 -0
  250. package/dist/skills/system-diagnostics/SKILL.md +263 -0
  251. package/dist/skills/teams-operation/SKILL.md +79 -0
  252. package/dist/skills/teams-operation/api/advanced-api/GUIDE.md +234 -0
  253. package/dist/skills/teams-operation/api/meetings/EXAMPLE.md +63 -0
  254. package/dist/skills/teams-operation/api/meetings/GUIDE.md +52 -0
  255. package/dist/skills/teams-operation/api/search-and-read/EXAMPLE.md +72 -0
  256. package/dist/skills/teams-operation/api/search-and-read/GUIDE.md +54 -0
  257. package/dist/skills/teams-operation/api/send-message/EXAMPLE.md +92 -0
  258. package/dist/skills/teams-operation/api/send-message/GUIDE.md +60 -0
  259. package/dist/skills/teams-operation/ui/desktop-automation/GUIDE.md +66 -0
  260. package/dist/skills/transcribe-media/SKILL.md +142 -0
  261. package/dist/skills/uipath-integrations/SKILL.md +370 -0
  262. package/dist/skills/uipath-integrations/reference/connectors.md +331 -0
  263. package/dist/skills/uipath-integrations/reference/endpoints.md +220 -0
  264. package/dist/skills/uipath-integrations/reference/errors.md +211 -0
  265. package/dist/skills/uipath-integrations/reference/metadata.md +317 -0
  266. package/dist/skills/uipath-integrations/reference/operations.md +297 -0
  267. package/dist/skills/uipath-orchestrator/SKILL.md +312 -0
  268. package/dist/skills/uipath-orchestrator/recipes/assets.md +282 -0
  269. package/dist/skills/uipath-orchestrator/recipes/audit-logs.md +215 -0
  270. package/dist/skills/uipath-orchestrator/recipes/buckets.md +205 -0
  271. package/dist/skills/uipath-orchestrator/recipes/jobs.md +286 -0
  272. package/dist/skills/uipath-orchestrator/recipes/list-folders.md +207 -0
  273. package/dist/skills/uipath-orchestrator/recipes/queue-items.md +292 -0
  274. package/dist/skills/uipath-orchestrator/recipes/queues.md +232 -0
  275. package/dist/skills/uipath-orchestrator/recipes/releases.md +212 -0
  276. package/dist/skills/uipath-orchestrator/recipes/robots-sessions.md +274 -0
  277. package/dist/skills/uipath-orchestrator/recipes/schedules.md +280 -0
  278. package/dist/skills/uipath-orchestrator/reference/endpoints.md +85 -0
  279. package/dist/skills/uipath-orchestrator/reference/schemas.md +153 -0
  280. package/dist/skills/uipath-taskautomation/SKILL.md +310 -0
  281. package/dist/skills/uipath-taskautomation/assets/CodedWorkflow.template.cs +98 -0
  282. package/dist/skills/uipath-taskautomation/assets/ExampleWorkflow.cs +146 -0
  283. package/dist/skills/uipath-taskautomation/references/action-activity-map.json +32 -0
  284. package/dist/skills/uipath-taskautomation/references/action-activity-map.md +44 -0
  285. package/dist/skills/uipath-taskautomation/references/app-profiles.md +63 -0
  286. package/dist/skills/uipath-taskautomation/references/automation-spec.md +88 -0
  287. package/dist/skills/uipath-taskautomation/references/coded-reference/assets/before-after-hooks-template.md +115 -0
  288. package/dist/skills/uipath-taskautomation/references/coded-reference/assets/codedworkflow-template.md +186 -0
  289. package/dist/skills/uipath-taskautomation/references/coded-reference/assets/helper-utility-template.md +22 -0
  290. package/dist/skills/uipath-taskautomation/references/coded-reference/assets/json-template.md +91 -0
  291. package/dist/skills/uipath-taskautomation/references/coded-reference/assets/testcase-template.md +92 -0
  292. package/dist/skills/uipath-taskautomation/references/coded-reference/cli-reference.md +249 -0
  293. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/codedworkflow-reference.md +275 -0
  294. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/coding-guidelines.md +229 -0
  295. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/inspect-package-guide.md +81 -0
  296. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/integration-service-guide.md +507 -0
  297. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/operations-guide.md +410 -0
  298. package/dist/skills/uipath-taskautomation/references/coded-reference/coded/third-party-packages-guide.md +67 -0
  299. package/dist/skills/uipath-taskautomation/references/coded-reference/data-manipulation-guide.md +110 -0
  300. package/dist/skills/uipath-taskautomation/references/coded-reference/environment-setup.md +194 -0
  301. package/dist/skills/uipath-taskautomation/references/coded-reference/error-handling-guide.md +195 -0
  302. package/dist/skills/uipath-taskautomation/references/coded-reference/powershell-interop-guide.md +57 -0
  303. package/dist/skills/uipath-taskautomation/references/coded-reference/project-structure-guide.md +114 -0
  304. package/dist/skills/uipath-taskautomation/references/coded-reference/project-structure.md +126 -0
  305. package/dist/skills/uipath-taskautomation/references/coded-reference/uia-elements-interaction-guide.md +109 -0
  306. package/dist/skills/uipath-taskautomation/references/coded-reference/validation-guide.md +147 -0
  307. package/dist/skills/uipath-taskautomation/references/coded-workflow-authoring.md +219 -0
  308. package/dist/skills/uipath-taskautomation/references/profiling-output.md +80 -0
  309. package/dist/skills/uipath-taskautomation/references/reliability-guide.md +83 -0
  310. package/dist/skills/uipath-taskautomation/references/task-automation-cheatsheet.md +272 -0
  311. package/dist/skills/uipath-taskautomation/references/template-preflight.md +17 -0
  312. package/dist/skills/uipath-workflow-documenter/SKILL.md +430 -0
  313. package/dist/skills/uipath-workflow-documenter/layouts/pdd-template.md +265 -0
  314. package/dist/skills/uipath-workflow-documenter/routines/from-orchestrator.md +11 -0
  315. package/dist/skills/uipath-workflow-documenter/routines/from-workflow.md +11 -0
  316. package/dist/skills/word-architect/SKILL.macos.md +147 -0
  317. package/dist/skills/word-architect/SKILL.md +502 -0
  318. package/dist/skills/word-architect/SKILL.windows.md +55 -0
  319. package/dist/skills/word-architect/api/advanced.md +522 -0
  320. package/dist/skills/word-architect/api/basic.md +378 -0
  321. package/dist/skills/word-architect/api/expert.md +302 -0
  322. package/dist/skills/word-architect/generation.md +308 -0
  323. package/dist/skills/word-architect/layouts/01-professional.md +168 -0
  324. package/dist/skills/word-architect/layouts/02-educational-kids.md +354 -0
  325. package/dist/skills/word-architect/layouts/03-academic.md +83 -0
  326. package/dist/skills/word-architect/layouts/04-creative.md +242 -0
  327. package/dist/skills/word-architect/layouts/05-operational.md +94 -0
  328. package/dist/skills/word-architect/macos/scripts/apply-heading-style.applescript +215 -0
  329. package/dist/skills/word-architect/macos/scripts/apply-style.applescript +272 -0
  330. package/dist/skills/word-architect/macos/scripts/autofit-tables.applescript +53 -0
  331. package/dist/skills/word-architect/macos/scripts/close-document.applescript +287 -0
  332. package/dist/skills/word-architect/macos/scripts/create-chart-with-data.applescript +379 -0
  333. package/dist/skills/word-architect/macos/scripts/create-chart.applescript +191 -0
  334. package/dist/skills/word-architect/macos/scripts/delete-selection.applescript +223 -0
  335. package/dist/skills/word-architect/macos/scripts/export-document.applescript +167 -0
  336. package/dist/skills/word-architect/macos/scripts/extract-table.applescript +168 -0
  337. package/dist/skills/word-architect/macos/scripts/find-by-style.applescript +173 -0
  338. package/dist/skills/word-architect/macos/scripts/find-text.applescript +199 -0
  339. package/dist/skills/word-architect/macos/scripts/format-table.applescript +234 -0
  340. package/dist/skills/word-architect/macos/scripts/format-text.applescript +431 -0
  341. package/dist/skills/word-architect/macos/scripts/get-document-properties.applescript +95 -0
  342. package/dist/skills/word-architect/macos/scripts/get-document-structure.applescript +371 -0
  343. package/dist/skills/word-architect/macos/scripts/get-header-footer-text.applescript +106 -0
  344. package/dist/skills/word-architect/macos/scripts/get-images.applescript +166 -0
  345. package/dist/skills/word-architect/macos/scripts/get-opened-files.applescript +103 -0
  346. package/dist/skills/word-architect/macos/scripts/get-paragraph-bounds.applescript +133 -0
  347. package/dist/skills/word-architect/macos/scripts/get-paragraph-format.applescript +134 -0
  348. package/dist/skills/word-architect/macos/scripts/get-recent-files.applescript +82 -0
  349. package/dist/skills/word-architect/macos/scripts/get-styled-text.applescript +256 -0
  350. package/dist/skills/word-architect/macos/scripts/get-tables.applescript +126 -0
  351. package/dist/skills/word-architect/macos/scripts/get-text-formatting.applescript +224 -0
  352. package/dist/skills/word-architect/macos/scripts/get-text.applescript +383 -0
  353. package/dist/skills/word-architect/macos/scripts/get-theme-colors.applescript +123 -0
  354. package/dist/skills/word-architect/macos/scripts/health-check.applescript +606 -0
  355. package/dist/skills/word-architect/macos/scripts/insert-cover-page.applescript +77 -0
  356. package/dist/skills/word-architect/macos/scripts/insert-header-footer.applescript +87 -0
  357. package/dist/skills/word-architect/macos/scripts/insert-horizontal-line.applescript +112 -0
  358. package/dist/skills/word-architect/macos/scripts/insert-html.applescript +440 -0
  359. package/dist/skills/word-architect/macos/scripts/insert-hyperlink.applescript +191 -0
  360. package/dist/skills/word-architect/macos/scripts/insert-image.applescript +320 -0
  361. package/dist/skills/word-architect/macos/scripts/insert-list.applescript +317 -0
  362. package/dist/skills/word-architect/macos/scripts/insert-pagebreak.applescript +181 -0
  363. package/dist/skills/word-architect/macos/scripts/insert-smartart.applescript +104 -0
  364. package/dist/skills/word-architect/macos/scripts/insert-table.applescript +238 -0
  365. package/dist/skills/word-architect/macos/scripts/insert-text.applescript +677 -0
  366. package/dist/skills/word-architect/macos/scripts/insert-textbox.applescript +261 -0
  367. package/dist/skills/word-architect/macos/scripts/maximize-window.applescript +67 -0
  368. package/dist/skills/word-architect/macos/scripts/normalize-formatting.applescript +56 -0
  369. package/dist/skills/word-architect/macos/scripts/open-document.applescript +222 -0
  370. package/dist/skills/word-architect/macos/scripts/replace-text.applescript +390 -0
  371. package/dist/skills/word-architect/macos/scripts/save-document.applescript +230 -0
  372. package/dist/skills/word-architect/macos/scripts/select-range.applescript +142 -0
  373. package/dist/skills/word-architect/macos/scripts/set-document-properties.applescript +195 -0
  374. package/dist/skills/word-architect/macos/scripts/set-page-layout.applescript +273 -0
  375. package/dist/skills/word-architect/macos/scripts/set-theme-colors.applescript +264 -0
  376. package/dist/skills/word-architect/macos/scripts/undo-redo.applescript +61 -0
  377. package/dist/skills/word-architect/macos/scripts/update-toc.applescript +112 -0
  378. package/dist/skills/word-architect/reference/formatting.md +119 -0
  379. package/dist/skills/word-architect/reference/html-layouts/01-executive-summary-box.md +36 -0
  380. package/dist/skills/word-architect/reference/html-layouts/02-kpi-summary-table.md +68 -0
  381. package/dist/skills/word-architect/reference/html-layouts/03-comparison-table.md +63 -0
  382. package/dist/skills/word-architect/reference/html-layouts/04-pros-cons-table.md +86 -0
  383. package/dist/skills/word-architect/reference/html-layouts/05-timeline-table.md +114 -0
  384. package/dist/skills/word-architect/reference/html-layouts/06-raci-matrix.md +95 -0
  385. package/dist/skills/word-architect/reference/html-layouts/07-data-table-alternating.md +84 -0
  386. package/dist/skills/word-architect/reference/html-layouts/08-callout-box.md +102 -0
  387. package/dist/skills/word-architect/reference/html-layouts/09-vertical-milestone.md +100 -0
  388. package/dist/skills/word-architect/reference/quality-assurance.md +102 -0
  389. package/dist/skills/word-architect/reference/tables.md +62 -0
  390. package/dist/skills/word-architect/reference/tracked-changes.md +34 -0
  391. package/dist/skills/word-architect/reference/uia-fallback.md +231 -0
  392. package/dist/skills/word-architect/reference/visual-elements.md +82 -0
  393. package/dist/skills/word-architect/windows/scripts/apply-heading-style.ps1 +190 -0
  394. package/dist/skills/word-architect/windows/scripts/autofit-tables.ps1 +64 -0
  395. package/dist/skills/word-architect/windows/scripts/create-chart-with-data.ps1 +133 -0
  396. package/dist/skills/word-architect/windows/scripts/create-chart.ps1 +73 -0
  397. package/dist/skills/word-architect/windows/scripts/export-document.ps1 +86 -0
  398. package/dist/skills/word-architect/windows/scripts/get-current-file.ps1 +27 -0
  399. package/dist/skills/word-architect/windows/scripts/insert-cover-page.ps1 +79 -0
  400. package/dist/skills/word-architect/windows/scripts/insert-horizontal-line.ps1 +74 -0
  401. package/dist/skills/word-architect/windows/scripts/insert-image.ps1 +98 -0
  402. package/dist/skills/word-architect/windows/scripts/insert-smartart.ps1 +118 -0
  403. package/dist/skills/word-architect/windows/scripts/insert-text-box.ps1 +90 -0
  404. package/dist/skills/word-architect/windows/scripts/normalize-formatting.ps1 +63 -0
  405. package/package.json +5 -4
@@ -0,0 +1,677 @@
1
+ #!/usr/bin/osascript
2
+ use framework "Foundation"
3
+ use scripting additions
4
+
5
+ (*
6
+ * Insert Text in Word Document
7
+ * Inserts text at a specified position in the active document.
8
+ *
9
+ * Usage: osascript insert-text.applescript <filePath> <text> <insertMode> <positionJson>
10
+ *
11
+ * Parameters:
12
+ * filePath - Path to the Word document (used for verification)
13
+ * text - The text to insert
14
+ * insertMode - "NewParagraph" (adds paragraph break) or "WithinParagraph" (inline insert)
15
+ * positionJson - JSON string defining where to insert:
16
+ * {"anchor":"documentStart"}
17
+ * {"anchor":"documentEnd"}
18
+ * {"anchor":"paragraphStart","paragraphNumber":N}
19
+ * {"anchor":"paragraphEnd","paragraphNumber":N}
20
+ * {"anchor":"characterIndex","index":N} (0-based)
21
+ *
22
+ * Examples:
23
+ * osascript insert-text.applescript "/path/to/doc.docx" "Hello World" "NewParagraph" '{"anchor":"documentStart"}'
24
+ * osascript insert-text.applescript "/path/to/doc.docx" "inserted text" "WithinParagraph" '{"anchor":"characterIndex","index":50}'
25
+ * osascript insert-text.applescript "/path/to/doc.docx" "New Section" "NewParagraph" '{"anchor":"paragraphEnd","paragraphNumber":3}'
26
+ *
27
+ * Output:
28
+ * {"success":true,"message":"Text inserted","stateChanges":{"documentLength":N}}
29
+ *
30
+ * Note: Word must be open with an active document.
31
+ *)
32
+
33
+ on run argv
34
+ -- ============================================================
35
+ -- BATCH MODE: osascript insert-text.applescript batch <filePath> '<json>'
36
+ -- JSON: [{"anchor":...,"paragraphNumber":N,"index":N,"insertMode":...,"text":...,
37
+ -- "originalIndex":N}, ...] — WordMacOsExecutor.normalizeBatchInsertItems already
38
+ -- flattens each item's position and sorts the array by position (highest first, to avoid
39
+ -- position shifts as earlier items are applied), so this only needs to decode JSON.
40
+ -- ============================================================
41
+ if (count of argv) > 0 and (item 1 of argv as string) is "batch" then
42
+ if (count of argv) < 3 then
43
+ return "Error: batch mode requires filePath and JSON array."
44
+ end if
45
+ set filePath to item 2 of argv as string
46
+ set batchJson to item 3 of argv as string
47
+
48
+ try
49
+ set batchItems to my parseBatchInsertItems(batchJson)
50
+ on error errMsg
51
+ return "Error: " & errMsg
52
+ end try
53
+
54
+ set totalOps to (batchItems's |count|()) as integer
55
+ set successCount to 0
56
+ set errors to {}
57
+ set itemResults to {}
58
+ set postMutationWarnings to {}
59
+ if totalOps is 0 then
60
+ return "{\"success\":false,\"applied\":false,\"verified\":true,\"operationsCompleted\":0,\"errors\":1,\"total\":0,\"partialCompletion\":false,\"itemResults\":[],\"errorDetails\":\"Batch insert requires at least one item.\"}"
61
+ end if
62
+ -- DELEGATE_RESTRICTED_WORD_OMIT_BEGIN
63
+ set batchCompatibilityLookup to my delegateFindCompatibilityModeWindow(filePath, "Refusing to query Word document state.", false)
64
+ set batchCompatibilityWindow to item 1 of batchCompatibilityLookup
65
+ set batchCompatibilityError to item 2 of batchCompatibilityLookup
66
+ if batchCompatibilityError is not "" then
67
+ return "Error: " & batchCompatibilityError
68
+ end if
69
+ if batchCompatibilityWindow is not missing value then
70
+ return "Error: Compatibility Mode batch insert is not supported. Use individual documentStart/documentEnd insert calls."
71
+ end if
72
+ -- DELEGATE_RESTRICTED_WORD_OMIT_END
73
+
74
+ tell application "Microsoft Word"
75
+ set doc to my findExactOpenDocument(filePath)
76
+ if doc is missing value then
77
+ return "Error: Microsoft Word could not keep the exact target document active. Refusing to query Word document state: " & filePath
78
+ end if
79
+
80
+ repeat with opIndex from 1 to totalOps
81
+ set opItem to batchItems's objectAtIndex:(opIndex - 1)
82
+ set originalIndex to (opItem's objectForKey:"originalIndex") as integer
83
+ set opAnchor to (opItem's objectForKey:"anchor") as text
84
+ set opParaNum to (opItem's objectForKey:"paragraphNumber") as integer
85
+ set opCharIdx to (opItem's objectForKey:"index") as integer
86
+ set opMode to (opItem's objectForKey:"insertMode") as text
87
+ set opText to (opItem's objectForKey:"text") as text
88
+
89
+ set mutationApplied to false
90
+ set mutationError to ""
91
+ try
92
+ set insertPos to my resolveInsertPosition(doc, opAnchor, opParaNum, opCharIdx)
93
+ set textToInsert to my prepareInsertText(opText, opMode, opAnchor)
94
+
95
+ set insertRange to create range doc start insertPos end insertPos
96
+ set content of insertRange to textToInsert
97
+ set mutationApplied to true
98
+ on error errMsg
99
+ set mutationError to errMsg
100
+ end try
101
+
102
+ if mutationApplied then
103
+ set successCount to successCount + 1
104
+ set end of itemResults to "{\"index\":" & originalIndex & ",\"status\":\"applied\",\"applied\":true}"
105
+ else
106
+ set escapedError to my escapeForJson(mutationError)
107
+ set end of errors to "Item " & originalIndex & ": " & mutationError
108
+ set end of itemResults to "{\"index\":" & originalIndex & ",\"status\":\"failed\",\"applied\":false,\"error\":\"" & escapedError & "\"}"
109
+ end if
110
+ end repeat
111
+
112
+ set documentLengthJson to ""
113
+ try
114
+ set newDocLen to end of content of text object of doc
115
+ set newDocLen0 to newDocLen - 1
116
+ set documentLengthJson to ",\"stateChanges\":{\"documentLength\":" & newDocLen0 & "}"
117
+ on error errMsg
118
+ set end of postMutationWarnings to "Inserted batch items, but could not read the updated document length: " & errMsg
119
+ end try
120
+ end tell
121
+
122
+ set errCount to count of errors
123
+ set itemResultsJson to my joinText(itemResults, ",")
124
+ set partialCompletion to (successCount > 0 and successCount < totalOps)
125
+ set warningJson to my warningFields(postMutationWarnings)
126
+ if errCount > 0 then
127
+ set AppleScript's text item delimiters to "; "
128
+ set errStr to errors as string
129
+ set AppleScript's text item delimiters to ""
130
+ set errorDetailsJson to ",\"errorDetails\":\"" & my escapeForJson(errStr) & "\""
131
+ else
132
+ set errorDetailsJson to ""
133
+ end if
134
+ set partialJson to my jsonBool(partialCompletion)
135
+ set successJson to my jsonBool(errCount is 0)
136
+ if successCount > 0 and (errCount > 0 or (count of postMutationWarnings) > 0) then
137
+ set retryJson to ",\"doNotRetry\":true"
138
+ else
139
+ set retryJson to ""
140
+ end if
141
+ set appliedJson to my jsonBool(successCount > 0)
142
+ set verifiedJson to my jsonBool((count of postMutationWarnings) is 0)
143
+ return "{\"success\":" & successJson & ",\"applied\":" & appliedJson & ",\"verified\":" & verifiedJson & ",\"operationsCompleted\":" & successCount & ",\"errors\":" & errCount & ",\"total\":" & totalOps & ",\"partialCompletion\":" & partialJson & ",\"itemResults\":[" & itemResultsJson & "]" & documentLengthJson & errorDetailsJson & warningJson & retryJson & "}"
144
+ end if
145
+
146
+ -- ============================================================
147
+ -- SINGLE MODE (original behavior)
148
+ -- ============================================================
149
+ if (count of argv) < 4 then
150
+ return "Error: Missing arguments. Usage: osascript insert-text.applescript <filePath> <text> <insertMode> <positionJson>
151
+
152
+ Parameters:
153
+ filePath - Path to the Word document
154
+ text - The text to insert
155
+ insertMode - \"NewParagraph\" or \"WithinParagraph\"
156
+ positionJson - JSON position: {\"anchor\":\"documentStart\"}, {\"anchor\":\"characterIndex\",\"index\":N}, etc.
157
+
158
+ Examples:
159
+ osascript insert-text.applescript \"/path/to/doc.docx\" \"Hello\" \"NewParagraph\" '{\"anchor\":\"documentEnd\"}'"
160
+ end if
161
+
162
+ set filePath to item 1 of argv as string
163
+ set insertText to item 2 of argv as string
164
+ set insertMode to item 3 of argv as string
165
+ set positionJson to item 4 of argv as string
166
+
167
+ -- Parse position JSON
168
+ set anchorType to my extractJsonValue(positionJson, "anchor")
169
+
170
+ if anchorType is "" then
171
+ return "Error: Invalid positionJson. Must contain an \"anchor\" field."
172
+ end if
173
+
174
+ -- DELEGATE_RESTRICTED_WORD_OMIT_BEGIN
175
+ -- Word document-object ranges can block indefinitely in Compatibility
176
+ -- Mode. Use a bounded UI path against the exact requested file window.
177
+ set compatibilityResult to my insertCompatibilityModeText(filePath, insertText, insertMode, anchorType)
178
+ if compatibilityResult is not missing value then return compatibilityResult
179
+ -- DELEGATE_RESTRICTED_WORD_OMIT_END
180
+
181
+ tell application "Microsoft Word"
182
+ set mutationApplied to false
183
+ set postMutationWarnings to {}
184
+ try
185
+ set doc to my findExactOpenDocument(filePath)
186
+ if doc is missing value then
187
+ return "Error: Microsoft Word could not keep the exact target document active. Refusing to query Word document state: " & filePath
188
+ end if
189
+
190
+ -- Determine the insert position (0-based for Word's create range) through the one
191
+ -- shared resolver both the single and batch paths call.
192
+ set paraNum to 0
193
+ set charIdx to 0
194
+ if anchorType is "paragraphStart" or anchorType is "paragraphEnd" then
195
+ set paraNum to my extractJsonNumberMultiKey(positionJson, {"paragraphNumber", "paragraph", "value"})
196
+ else if anchorType is "characterIndex" then
197
+ set charIdx to my extractJsonNumberMultiKey(positionJson, {"index", "value"})
198
+ end if
199
+ set insertPos to my resolveInsertPosition(doc, anchorType, paraNum, charIdx)
200
+
201
+ set textToInsert to my prepareInsertText(insertText, insertMode, anchorType)
202
+
203
+ -- When inserting a NewParagraph, check if the current position is inside a
204
+ -- heading/title style so we can reset the newly inserted text to Normal.
205
+ set needsStyleReset to false
206
+ if insertMode is "NewParagraph" then
207
+ try
208
+ set checkRange to create range doc start insertPos end (insertPos + 1)
209
+ set currentStyleName to name local of style of checkRange
210
+ if currentStyleName starts with "Heading" or currentStyleName is "Title" or currentStyleName is "Subtitle" then
211
+ set needsStyleReset to true
212
+ end if
213
+ end try
214
+ end if
215
+
216
+ -- Create a zero-width range at the insert position and set content to insert
217
+ set insertRange to create range doc start insertPos end insertPos
218
+ set content of insertRange to textToInsert
219
+ set mutationApplied to true
220
+
221
+ -- Reset style of the newly inserted text to Normal if it inherited a heading style
222
+ if needsStyleReset then
223
+ try
224
+ -- The inserted text occupies a range starting from insertPos.
225
+ -- For "end" anchors we prepend return, so the new text starts at insertPos+1.
226
+ -- For "start" anchors we append return, so the new text starts at insertPos.
227
+ set insertedLen to count of textToInsert
228
+ if anchorType is "documentEnd" or anchorType is "paragraphEnd" then
229
+ -- Prepended return + text: reset just the text portion (skip the leading return)
230
+ set newTextStart to insertPos + 1
231
+ set newTextEnd to insertPos + insertedLen
232
+ else
233
+ -- Text + appended return: reset just the text portion (skip the trailing return)
234
+ set newTextStart to insertPos
235
+ set newTextEnd to insertPos + insertedLen - 1
236
+ end if
237
+ set newRange to create range doc start newTextStart end newTextEnd
238
+ set style of newRange to Word style "Normal" of doc
239
+ on error errMsg
240
+ set end of postMutationWarnings to "Text was inserted, but its inherited style could not be reset: " & errMsg
241
+ end try
242
+ end if
243
+
244
+ -- Get updated document length
245
+ set documentLengthJson to ""
246
+ try
247
+ set newDocLen to end of content of text object of doc
248
+ set newDocLen0 to newDocLen - 1
249
+ set documentLengthJson to ",\"stateChanges\":{\"documentLength\":" & newDocLen0 & "}"
250
+ on error errMsg
251
+ set end of postMutationWarnings to "Text was inserted, but the updated document length could not be read: " & errMsg
252
+ end try
253
+
254
+ return my appliedResultJson("Text inserted", postMutationWarnings, documentLengthJson, true)
255
+ on error errMsg
256
+ if mutationApplied then
257
+ set end of postMutationWarnings to "Text was inserted, but a later step failed: " & errMsg
258
+ return my appliedResultJson("Text inserted but post-insert checks were incomplete", postMutationWarnings, "", false)
259
+ end if
260
+ return "Error: " & errMsg
261
+ end try
262
+ end tell
263
+ end run
264
+
265
+ -- DELEGATE_RESTRICTED_WORD_OMIT_BEGIN
266
+ on insertCompatibilityModeText(filePath, insertText, insertMode, anchorType)
267
+ set compatibilityLookup to my delegateFindCompatibilityModeWindow(filePath, "Refusing to query Word document state.", false)
268
+ set targetWindow to item 1 of compatibilityLookup
269
+ set compatibilityError to item 2 of compatibilityLookup
270
+ if compatibilityError is not "" then return "Error: " & compatibilityError
271
+ if targetWindow is missing value then return missing value
272
+ if anchorType is not "documentStart" and anchorType is not "documentEnd" then
273
+ return "Error: Compatibility Mode insert supports documentStart or documentEnd only."
274
+ end if
275
+
276
+ set savedClipboard to missing value
277
+ set savedFocusedElement to missing value
278
+ set savedSelectionRange to missing value
279
+ set paragraphBoundaryDispatched to false
280
+ set pasteDispatched to false
281
+ set postMutationWarnings to {}
282
+ set clipboardCaptured to false
283
+ try
284
+ set savedClipboard to the clipboard as record
285
+ set clipboardCaptured to true
286
+ end try
287
+ if not clipboardCaptured then
288
+ return "Error: The existing clipboard could not be captured; Compatibility Mode paste was not dispatched."
289
+ end if
290
+
291
+ try
292
+ set pasteboard to current application's NSPasteboard's generalPasteboard()
293
+ pasteboard's clearContents()
294
+ set clipboardWriteAccepted to pasteboard's setString:(insertText as text) forType:(current application's NSPasteboardTypeString)
295
+ if not (clipboardWriteAccepted as boolean) then
296
+ error "The requested text could not be written to the macOS pasteboard; paste was not dispatched."
297
+ end if
298
+ -- setString:forType: is a synchronous, same-process, local write: a true result already
299
+ -- means the exact bytes are on the pasteboard. The one readback that earns its keep is
300
+ -- immediately before the keystroke below, after the AX navigation that could let something
301
+ -- else change the pasteboard in between.
302
+
303
+ tell application "System Events"
304
+ tell process "Microsoft Word"
305
+ set frontmost to true
306
+ perform action "AXRaise" of targetWindow
307
+ delay 0.1
308
+
309
+ set focusLookup to my delegateRequireFocusedWordDocument(filePath, "The focused Word editing surface was not bound to the exact requested document; paste was not dispatched.")
310
+ set focusedDocumentRoot to item 1 of focusLookup
311
+ set focusError to item 2 of focusLookup
312
+ if focusError is not "" then error focusError
313
+
314
+ -- Word does not expose its real document tree as ordinary
315
+ -- `UI elements` of the window. Start from the verified focused
316
+ -- document root and traverse AXChildren instead.
317
+ set pasteTarget to missing value
318
+ repeat 3 times
319
+ set pasteTarget to my findEditableDocumentElement(focusedDocumentRoot)
320
+ if pasteTarget is not missing value then exit repeat
321
+ delay 0.05
322
+ end repeat
323
+ if pasteTarget is missing value then
324
+ error "The requested Word document did not expose a bounded AXTextArea with AXSelectedTextRange; paste was not dispatched."
325
+ end if
326
+ set savedFocusedElement to pasteTarget
327
+ set savedSelectionRange to value of attribute "AXSelectedTextRange" of pasteTarget
328
+ set focused of pasteTarget to true
329
+ if anchorType is "documentEnd" then
330
+ key code 125 using command down
331
+ delay 0.05
332
+ -- Establish the paragraph boundary before measuring the
333
+ -- caret so only Cmd+V can satisfy paste verification.
334
+ key code 36
335
+ set paragraphBoundaryDispatched to true
336
+ delay 0.05
337
+ else
338
+ key code 126 using command down
339
+ delay 0.05
340
+ end if
341
+
342
+ set prePasteRange to value of attribute "AXSelectedTextRange" of pasteTarget
343
+ set prePasteSignature to my selectionRangeSignature(prePasteRange)
344
+
345
+ set currentClipboardPayload to the clipboard as text
346
+ if currentClipboardPayload is not insertText then
347
+ error "The macOS pasteboard changed before Word paste; paste was not dispatched."
348
+ end if
349
+ keystroke "v" using command down
350
+ set pasteDispatched to true
351
+
352
+ set pasteVerified to false
353
+ repeat with verificationAttempt from 1 to 30
354
+ delay 0.05
355
+ try
356
+ set currentPasteRange to value of attribute "AXSelectedTextRange" of pasteTarget
357
+ set currentPasteSignature to my selectionRangeSignature(currentPasteRange)
358
+ set verificationDecision to my pasteVerificationDecision(prePasteSignature, currentPasteSignature, verificationAttempt, 30)
359
+ if verificationDecision is "verified" then
360
+ set pasteVerified to true
361
+ exit repeat
362
+ end if
363
+ end try
364
+ end repeat
365
+ if anchorType is "documentStart" and insertMode is "NewParagraph" and pasteVerified then key code 36
366
+ end tell
367
+ end tell
368
+
369
+ set cleanupComplete to true
370
+ if savedFocusedElement is not missing value and savedSelectionRange is not missing value then
371
+ try
372
+ tell application "System Events"
373
+ set value of attribute "AXSelectedTextRange" of savedFocusedElement to savedSelectionRange
374
+ end tell
375
+ on error errMsg
376
+ set cleanupComplete to false
377
+ set end of postMutationWarnings to "Text was pasted, but the previous selection could not be restored: " & errMsg
378
+ end try
379
+ end if
380
+ try
381
+ my restoreClipboard(savedClipboard)
382
+ on error errMsg
383
+ set cleanupComplete to false
384
+ set end of postMutationWarnings to "Text was pasted, but the previous clipboard could not be restored: " & errMsg
385
+ end try
386
+ set compatibilityJson to ",\"compatibilityMode\":true"
387
+ if pasteVerified and cleanupComplete then
388
+ return my appliedResultJson("Text inserted", postMutationWarnings, compatibilityJson, true)
389
+ end if
390
+ if not pasteVerified then
391
+ set end of postMutationWarnings to "Compatibility Mode paste was dispatched but its consumption could not be verified within the bounded check; do not retry automatically."
392
+ else
393
+ set end of postMutationWarnings to "Compatibility Mode paste was verified, but cleanup was incomplete; do not retry automatically."
394
+ end if
395
+ return my appliedResultJson("Text insert dispatched but not verified", postMutationWarnings, compatibilityJson, false)
396
+ on error errMsg
397
+ if paragraphBoundaryDispatched or pasteDispatched then
398
+ try
399
+ my restoreClipboard(savedClipboard)
400
+ on error restoreErr
401
+ set end of postMutationWarnings to "The previous clipboard could not be restored: " & restoreErr
402
+ end try
403
+ return my compatibilityMutationFailureResult(paragraphBoundaryDispatched, pasteDispatched, errMsg, postMutationWarnings)
404
+ end if
405
+ try
406
+ my restoreClipboard(savedClipboard)
407
+ end try
408
+ return "Error: Failed to insert Compatibility Mode text: " & errMsg
409
+ end try
410
+ end insertCompatibilityModeText
411
+
412
+ on compatibilityMutationFailureResult(paragraphBoundaryDispatched, pasteDispatched, errMsg, postMutationWarnings)
413
+ if pasteDispatched then
414
+ set end of postMutationWarnings to "Text paste was dispatched, but a later step failed: " & errMsg
415
+ return my appliedResultJson("Text insert dispatched but post-insert checks were incomplete", postMutationWarnings, ",\"compatibilityMode\":true", false)
416
+ end if
417
+ if paragraphBoundaryDispatched then
418
+ set end of postMutationWarnings to "A paragraph boundary was inserted at document end, but text paste was not dispatched because a later step failed: " & errMsg
419
+ set warningJson to my warningFields(postMutationWarnings)
420
+ return "{\"success\":true,\"applied\":true,\"verified\":false,\"message\":\"Paragraph boundary inserted but text paste was not dispatched\",\"compatibilityMode\":true,\"outcome\":\"boundary_only\",\"textInserted\":false,\"retryTextOnly\":true,\"doNotRetry\":true" & warningJson & "}"
421
+ end if
422
+ return "Error: Failed to insert Compatibility Mode text: " & errMsg
423
+ end compatibilityMutationFailureResult
424
+ -- DELEGATE_RESTRICTED_WORD_OMIT_END
425
+
426
+ on findExactOpenDocument(filePath)
427
+ set expectedIdentity to my delegateCanonicalOfficeIdentity(filePath)
428
+ if expectedIdentity is missing value then
429
+ error "The requested Word file path does not resolve to a canonical local file identity: " & filePath
430
+ end if
431
+ tell application "Microsoft Word"
432
+ try
433
+ set targetDocument to active document
434
+ if my delegateIdentitiesMatch(my delegateCanonicalOfficeIdentity(posix full name of targetDocument), expectedIdentity) then return targetDocument
435
+ end try
436
+ end tell
437
+ return missing value
438
+ end findExactOpenDocument
439
+
440
+ -- DELEGATE_RESTRICTED_WORD_OMIT_BEGIN
441
+ on findEditableDocumentElement(targetWindow)
442
+ set pendingElements to {targetWindow}
443
+ set nextElementIndex to 1
444
+ set inspectedElementCount to 0
445
+ tell application "System Events"
446
+ repeat while nextElementIndex <= (count of pendingElements) and inspectedElementCount < 50
447
+ set candidateElement to item nextElementIndex of pendingElements
448
+ set nextElementIndex to nextElementIndex + 1
449
+ set inspectedElementCount to inspectedElementCount + 1
450
+ try
451
+ set candidateRole to value of attribute "AXRole" of candidateElement as text
452
+ if candidateRole is "AXTextArea" then
453
+ value of attribute "AXSelectedTextRange" of candidateElement
454
+ return candidateElement
455
+ end if
456
+ end try
457
+ try
458
+ set childElements to value of attribute "AXChildren" of candidateElement
459
+ repeat with childElement in childElements
460
+ if (count of pendingElements) >= 50 then exit repeat
461
+ set end of pendingElements to contents of childElement
462
+ end repeat
463
+ end try
464
+ end repeat
465
+ end tell
466
+ return missing value
467
+ end findEditableDocumentElement
468
+
469
+ on selectionRangeSignature(selectionRange)
470
+ try
471
+ return (item 1 of selectionRange as text) & ":" & (item 2 of selectionRange as text)
472
+ end try
473
+ return selectionRange as text
474
+ end selectionRangeSignature
475
+
476
+ on pasteVerificationDecision(beforeSignature, afterSignature, attemptNumber, maximumAttempts)
477
+ if afterSignature is not "" and afterSignature is not beforeSignature then return "verified"
478
+ if attemptNumber < maximumAttempts then return "retry"
479
+ return "unverified"
480
+ end pasteVerificationDecision
481
+
482
+ on restoreClipboard(savedClipboard)
483
+ if savedClipboard is not missing value then
484
+ set the clipboard to savedClipboard
485
+ else
486
+ set the clipboard to ""
487
+ end if
488
+ end restoreClipboard
489
+ -- DELEGATE_RESTRICTED_WORD_OMIT_END
490
+
491
+ -- Extract a string value from a JSON string by key name
492
+ on extractJsonValue(jsonStr, keyName)
493
+ set AppleScript's text item delimiters to "\"" & keyName & "\":"
494
+ if (count of text items of jsonStr) < 2 then
495
+ set AppleScript's text item delimiters to ""
496
+ return ""
497
+ end if
498
+ set afterKey to text item 2 of jsonStr
499
+ set AppleScript's text item delimiters to ""
500
+
501
+ -- Handle string values (starts with quote)
502
+ set trimmedAfter to my trimLeadingSpaces(afterKey)
503
+ if trimmedAfter starts with "\"" then
504
+ set AppleScript's text item delimiters to "\""
505
+ set parts to text items of trimmedAfter
506
+ set AppleScript's text item delimiters to ""
507
+ if (count of parts) >= 3 then
508
+ return item 2 of parts
509
+ end if
510
+ return ""
511
+ end if
512
+
513
+ -- Handle number/boolean values
514
+ set AppleScript's text item delimiters to ","
515
+ set val to text item 1 of trimmedAfter
516
+ set AppleScript's text item delimiters to "}"
517
+ set val to text item 1 of val
518
+ set AppleScript's text item delimiters to ""
519
+ return my trimLeadingSpaces(val)
520
+ end extractJsonValue
521
+
522
+ -- Extract a numeric value from a JSON string by key name
523
+ on extractJsonNumber(jsonStr, keyName)
524
+ set val to my extractJsonValue(jsonStr, keyName)
525
+ if val is "" then return -1
526
+ try
527
+ return val as integer
528
+ on error
529
+ return -1
530
+ end try
531
+ end extractJsonNumber
532
+
533
+ -- Extract a numeric value trying multiple key names (first match wins)
534
+ on extractJsonNumberMultiKey(jsonStr, keyNames)
535
+ repeat with kn in keyNames
536
+ set val to my extractJsonNumber(jsonStr, kn as string)
537
+ if val is not -1 then return val
538
+ end repeat
539
+ return -1
540
+ end extractJsonNumberMultiKey
541
+
542
+ -- Trim leading spaces
543
+ on trimLeadingSpaces(txt)
544
+ set t to txt
545
+ repeat while t starts with " " or t starts with tab
546
+ if (count of t) > 1 then
547
+ set t to text 2 thru -1 of t
548
+ else
549
+ return ""
550
+ end if
551
+ end repeat
552
+ return t
553
+ end trimLeadingSpaces
554
+
555
+ -- Parses the batch insert JSON array. WordMacOsExecutor.normalizeBatchInsertItems already
556
+ -- resolves each item's anchor/paragraphNumber/index/insertMode/text (with defaults applied) and
557
+ -- sorts the array descending by position, so this only decodes JSON; it does not interpret it.
558
+ on parseBatchInsertItems(jsonStr)
559
+ set jsonData to (current application's NSString's stringWithString:jsonStr)'s dataUsingEncoding:(current application's NSUTF8StringEncoding)
560
+ set jsonArray to current application's NSJSONSerialization's JSONObjectWithData:jsonData options:0 |error|:(missing value)
561
+ if jsonArray is missing value then error "Invalid batch insert JSON array."
562
+ return jsonArray
563
+ end parseBatchInsertItems
564
+
565
+ -- Shared text preparation for the batch and single insert paths.
566
+ -- Bracketing depends on the anchor as well as the mode: an end anchor needs a LEADING return so
567
+ -- the insert starts a new paragraph instead of merging into the last one, while any other anchor
568
+ -- needs a TRAILING return. The batch path used to bracket on mode alone, so identical arguments
569
+ -- produced different documents depending on which path ran them.
570
+ on prepareInsertText(insertText, insertMode, anchorType)
571
+ if anchorType is "documentEnd" or anchorType is "paragraphEnd" then
572
+ if insertText starts with return then return insertText
573
+ return (return & insertText)
574
+ end if
575
+ if insertMode is "NewParagraph" then
576
+ if insertText ends with return then return insertText
577
+ return (insertText & return)
578
+ end if
579
+ return insertText
580
+ end prepareInsertText
581
+
582
+ -- Shared position resolution for both the batch and single insert paths. Given an anchor type
583
+ -- plus its already-extracted paragraph number / character index, returns the 0-based insert
584
+ -- position Word's create range expects. paraNum/charIdx are ignored when irrelevant to anchorType.
585
+ --
586
+ -- Raises an AppleScript error (caught by each caller's own try block) for an invalid or
587
+ -- out-of-range paragraph number, or a negative character index, rather than silently clamping:
588
+ -- the batch path used to clamp an out-of-range paragraph number onto whichever paragraph was
589
+ -- closest, silently inserting into the wrong one, while the single path always errored. Extracted
590
+ -- from the single path's body, so both now share its error-on-out-of-range contract.
591
+ on resolveInsertPosition(doc, anchorType, paraNum, charIdx)
592
+ tell application "Microsoft Word"
593
+ set docEnd to end of content of (text object of doc)
594
+
595
+ if anchorType is "documentStart" then
596
+ return 0
597
+
598
+ else if anchorType is "documentEnd" then
599
+ -- Use end-1 to avoid accessing past the last character
600
+ if docEnd > 0 then return docEnd - 1
601
+ return 0
602
+
603
+ else if anchorType is "paragraphStart" then
604
+ if paraNum < 1 then error "Invalid paragraphNumber in positionJson."
605
+ set paraCount to count of paragraphs of doc
606
+ if paraNum > paraCount then error "paragraphNumber " & paraNum & " exceeds document paragraph count (" & paraCount & ")."
607
+ return start of content of (text object of paragraph paraNum of doc)
608
+
609
+ else if anchorType is "paragraphEnd" then
610
+ if paraNum < 1 then error "Invalid paragraphNumber in positionJson."
611
+ set paraCount to count of paragraphs of doc
612
+ if paraNum > paraCount then error "paragraphNumber " & paraNum & " exceeds document paragraph count (" & paraCount & ")."
613
+ set paraEnd to end of content of (text object of paragraph paraNum of doc)
614
+ -- Use end-1 to stay within valid range
615
+ if paraEnd > 0 then return paraEnd - 1
616
+ return 0
617
+
618
+ else if anchorType is "characterIndex" then
619
+ if charIdx < 0 then error "Invalid index in positionJson."
620
+ set insertPos to charIdx
621
+ if insertPos > (docEnd - 1) then set insertPos to docEnd - 1
622
+ return insertPos
623
+ end if
624
+
625
+ error "Unknown anchor type '" & anchorType & "'. Use: documentStart, documentEnd, paragraphStart, paragraphEnd, characterIndex."
626
+ end tell
627
+ end resolveInsertPosition
628
+
629
+ on appliedResultJson(messageText, warnings, extraJson, isVerified)
630
+ set verifiedJson to my jsonBool(isVerified)
631
+ set warningJson to my warningFields(warnings)
632
+ if (count of warnings) > 0 or not isVerified then
633
+ set retryJson to ",\"doNotRetry\":true"
634
+ else
635
+ set retryJson to ""
636
+ end if
637
+ return "{\"success\":true,\"applied\":true,\"verified\":" & verifiedJson & ",\"message\":\"" & my escapeForJson(messageText) & "\"" & extraJson & warningJson & retryJson & "}"
638
+ end appliedResultJson
639
+
640
+ -- Renders an AppleScript boolean as a bare JSON boolean literal ("true"/"false").
641
+ on jsonBool(flag)
642
+ if flag then return "true"
643
+ return "false"
644
+ end jsonBool
645
+
646
+ on warningFields(warnings)
647
+ if (count of warnings) is 0 then return ""
648
+ set warningText to my joinText(warnings, "; ")
649
+ return ",\"warning\":\"" & my escapeForJson(warningText) & "\""
650
+ end warningFields
651
+
652
+ on joinText(textItems, delimiterText)
653
+ set previousDelimiters to AppleScript's text item delimiters
654
+ set AppleScript's text item delimiters to delimiterText
655
+ set joinedText to textItems as text
656
+ set AppleScript's text item delimiters to previousDelimiters
657
+ return joinedText
658
+ end joinText
659
+
660
+ on escapeForJson(txt)
661
+ set escapedText to my replaceText(txt as text, "\\", "\\\\")
662
+ set escapedText to my replaceText(escapedText, "\"", "\\\"")
663
+ set escapedText to my replaceText(escapedText, return, "\\n")
664
+ set escapedText to my replaceText(escapedText, linefeed, "\\n")
665
+ set escapedText to my replaceText(escapedText, tab, "\\t")
666
+ return escapedText
667
+ end escapeForJson
668
+
669
+ -- Replace all occurrences of searchStr with replaceStr
670
+ on replaceText(theText, searchStr, replaceStr)
671
+ set AppleScript's text item delimiters to searchStr
672
+ set theItems to text items of theText
673
+ set AppleScript's text item delimiters to replaceStr
674
+ set theText to theItems as string
675
+ set AppleScript's text item delimiters to ""
676
+ return theText
677
+ end replaceText