@uipath/skills 1.196.0 → 1.197.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (592) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +5 -2
  3. package/CODEOWNERS +22 -7
  4. package/README.md +14 -1
  5. package/assets/skill-status.json +14 -1
  6. package/assets/uip-catalog-snapshot.json +13 -2
  7. package/hooks/hooks.json +12 -0
  8. package/hooks/send-telemetry.sh +445 -0
  9. package/hooks/suggest-permissions.sh +6 -0
  10. package/package.json +1 -1
  11. package/skills/uipath-admin/SKILL.md +24 -4
  12. package/skills/uipath-admin/references/audit-commands.md +25 -21
  13. package/skills/uipath-admin/references/audit-workflow-guide.md +26 -25
  14. package/skills/uipath-admin/references/diagnose/CAPABILITY.md +74 -0
  15. package/skills/uipath-admin/references/diagnose/references/failure-modes.md +228 -0
  16. package/skills/uipath-admin/references/diagnose/references/troubleshooting-guide.md +106 -0
  17. package/skills/uipath-admin/references/identity-troubleshoot-guide.md +251 -0
  18. package/skills/uipath-agents/SKILL.md +12 -8
  19. package/skills/uipath-agents/references/coded/capabilities/context-grounding.md +2 -0
  20. package/skills/uipath-agents/references/coded/capabilities/conversational-agents.md +2 -0
  21. package/skills/uipath-agents/references/coded/capabilities/guardrails/guardrails-recommend.md +12 -7
  22. package/skills/uipath-agents/references/coded/capabilities/guardrails/guardrails.md +141 -1
  23. package/skills/uipath-agents/references/coded/capabilities/human-in-the-loop.md +2 -0
  24. package/skills/uipath-agents/references/coded/capabilities/integration-service.md +19 -33
  25. package/skills/uipath-agents/references/coded/lifecycle/bindings-reference.md +54 -22
  26. package/skills/uipath-agents/references/coded/lifecycle/build.md +1 -0
  27. package/skills/uipath-agents/references/coded/lifecycle/evaluations/evaluation-sets.md +5 -1
  28. package/skills/uipath-agents/references/coded/lifecycle/setup.md +3 -1
  29. package/skills/uipath-agents/references/coded/quickstart.md +11 -10
  30. package/skills/uipath-agents/references/coded-vs-lowcode-guide.md +1 -0
  31. package/skills/uipath-agents/references/context-grounding-patterns.md +1 -1
  32. package/skills/uipath-agents/references/lowcode/agent-definition.md +97 -12
  33. package/skills/uipath-agents/references/lowcode/capabilities/built-in-tools/analyze-attachments.md +2 -2
  34. package/skills/uipath-agents/references/lowcode/capabilities/built-in-tools/batch-transform/impl-json.md +40 -14
  35. package/skills/uipath-agents/references/lowcode/capabilities/built-in-tools/built-in-tools.md +4 -3
  36. package/skills/uipath-agents/references/lowcode/capabilities/built-in-tools/deeprag/impl-json.md +38 -6
  37. package/skills/uipath-agents/references/lowcode/capabilities/context/attachments.md +1 -1
  38. package/skills/uipath-agents/references/lowcode/capabilities/context/context.md +1 -1
  39. package/skills/uipath-agents/references/lowcode/capabilities/context/datafabric.md +1 -1
  40. package/skills/uipath-agents/references/lowcode/capabilities/context/index.md +7 -3
  41. package/skills/uipath-agents/references/lowcode/capabilities/escalation/escalation.md +49 -38
  42. package/skills/uipath-agents/references/lowcode/capabilities/guardrails/guardrails-recommend.md +3 -1
  43. package/skills/uipath-agents/references/lowcode/capabilities/guardrails/guardrails.md +49 -49
  44. package/skills/uipath-agents/references/lowcode/capabilities/inline-in-flow/inline-in-flow.md +34 -14
  45. package/skills/uipath-agents/references/lowcode/capabilities/integration-service/integration-service.md +1 -1
  46. package/skills/uipath-agents/references/lowcode/capabilities/memory/memory.md +2 -0
  47. package/skills/uipath-agents/references/lowcode/capabilities/process/process.md +2 -2
  48. package/skills/uipath-agents/references/lowcode/capabilities/process/solution-files.md +1 -1
  49. package/skills/uipath-agents/references/lowcode/critical-rules/autonomous-critical-rules.md +15 -0
  50. package/skills/uipath-agents/references/lowcode/critical-rules/conversational-critical-rules.md +19 -0
  51. package/skills/uipath-agents/references/lowcode/{critical-rules.md → critical-rules/critical-rules.md} +25 -27
  52. package/skills/uipath-agents/references/lowcode/debug.md +6 -3
  53. package/skills/uipath-agents/references/lowcode/evaluations/evaluate.md +2 -0
  54. package/skills/uipath-agents/references/lowcode/lowcode.md +29 -6
  55. package/skills/uipath-agents/references/lowcode/model-selection-guide.md +4 -1
  56. package/skills/uipath-agents/references/lowcode/project-lifecycle.md +20 -8
  57. package/skills/uipath-agents/references/lowcode/prompting/agent-prompting-guide.md +17 -0
  58. package/skills/uipath-agents/references/lowcode/{agent-prompting-guide.md → prompting/autonomous-agent-prompting-guide.md} +9 -11
  59. package/skills/uipath-agents/references/lowcode/prompting/conversational-agent-prompting-guide.md +123 -0
  60. package/skills/uipath-agents/references/lowcode/solution-resources.md +1 -1
  61. package/skills/uipath-api-workflow/SKILL.md +32 -12
  62. package/skills/uipath-api-workflow/references/cli-reference.md +110 -22
  63. package/skills/uipath-api-workflow/references/connector-activity-discovery.md +43 -4
  64. package/skills/uipath-api-workflow/references/troubleshooting.md +23 -7
  65. package/skills/uipath-api-workflow/references/workflow-file-format.md +25 -7
  66. package/skills/uipath-coded-apps/SKILL.md +55 -12
  67. package/skills/uipath-coded-apps/assets/fixtures/governance-dashboard-starter-kit.tar.gz +0 -0
  68. package/skills/uipath-coded-apps/assets/scripts/dashboards/build-dashboard.mjs +1371 -0
  69. package/skills/uipath-coded-apps/assets/scripts/dashboards/capability-registry.json +845 -0
  70. package/skills/uipath-coded-apps/assets/scripts/dashboards/flows/build.mjs +338 -0
  71. package/skills/uipath-coded-apps/assets/scripts/dashboards/flows/edit.mjs +248 -0
  72. package/skills/uipath-coded-apps/assets/scripts/dashboards/flows/template.mjs +82 -0
  73. package/skills/uipath-coded-apps/assets/scripts/dashboards/flows/upgrade.mjs +73 -0
  74. package/skills/uipath-coded-apps/assets/scripts/dashboards/lifecycle.mjs +207 -0
  75. package/skills/uipath-coded-apps/assets/scripts/dashboards/setup-admin-folder.mjs +146 -0
  76. package/skills/uipath-coded-apps/assets/scripts/dashboards/tests/regime-eject.test.mjs +124 -0
  77. package/skills/uipath-coded-apps/assets/scripts/dashboards/tests/resolution.test.mjs +1635 -0
  78. package/skills/uipath-coded-apps/assets/templates/action-app/app-template.css +9 -0
  79. package/skills/uipath-coded-apps/assets/templates/action-app/document-tab-template.css +139 -0
  80. package/skills/uipath-coded-apps/assets/templates/action-app/form-template.css +442 -0
  81. package/skills/uipath-coded-apps/assets/templates/action-app/index-template.css +111 -0
  82. package/skills/uipath-coded-apps/assets/templates/action-app-template.md +357 -152
  83. package/skills/uipath-coded-apps/assets/templates/web-app-template.md +255 -78
  84. package/skills/uipath-coded-apps/references/create-action-app.md +284 -195
  85. package/skills/uipath-coded-apps/references/create-web-app.md +64 -26
  86. package/skills/uipath-coded-apps/references/dashboards/CAPABILITY.md +179 -0
  87. package/skills/uipath-coded-apps/references/dashboards/aesthetic/charting.md +138 -0
  88. package/skills/uipath-coded-apps/references/dashboards/aesthetic/layout-patterns.md +152 -0
  89. package/skills/uipath-coded-apps/references/dashboards/plugins/build/impl.md +423 -0
  90. package/skills/uipath-coded-apps/references/dashboards/plugins/deploy/impl.md +322 -0
  91. package/skills/uipath-coded-apps/references/dashboards/primitives/customization.md +66 -0
  92. package/skills/uipath-coded-apps/references/dashboards/primitives/detail-views.md +64 -0
  93. package/skills/uipath-coded-apps/references/dashboards/primitives/incremental-editor.md +92 -0
  94. package/skills/uipath-coded-apps/references/dashboards/primitives/state-file.md +64 -0
  95. package/skills/uipath-coded-apps/references/dashboards/primitives/tier-resolution.md +474 -0
  96. package/skills/uipath-coded-apps/references/debug.md +15 -21
  97. package/skills/uipath-coded-apps/references/oauth-client-setup.md +5 -5
  98. package/skills/uipath-coded-apps/references/oauth-scopes.md +64 -2
  99. package/skills/uipath-coded-apps/references/pack-publish-deploy.md +12 -5
  100. package/skills/uipath-coded-apps/references/patterns.md +10 -5
  101. package/skills/uipath-coded-apps/references/sdk/action-center.md +32 -6
  102. package/skills/uipath-coded-apps/references/sdk/agents.md +241 -0
  103. package/skills/uipath-coded-apps/references/sdk/governance-traces.md +186 -0
  104. package/skills/uipath-coded-apps/references/sdk/governance.md +72 -0
  105. package/skills/uipath-coded-apps/references/sdk/imports.md +4 -0
  106. package/skills/uipath-coded-apps/references/sdk/maestro.md +114 -0
  107. package/skills/uipath-coded-apps/references/sdk/orchestrator.md +80 -4
  108. package/skills/uipath-coded-apps/references/sdk/pagination.md +2 -0
  109. package/skills/uipath-coded-apps/references/sdk/traces.md +89 -0
  110. package/skills/uipath-coded-apps/references/widgets/validation-station.md +308 -0
  111. package/skills/uipath-coded-apps/scripts/validate-action-schema.js +241 -0
  112. package/skills/uipath-connector-builder/SKILL.md +192 -0
  113. package/skills/uipath-connector-builder/references/auth.md +171 -0
  114. package/skills/uipath-connector-builder/references/configuration.md +130 -0
  115. package/skills/uipath-connector-builder/references/debugging.md +80 -0
  116. package/skills/uipath-connector-builder/references/element-json.md +148 -0
  117. package/skills/uipath-connector-builder/references/events.md +132 -0
  118. package/skills/uipath-connector-builder/references/hooks.md +198 -0
  119. package/skills/uipath-connector-builder/references/overview.md +78 -0
  120. package/skills/uipath-connector-builder/references/standard-resources.md +111 -0
  121. package/skills/uipath-connector-builder/references/system-resources.md +85 -0
  122. package/skills/uipath-feedback/SKILL.md +43 -29
  123. package/skills/{uipath-agents/references/coded/frameworks/coded-functions.md → uipath-functions/SKILL.md} +36 -23
  124. package/skills/uipath-governance/SKILL.md +49 -8
  125. package/skills/uipath-governance/references/aops-policy/aops-policy-commands.md +10 -10
  126. package/skills/uipath-governance/references/aops-policy/aops-policy-deploy-guide.md +7 -7
  127. package/skills/uipath-governance/references/auth-context.md +101 -0
  128. package/skills/uipath-governance/references/cli-cheatsheet.md +207 -0
  129. package/skills/uipath-governance/references/compliance-pack/catalog/impl.md +79 -0
  130. package/skills/uipath-governance/references/compliance-pack/coverage/impl.md +141 -0
  131. package/skills/uipath-governance/references/compliance-pack/disable/impl.md +39 -0
  132. package/skills/uipath-governance/references/compliance-pack/full-apply/impl.md +164 -0
  133. package/skills/uipath-governance/references/compliance-pack/partial-apply/impl.md +266 -0
  134. package/skills/uipath-governance/references/compliance-pack/partial-apply/merge-overrides-guide.md +28 -0
  135. package/skills/uipath-governance/references/compliance-pack/partial-apply/planning.md +82 -0
  136. package/skills/uipath-governance/references/compliance-pack/partial-apply/synthesize-formdata-guide.md +22 -0
  137. package/skills/uipath-governance/references/compliance-pack/preview-gate.md +43 -0
  138. package/skills/uipath-governance/references/compliance-pack/query/impl.md +75 -0
  139. package/skills/uipath-governance/references/diagnose/CAPABILITY.md +71 -0
  140. package/skills/uipath-governance/references/diagnose/references/failure-modes.md +201 -0
  141. package/skills/uipath-governance/references/diagnose/references/troubleshooting-guide.md +137 -0
  142. package/skills/uipath-governance/references/disambiguation-guide.md +15 -0
  143. package/skills/uipath-governance/scripts/merge-overrides.mjs +81 -0
  144. package/skills/uipath-governance/scripts/synthesize-formdata.mjs +86 -0
  145. package/skills/uipath-human-in-the-loop/SKILL.md +30 -25
  146. package/skills/uipath-human-in-the-loop/references/hitl-node-apptask.md +38 -4
  147. package/skills/uipath-human-in-the-loop/references/hitl-node-coded-action-app.md +2 -3
  148. package/skills/uipath-human-in-the-loop/references/hitl-node-quickform.md +92 -34
  149. package/skills/uipath-ixp/SKILL.md +120 -0
  150. package/skills/uipath-ixp/references/cli-reference.md +121 -0
  151. package/skills/uipath-ixp/references/improve-prompts-guide.md +283 -0
  152. package/skills/uipath-ixp/references/label-documents-guide.md +207 -0
  153. package/skills/uipath-ixp/references/project-setup-guide.md +90 -0
  154. package/skills/uipath-maestro-bpmn/SKILL.md +167 -68
  155. package/skills/uipath-maestro-bpmn/references/cli-conventions.md +47 -0
  156. package/skills/uipath-maestro-bpmn/references/diagnose/CAPABILITY.md +6 -6
  157. package/skills/uipath-maestro-bpmn/references/operate/CAPABILITY.md +3 -3
  158. package/skills/uipath-maestro-bpmn/references/registry-workflow.md +199 -0
  159. package/skills/uipath-maestro-bpmn/references/structural-bpmn.md +500 -0
  160. package/skills/uipath-maestro-bpmn/validator/README.md +214 -0
  161. package/skills/uipath-maestro-bpmn/validator/bpmn-spec.json +2477 -0
  162. package/skills/uipath-maestro-bpmn/validator/model.mjs +419 -0
  163. package/skills/uipath-maestro-bpmn/validator/package.json +17 -0
  164. package/skills/uipath-maestro-bpmn/validator/rules.mjs +1403 -0
  165. package/skills/uipath-maestro-bpmn/validator/samples/invalid-conditional-and-variable.bpmn +25 -0
  166. package/skills/uipath-maestro-bpmn/validator/samples/valid-baseline.bpmn +52 -0
  167. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/A.2.0.bpmn +157 -0
  168. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/A.2.1.bpmn +333 -0
  169. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/B.1.0.bpmn +598 -0
  170. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/B.2.0.bpmn +1709 -0
  171. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.2.0.bpmn +564 -0
  172. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.3.0.bpmn +671 -0
  173. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.4.0.bpmn +1045 -0
  174. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.5.0.bpmn +1176 -0
  175. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.6.0.bpmn +670 -0
  176. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/C.7.0.bpmn +466 -0
  177. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Can_Parse_Complex_Process_With_Task_Gateway_BoundaryEvent_etc.bpmn +74 -0
  178. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/ExclusiveGatewayDefaultFlow.bpmn +32 -0
  179. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/ExternalAgentWorkflow.bpmn +62 -0
  180. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Golden_Scenario.initial.bpmn +361 -0
  181. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/InclusiveJoinRouteAwayBranch.bpmn +62 -0
  182. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Parse_AsyncExecution_And_Create_CorrectModel.bpmn +74 -0
  183. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Parse_IXP_ExtractionValidation_And_Create_CorrectModel.bpmn +35 -0
  184. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Parse_IXP_Extraction_FileUpload_And_Create_CorrectModel.bpmn +33 -0
  185. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Parse_IXP_Extraction_JobAttachment_And_Create_CorrectModel.bpmn +35 -0
  186. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/Parse_SubProcess_With_Multiple_Element_Types.bpmn +76 -0
  187. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/StartEventWithOutputs.bpmn +36 -0
  188. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/StartGatewayEnd.bpmn +44 -0
  189. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/all elements.bpmn +516 -0
  190. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/all_sequence_flow_types.bpmn +173 -0
  191. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/demo.bpmn +181 -0
  192. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/subprocess-example-001-collapsed.bpmn +126 -0
  193. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/subprocess-example-001-expanded.bpmn +122 -0
  194. package/skills/uipath-maestro-bpmn/validator/test/fixtures/expected-findings/subprocess-example-003-collapsed_deeply-nested.bpmn +438 -0
  195. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/A.1.0.bpmn +87 -0
  196. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/A.3.0.bpmn +165 -0
  197. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ApiWorkflow.bpmn +39 -0
  198. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/BpmnNestedSubProcessTests.bpmn +102 -0
  199. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/BpmnTimerBoundaryEvents.bpmn +160 -0
  200. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/BpmnXmlWithCatchAllErrorEventSubProcess.bpmn +45 -0
  201. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/BpmnXmlWithSpecificErrorEventSubProcess.bpmn +46 -0
  202. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/CaseManagementWithConstantIdentifier.bpmn +218 -0
  203. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ErrorBoundary.bpmn +78 -0
  204. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ErrorPropagationInEventSubprocess.bpmn +340 -0
  205. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/EventBasedGatewayFirstCatcherWins.bpmn +56 -0
  206. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Example-EventBasedGateway.bpmn +117 -0
  207. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ExclusiveGatewayConditional.bpmn +45 -0
  208. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ExclusiveGatewaySharedEndEvent.bpmn +45 -0
  209. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ExclusiveWithParallelGateway.bpmn +68 -0
  210. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/FourScriptTasks.bpmn +84 -0
  211. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/HitlTaskOnly.bpmn +55 -0
  212. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/InclusiveGatewayForkJoin.bpmn +69 -0
  213. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Parse_BPMN_Elements_And_Create_CorrectModel.bpmn +20 -0
  214. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Parse_HttpRequest_ServiceTask_And_Create_Correct_Model.bpmn +34 -0
  215. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Parse_MessageBoundaryEvent_And_Create_CorrectModel.bpmn +87 -0
  216. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Parse_Script_Task_V2_And_Create_Correct_Model.bpmn +31 -0
  217. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/Parse_Sets_Containers_Properly.bpmn +129 -0
  218. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/ScriptWritesVariableThenGatewayBranches.bpmn +55 -0
  219. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/boundaryevent.bpmn +30 -0
  220. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/collapsed-subprocess.bpmn +83 -0
  221. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/connectable-types.bpmn +85 -0
  222. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/extensions-orchestrator-start-job.bpmn +80 -0
  223. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/multiparticipantpool.bpmn +77 -0
  224. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/nestedsubprocess.bpmn +36 -0
  225. package/skills/uipath-maestro-bpmn/validator/test/fixtures/known-good/simple.bpmn +59 -0
  226. package/skills/uipath-maestro-bpmn/validator/test/integration.test.mjs +146 -0
  227. package/skills/uipath-maestro-bpmn/validator/test/model-helpers.mjs +42 -0
  228. package/skills/uipath-maestro-bpmn/validator/test/ported-rule-tests.mjs +983 -0
  229. package/skills/uipath-maestro-bpmn/validator/test/run-tests.mjs +530 -0
  230. package/skills/uipath-maestro-bpmn/validator/uipath-moddle.v1.json +715 -0
  231. package/skills/uipath-maestro-bpmn/validator/validate-bpmn.mjs +164 -0
  232. package/skills/uipath-maestro-case/SKILL.md +5 -1
  233. package/skills/uipath-maestro-case/assets/templates/sdd-template-examples.md +10 -0
  234. package/skills/uipath-maestro-case/assets/templates/sdd-template.md +89 -17
  235. package/skills/uipath-maestro-case/references/bindings-and-expressions.md +26 -0
  236. package/skills/uipath-maestro-case/references/case-editing-operations.md +3 -0
  237. package/skills/uipath-maestro-case/references/implementation.md +11 -4
  238. package/skills/uipath-maestro-case/references/phase-0-interview.md +8 -7
  239. package/skills/uipath-maestro-case/references/phased-execution.md +2 -1
  240. package/skills/uipath-maestro-case/references/plugins/conditions/stage-exit-conditions/impl-json.md +21 -0
  241. package/skills/uipath-maestro-case/references/plugins/conditions/stage-exit-conditions/planning.md +2 -0
  242. package/skills/uipath-maestro-case/references/plugins/variables/global-vars/impl-json.md +15 -9
  243. package/skills/uipath-maestro-case/references/plugins/variables/io-binding/impl-json.md +131 -4
  244. package/skills/uipath-maestro-case/references/sdd-generation-rules.md +94 -17
  245. package/skills/uipath-maestro-flow/references/author/CAPABILITY.md +1 -1
  246. package/skills/uipath-maestro-flow/references/author/references/planning-arch.md +2 -2
  247. package/skills/uipath-maestro-flow/references/author/references/plugins/hitl/impl.md +11 -11
  248. package/skills/uipath-maestro-flow/references/author/references/plugins/hitl/planning.md +6 -6
  249. package/skills/uipath-maestro-flow/references/author/references/plugins/http/impl-connector.md +4 -1
  250. package/skills/uipath-maestro-flow/references/author/references/plugins/inline-agent/impl.md +157 -122
  251. package/skills/uipath-maestro-flow/references/author/references/plugins/inline-agent/planning.md +16 -4
  252. package/skills/uipath-maestro-flow/references/evaluate/references/commands-reference.md +8 -8
  253. package/skills/uipath-maestro-flow/references/evaluate/references/running-guide.md +3 -3
  254. package/skills/uipath-maestro-flow/references/shared/cli-commands.md +1 -1
  255. package/skills/uipath-planner/SKILL.md +19 -8
  256. package/skills/uipath-planner/assets/templates/agent-sdd-template.md +14 -0
  257. package/skills/uipath-planner/assets/templates/api-workflow-sdd-template.md +14 -0
  258. package/skills/uipath-planner/assets/templates/case-sdd-template.md +14 -0
  259. package/skills/uipath-planner/assets/templates/coded-app-sdd-template.md +14 -0
  260. package/skills/uipath-planner/assets/templates/flow-sdd-template.md +14 -0
  261. package/skills/uipath-planner/assets/templates/rpa-sdd-template.md +40 -5
  262. package/skills/uipath-planner/references/asdd-crosswalk-guide.md +55 -0
  263. package/skills/uipath-planner/references/attended-reauth-pattern-guide.md +43 -0
  264. package/skills/uipath-planner/references/multi-skill-patterns-guide.md +4 -0
  265. package/skills/uipath-planner/references/non-pdd-lane-guide.md +2 -0
  266. package/skills/uipath-planner/references/pdd-analysis-guide.md +24 -1
  267. package/skills/uipath-planner/references/pdd-driven-lane-guide.md +6 -2
  268. package/skills/uipath-planner/references/plan-and-tasks-format.md +2 -0
  269. package/skills/uipath-planner/references/platform-availability-guide.md +43 -0
  270. package/skills/uipath-planner/references/product-selection-guide.md +20 -0
  271. package/skills/uipath-planner/references/sdd-generation-guide.md +90 -21
  272. package/skills/uipath-planner/references/tenant-library-search-guide.md +5 -1
  273. package/skills/uipath-planner/scripts/docx-extract.sh +54 -0
  274. package/skills/uipath-planner/scripts/sdd-to-docx.sh +76 -0
  275. package/skills/uipath-platform/SKILL.md +54 -7
  276. package/skills/uipath-platform/references/context-grounding/index-management.md +123 -0
  277. package/skills/uipath-platform/references/data-fabric/bulk-import.md +86 -0
  278. package/skills/{uipath-data-fabric/references → uipath-platform/references/data-fabric}/choice-sets.md +33 -12
  279. package/skills/uipath-platform/references/data-fabric/data-fabric.md +352 -0
  280. package/skills/uipath-platform/references/data-fabric/entity-schema.md +444 -0
  281. package/skills/uipath-platform/references/data-fabric/file-attachments.md +122 -0
  282. package/skills/{uipath-data-fabric/references → uipath-platform/references/data-fabric}/filter-platform-contract.md +3 -3
  283. package/skills/{uipath-data-fabric/references → uipath-platform/references/data-fabric}/records-query.md +46 -10
  284. package/skills/uipath-platform/references/integration-service/http-request.md +15 -1
  285. package/skills/uipath-platform/references/integration-service/vendor-docs-registry.json +173 -0
  286. package/skills/uipath-platform/references/uip-commands.md +12 -4
  287. package/skills/uipath-review/SKILL.md +53 -12
  288. package/skills/uipath-review/references/agents/agent-common-issues.md +1 -1
  289. package/skills/uipath-review/references/agents/agent-grading-rubric.md +133 -0
  290. package/skills/uipath-review/references/agents/agent-review-checklist.md +23 -3
  291. package/skills/uipath-review/references/agents/agents-coded-rules.md +7 -0
  292. package/skills/uipath-review/references/agents/agents-lowcode-rules.md +13 -3
  293. package/skills/uipath-review/references/agents/guardrails/guardrails-review.md +198 -0
  294. package/skills/uipath-review/references/architecture-assessment-guide.md +2 -0
  295. package/skills/uipath-review/references/review-workflow-guide.md +9 -5
  296. package/skills/uipath-review/references/rule-catalog-workflow.md +3 -3
  297. package/skills/uipath-rpa/SKILL.md +18 -6
  298. package/skills/uipath-rpa/references/cli-reference.md +57 -3
  299. package/skills/uipath-rpa/references/common-activity-card.md +1 -1
  300. package/skills/uipath-rpa/references/connector-capabilities.md +2 -0
  301. package/skills/uipath-rpa/references/data-manipulation-guide.md +311 -0
  302. package/skills/uipath-rpa/references/environment-setup.md +0 -2
  303. package/skills/uipath-rpa/references/error-handling-guide.md +381 -0
  304. package/skills/uipath-rpa/references/is-connector-xaml-guide.md +127 -11
  305. package/skills/uipath-rpa/references/reframework-guide.md +2 -0
  306. package/skills/uipath-rpa/references/testing-guide.md +19 -0
  307. package/skills/uipath-rpa/references/ui-automation-guide.md +129 -18
  308. package/skills/uipath-rpa/references/uia-configure-target-workflows.md +22 -1
  309. package/skills/uipath-rpa/references/uia-elements-interaction-guide.md +93 -0
  310. package/skills/uipath-rpa/references/xaml/canvas-layout-guide.md +41 -4
  311. package/skills/uipath-rpa/references/xaml/common-pitfalls.md +12 -3
  312. package/skills/uipath-rpa/references/xaml/flowchart-guide.md +113 -0
  313. package/skills/uipath-rpa/references/xaml/xaml-basics-and-rules.md +5 -9
  314. package/skills/uipath-solution/SKILL.md +11 -8
  315. package/skills/uipath-solution/references/pack-and-deploy.md +18 -1
  316. package/skills/uipath-solution/references/solution-overview.md +3 -0
  317. package/skills/uipath-test/SKILL.md +2 -1
  318. package/skills/uipath-troubleshoot/SKILL.md +24 -26
  319. package/skills/uipath-troubleshoot/agents/depth-verifier.md +24 -25
  320. package/skills/uipath-troubleshoot/agents/hypothesis-generator.md +8 -4
  321. package/skills/uipath-troubleshoot/agents/hypothesis-tester.md +85 -38
  322. package/skills/uipath-troubleshoot/agents/presenter.md +7 -7
  323. package/skills/uipath-troubleshoot/agents/scope-checker.md +3 -6
  324. package/skills/uipath-troubleshoot/agents/shared.md +26 -21
  325. package/skills/uipath-troubleshoot/agents/triage.md +117 -49
  326. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/investigation_guide.md +43 -0
  327. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/overview.md +57 -0
  328. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-action-failed-after-find.md +100 -0
  329. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-cell-targeting-failures.md +111 -0
  330. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-element-not-found.md +125 -0
  331. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-get-text-empty-or-wrong-result.md +117 -0
  332. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-invalid-descriptor.md +102 -0
  333. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-scope-setup-failures.md +136 -0
  334. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-scroll-search-failures.md +114 -0
  335. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-server-auth-throttling-network.md +95 -0
  336. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/playbooks/cv-silent-failures-and-false-results.md +124 -0
  337. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/presentation.md +8 -0
  338. package/skills/uipath-troubleshoot/references/activity-packages/cv-activities/summary.md +15 -0
  339. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/investigation_guide.md +42 -0
  340. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/overview.md +41 -0
  341. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/playbooks/connect-to-database-failures.md +104 -0
  342. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/playbooks/execute-non-query-failures.md +97 -0
  343. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/playbooks/execute-query-failures.md +134 -0
  344. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/playbooks/start-transaction-failures.md +94 -0
  345. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/presentation.md +10 -0
  346. package/skills/uipath-troubleshoot/references/activity-packages/database-activities/summary.md +10 -0
  347. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/investigation_guide.md +27 -9
  348. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/overview.md +51 -10
  349. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/append-range-failures.md +146 -0
  350. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/delete-range-failures.md +126 -0
  351. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/excel-application-card-failures.md +139 -0
  352. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/excel-application-scope-failures.md +118 -0
  353. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/execute-macro-failures.md +149 -0
  354. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/playbooks/write-range-failures.md +145 -0
  355. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/presentation.md +12 -7
  356. package/skills/uipath-troubleshoot/references/activity-packages/excel-activities/summary.md +6 -0
  357. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/investigation_guide.md +1 -0
  358. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/overview.md +12 -4
  359. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/connection-and-auth-failures.md +55 -0
  360. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/drive-file-not-found.md +18 -10
  361. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/get-newest-email-not-found.md +9 -8
  362. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/invalid-or-null-input.md +68 -0
  363. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/transient-and-timeout-errors.md +52 -0
  364. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/playbooks/upload-storage-quota-exceeded.md +1 -1
  365. package/skills/uipath-troubleshoot/references/activity-packages/gsuite-activities/summary.md +5 -2
  366. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/overview.md +28 -0
  367. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/playbooks/delete-outlook-mail-failures.md +105 -0
  368. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/playbooks/get-outlook-mail-failures.md +109 -0
  369. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/playbooks/move-outlook-mail-failures.md +97 -0
  370. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/playbooks/send-outlook-mail-failures.md +95 -0
  371. package/skills/uipath-troubleshoot/references/activity-packages/mail-activities/summary.md +8 -0
  372. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/investigation_guide.md +23 -0
  373. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/overview.md +9 -0
  374. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/application-scope-misconfigured.md +49 -0
  375. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/authentication-token-invalid.md +53 -0
  376. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/copy-item-argument-null.md +34 -0
  377. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/create-folder-invalid-path.md +36 -0
  378. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/download-file-conversion-or-destination.md +40 -0
  379. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/drive-item-not-found.md +1 -1
  380. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/email-trigger-connection-event-failure.md +45 -0
  381. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/insufficient-graph-scope.md +44 -0
  382. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/legacy-mail-null-reference.md +43 -0
  383. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/mail-folder-not-found.md +4 -3
  384. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/mail-invalid-odata-query.md +43 -0
  385. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/mail-message-not-found.md +45 -0
  386. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/request-throttled.md +45 -0
  387. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/send-mail-rejected.md +52 -0
  388. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/transient-service-error.md +48 -0
  389. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/playbooks/upload-file-quota-or-size.md +47 -0
  390. package/skills/uipath-troubleshoot/references/activity-packages/o365-activities/summary.md +15 -1
  391. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/investigation_guide.md +32 -0
  392. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/overview.md +38 -0
  393. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/invoke-method-failures.md +57 -0
  394. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/invoke-python-method-pipe-is-broken.md +44 -0
  395. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/load-script-failures.md +62 -0
  396. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/python-path-not-valid.md +39 -0
  397. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/python-scope-architecture-version-mismatch.md +41 -0
  398. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/playbooks/working-folder-relative-path.md +34 -0
  399. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/presentation.md +9 -0
  400. package/skills/uipath-troubleshoot/references/activity-packages/python-activities/summary.md +12 -0
  401. package/skills/uipath-troubleshoot/references/activity-packages/system-activities/playbooks/get-asset-activity-bug-silent-failure.md +1 -1
  402. package/skills/uipath-troubleshoot/references/activity-packages/system-activities/playbooks/get-asset-robot-not-authenticated.md +29 -22
  403. package/skills/uipath-troubleshoot/references/activity-packages/system-activities/summary.md +1 -1
  404. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/investigation_guide.md +30 -0
  405. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/overview.md +36 -0
  406. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/deserialize-malformed-input.md +36 -0
  407. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/deserialize-null-input.md +35 -0
  408. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/deserialize-type-mismatch.md +40 -0
  409. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/http-client-null-reference.md +34 -0
  410. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/http-request-connection-failure.md +48 -0
  411. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/http-request-timeout.md +40 -0
  412. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/playbooks/net-http-request-aggregate-failure.md +38 -0
  413. package/skills/uipath-troubleshoot/references/activity-packages/web-activities/summary.md +13 -0
  414. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/investigation_guide.md +55 -0
  415. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/overview.md +82 -0
  416. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/add-picture-failures.md +51 -0
  417. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/append-text-missing-container.md +31 -0
  418. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/append-text-zero-byte-file.md +32 -0
  419. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/export-pdf-com-hang.md +46 -0
  420. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/export-pdf-missing-output-dir.md +32 -0
  421. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/export-pdf-output-path-format.md +35 -0
  422. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/read-text-doc-format.md +30 -0
  423. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/read-text-missing-container.md +29 -0
  424. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/read-text-protected-view.md +32 -0
  425. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-com-busy.md +35 -0
  426. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-file-locked.md +33 -0
  427. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-headers-textboxes-skipped.md +30 -0
  428. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-length-limit.md +30 -0
  429. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-loop-template-overwrite.md +31 -0
  430. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-multiline-formatting.md +31 -0
  431. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-silent-no-substitution.md +32 -0
  432. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/replace-text-version-mismatch.md +30 -0
  433. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-com-interop-failures.md +52 -0
  434. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-com-start-background-session0.md +50 -0
  435. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-export-pdf-com-wrong-thread.md +46 -0
  436. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-open-sharepoint-url-com-command-failed.md +45 -0
  437. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-scope-cannot-create-unknown-type.md +30 -0
  438. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-scope-com-not-installed.md +35 -0
  439. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-scope-file-corrupted.md +34 -0
  440. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-scope-file-path-not-found.md +36 -0
  441. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/playbooks/word-scope-hangs-background-prompt.md +34 -0
  442. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/presentation.md +11 -0
  443. package/skills/uipath-troubleshoot/references/activity-packages/word-activities/summary.md +38 -0
  444. package/skills/uipath-troubleshoot/references/products/integration-service/investigation_guide.md +9 -0
  445. package/skills/uipath-troubleshoot/references/products/integration-service/overview.md +7 -0
  446. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connection-invalid.md +9 -0
  447. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connector-aggregate-exception.md +30 -0
  448. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connector-general-exception.md +43 -0
  449. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connector-null-reference.md +36 -0
  450. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connector-remote-exception.md +31 -0
  451. package/skills/uipath-troubleshoot/references/products/integration-service/playbooks/connector-runtime-exception.md +40 -0
  452. package/skills/uipath-troubleshoot/references/products/integration-service/summary.md +5 -0
  453. package/skills/uipath-troubleshoot/references/products/maestro/investigation_guide.md +2 -1
  454. package/skills/uipath-troubleshoot/references/products/orchestrator/investigation_guide.md +105 -10
  455. package/skills/uipath-troubleshoot/references/products/orchestrator/playbooks/job-faulted-logon-failure.md +1 -1
  456. package/skills/uipath-troubleshoot/references/summary.md +59 -3
  457. package/skills/uipath-troubleshoot/schemas/evidence.schema.md +48 -0
  458. package/skills/uipath-troubleshoot/schemas/hypotheses.schema.md +22 -7
  459. package/skills/uipath-troubleshoot/schemas/scope-check.schema.md +1 -1
  460. package/skills/uipath-troubleshoot/schemas/state.schema.md +81 -6
  461. package/version-manifest.json +2 -2
  462. package/skills/uipath-data-fabric/SKILL.md +0 -239
  463. package/skills/uipath-data-fabric/references/bulk-import.md +0 -73
  464. package/skills/uipath-data-fabric/references/entity-schema.md +0 -391
  465. package/skills/uipath-data-fabric/references/file-attachments.md +0 -65
  466. package/skills/uipath-maestro-bpmn/.maintenance/README.md +0 -241
  467. package/skills/uipath-maestro-bpmn/.maintenance/check-all.sh +0 -41
  468. package/skills/uipath-maestro-bpmn/.maintenance/check-anchors.sh +0 -83
  469. package/skills/uipath-maestro-bpmn/.maintenance/check-depth.sh +0 -132
  470. package/skills/uipath-maestro-bpmn/.maintenance/check-link-text.sh +0 -123
  471. package/skills/uipath-maestro-bpmn/.maintenance/check-links.sh +0 -70
  472. package/skills/uipath-maestro-bpmn/.maintenance/check-orphans.sh +0 -93
  473. package/skills/uipath-maestro-bpmn/.maintenance/check-plugin-pairs.sh +0 -39
  474. package/skills/uipath-maestro-bpmn/.maintenance/check-real-pack.sh +0 -79
  475. package/skills/uipath-maestro-bpmn/.maintenance/check-template.sh +0 -42
  476. package/skills/uipath-maestro-bpmn/.maintenance/check-uip-commands.sh +0 -266
  477. package/skills/uipath-maestro-bpmn/.maintenance/check-validation-fixtures.py +0 -1255
  478. package/skills/uipath-maestro-bpmn/.maintenance/check-validation-fixtures.sh +0 -8
  479. package/skills/uipath-maestro-bpmn/fixtures/validation/README.md +0 -94
  480. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/agent-invocation.bpmn +0 -62
  481. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/bindings_v2.json +0 -37
  482. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/entry-points.json +0 -21
  483. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/operate.json +0 -9
  484. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/package-descriptor.json +0 -10
  485. package/skills/uipath-maestro-bpmn/fixtures/validation/agent-invocation/project.uiproj +0 -7
  486. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/bindings_v2.json +0 -68
  487. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/contract-variants.bpmn +0 -270
  488. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/entry-points.json +0 -25
  489. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/operate.json +0 -9
  490. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/package-descriptor.json +0 -10
  491. package/skills/uipath-maestro-bpmn/fixtures/validation/contract-variants/project.uiproj +0 -7
  492. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/bindings_v2.json +0 -19
  493. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/entry-points.json +0 -25
  494. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/gateway-boundary-error.bpmn +0 -91
  495. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/operate.json +0 -9
  496. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/package-descriptor.json +0 -10
  497. package/skills/uipath-maestro-bpmn/fixtures/validation/gateway-boundary-error/project.uiproj +0 -7
  498. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/bindings_v2.json +0 -4
  499. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/entry-points.json +0 -25
  500. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/imported-brownfield-preservation.bpmn +0 -63
  501. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/operate.json +0 -9
  502. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/package-descriptor.json +0 -10
  503. package/skills/uipath-maestro-bpmn/fixtures/validation/imported-brownfield-preservation/project.uiproj +0 -7
  504. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/bindings_v2.json +0 -52
  505. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/entry-points.json +0 -21
  506. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/integration-service-enriched.bpmn +0 -65
  507. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/operate.json +0 -9
  508. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/package-descriptor.json +0 -10
  509. package/skills/uipath-maestro-bpmn/fixtures/validation/integration-service-enriched/project.uiproj +0 -7
  510. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/bindings_v2.json +0 -4
  511. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/entry-points.json +0 -25
  512. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/linear-process.bpmn +0 -55
  513. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/operate.json +0 -9
  514. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/package-descriptor.json +0 -10
  515. package/skills/uipath-maestro-bpmn/fixtures/validation/linear-process/project.uiproj +0 -7
  516. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/bindings_v2.json +0 -20
  517. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/entry-points.json +0 -17
  518. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/operate.json +0 -9
  519. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/package-descriptor.json +0 -10
  520. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/project.uiproj +0 -7
  521. package/skills/uipath-maestro-bpmn/fixtures/validation/registry-coverage-matrix/registry-coverage-matrix.bpmn +0 -207
  522. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/bindings_v2.json +0 -4
  523. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/entry-points.json +0 -33
  524. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/operate.json +0 -9
  525. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/package-descriptor.json +0 -10
  526. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/project.uiproj +0 -7
  527. package/skills/uipath-maestro-bpmn/fixtures/validation/subprocess-multi-instance/subprocess-multi-instance.bpmn +0 -94
  528. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/bindings_v2.json +0 -124
  529. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/entry-points.json +0 -25
  530. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/operate.json +0 -9
  531. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/package-descriptor.json +0 -10
  532. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/project.uiproj +0 -7
  533. package/skills/uipath-maestro-bpmn/fixtures/validation/wrapper-family-contract/wrapper-family-contract.bpmn +0 -151
  534. package/skills/uipath-maestro-bpmn/references/author/CAPABILITY.md +0 -141
  535. package/skills/uipath-maestro-bpmn/references/author/references/brownfield.md +0 -48
  536. package/skills/uipath-maestro-bpmn/references/author/references/editing-operations.md +0 -75
  537. package/skills/uipath-maestro-bpmn/references/author/references/greenfield.md +0 -41
  538. package/skills/uipath-maestro-bpmn/references/author/references/planning-arch.md +0 -82
  539. package/skills/uipath-maestro-bpmn/references/author/references/planning-impl.md +0 -104
  540. package/skills/uipath-maestro-bpmn/references/author/references/plugins/agents/impl.md +0 -34
  541. package/skills/uipath-maestro-bpmn/references/author/references/plugins/agents/planning.md +0 -38
  542. package/skills/uipath-maestro-bpmn/references/author/references/plugins/api-workflows/impl.md +0 -37
  543. package/skills/uipath-maestro-bpmn/references/author/references/plugins/api-workflows/planning.md +0 -28
  544. package/skills/uipath-maestro-bpmn/references/author/references/plugins/business-rules/impl.md +0 -36
  545. package/skills/uipath-maestro-bpmn/references/author/references/plugins/business-rules/planning.md +0 -29
  546. package/skills/uipath-maestro-bpmn/references/author/references/plugins/call-activity-subprocess/impl.md +0 -67
  547. package/skills/uipath-maestro-bpmn/references/author/references/plugins/call-activity-subprocess/planning.md +0 -29
  548. package/skills/uipath-maestro-bpmn/references/author/references/plugins/connectors/impl.md +0 -29
  549. package/skills/uipath-maestro-bpmn/references/author/references/plugins/connectors/planning.md +0 -33
  550. package/skills/uipath-maestro-bpmn/references/author/references/plugins/gateways/impl.md +0 -32
  551. package/skills/uipath-maestro-bpmn/references/author/references/plugins/gateways/planning.md +0 -34
  552. package/skills/uipath-maestro-bpmn/references/author/references/plugins/hitl/impl.md +0 -42
  553. package/skills/uipath-maestro-bpmn/references/author/references/plugins/hitl/planning.md +0 -30
  554. package/skills/uipath-maestro-bpmn/references/author/references/plugins/integration-service/impl.md +0 -134
  555. package/skills/uipath-maestro-bpmn/references/author/references/plugins/integration-service/planning.md +0 -67
  556. package/skills/uipath-maestro-bpmn/references/author/references/plugins/multi-instance/impl.md +0 -50
  557. package/skills/uipath-maestro-bpmn/references/author/references/plugins/multi-instance/planning.md +0 -29
  558. package/skills/uipath-maestro-bpmn/references/author/references/plugins/queues/impl.md +0 -29
  559. package/skills/uipath-maestro-bpmn/references/author/references/plugins/queues/planning.md +0 -29
  560. package/skills/uipath-maestro-bpmn/references/author/references/plugins/rpa-jobs/impl.md +0 -35
  561. package/skills/uipath-maestro-bpmn/references/author/references/plugins/rpa-jobs/planning.md +0 -29
  562. package/skills/uipath-maestro-bpmn/references/author/references/plugins/script/impl.md +0 -118
  563. package/skills/uipath-maestro-bpmn/references/author/references/plugins/script/planning.md +0 -30
  564. package/skills/uipath-maestro-bpmn/references/author/references/plugins/sequence-flows/impl.md +0 -30
  565. package/skills/uipath-maestro-bpmn/references/author/references/plugins/sequence-flows/planning.md +0 -30
  566. package/skills/uipath-maestro-bpmn/references/author/references/plugins/service-tasks/impl.md +0 -33
  567. package/skills/uipath-maestro-bpmn/references/author/references/plugins/service-tasks/planning.md +0 -31
  568. package/skills/uipath-maestro-bpmn/references/author/references/plugins/signals/impl.md +0 -33
  569. package/skills/uipath-maestro-bpmn/references/author/references/plugins/signals/planning.md +0 -46
  570. package/skills/uipath-maestro-bpmn/references/author/references/plugins/start-end-events/impl.md +0 -59
  571. package/skills/uipath-maestro-bpmn/references/author/references/plugins/start-end-events/planning.md +0 -37
  572. package/skills/uipath-maestro-bpmn/references/author/references/plugins/waits-triggers/impl.md +0 -40
  573. package/skills/uipath-maestro-bpmn/references/author/references/plugins/waits-triggers/planning.md +0 -34
  574. package/skills/uipath-maestro-bpmn/references/author/references/supported-elements.md +0 -123
  575. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/README.md +0 -29
  576. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/agent-job.md +0 -36
  577. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/api-workflow.md +0 -29
  578. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/business-rule.md +0 -18
  579. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/call-activity.md +0 -56
  580. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/hitl.md +0 -17
  581. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/http-request.md +0 -119
  582. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/queue.md +0 -21
  583. package/skills/uipath-maestro-bpmn/references/author/references/task-recipes/rpa-job.md +0 -23
  584. package/skills/uipath-maestro-bpmn/references/author/references/validation.md +0 -118
  585. package/skills/uipath-maestro-bpmn/references/shared/bpmn-xml-contract.md +0 -197
  586. package/skills/uipath-maestro-bpmn/references/shared/cli-conventions.md +0 -46
  587. package/skills/uipath-maestro-bpmn/references/shared/error-handling.md +0 -82
  588. package/skills/uipath-maestro-bpmn/references/shared/variables-bindings-expressions.md +0 -150
  589. package/skills/uipath-maestro-bpmn/references/shared/wrapper-shells.md +0 -554
  590. /package/skills/uipath-maestro-bpmn/references/{shared/expression-authoring.md → expression-authoring.md} +0 -0
  591. /package/skills/uipath-maestro-bpmn/references/{shared/public-safety.md → public-safety.md} +0 -0
  592. /package/{agents → skills/uipath-rpa/agents}/uipath-project-discovery-agent.md +0 -0
@@ -0,0 +1,1403 @@
1
+ // Self-contained Maestro BPMN validation rule engine.
2
+ //
3
+ // This module is a faithful, offline port of the PO.Frontend canvas validation
4
+ // rule engine (PO.Frontend/src/services/validation/bpmn/). It operates on the
5
+ // reconstructed Node[]/Edge[]/CanvasState model (see model.mjs), which mirrors
6
+ // the frontend's `Node[]`/`Edge[]` derived from the same BPMN XML.
7
+ //
8
+ // PHASE 2 NOTE: this file is intentionally the *only* place rule logic lives.
9
+ // When the rules ship as a published npm package, this module is replaced by an
10
+ // import of that package with NO behavior change — model.mjs and
11
+ // validate-bpmn.mjs stay as the integration layer.
12
+ //
13
+ // Each rule cites the PO.Frontend source it is ported from.
14
+
15
+ import { Duration } from "luxon";
16
+
17
+ export const SEVERITY = { ERROR: "ERROR", WARNING: "WARNING" };
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // Lookup maps — port of ValidateBpmnFlowUtils.buildValidationLookupMaps.
21
+ // ---------------------------------------------------------------------------
22
+ export function buildValidationLookupMaps(nodes, edges) {
23
+ const nodeById = new Map();
24
+ const nodesByParentId = new Map();
25
+ const edgesBySource = new Map();
26
+ const edgesByTarget = new Map();
27
+
28
+ for (const node of nodes) {
29
+ nodeById.set(node.id, node);
30
+ const parentId = node.parentId;
31
+ const siblings = nodesByParentId.get(parentId);
32
+ if (siblings) siblings.push(node);
33
+ else nodesByParentId.set(parentId, [node]);
34
+ }
35
+ for (const edge of edges) {
36
+ const s = edgesBySource.get(edge.source);
37
+ if (s) s.push(edge);
38
+ else edgesBySource.set(edge.source, [edge]);
39
+ const t = edgesByTarget.get(edge.target);
40
+ if (t) t.push(edge);
41
+ else edgesByTarget.set(edge.target, [edge]);
42
+ }
43
+ return { nodeById, nodesByParentId, edgesBySource, edgesByTarget };
44
+ }
45
+
46
+ // ---------------------------------------------------------------------------
47
+ // Shared helpers
48
+ // ---------------------------------------------------------------------------
49
+ function dotGet(obj, prop, defaultValue) {
50
+ const parts = String(prop).match(/[^.[\]]+|\[\d+\]/g) ?? [];
51
+ let cur = obj;
52
+ for (const raw of parts) {
53
+ if (cur === null || typeof cur !== "object") return defaultValue;
54
+ const key = /^\[\d+\]$/.test(raw) ? Number(raw.slice(1, -1)) : raw;
55
+ cur = cur[key];
56
+ }
57
+ return cur === undefined ? defaultValue : cur;
58
+ }
59
+
60
+ // Port of EventObjectUtil.getEventObjectDetailsMapping (Errors branch only;
61
+ // the boundary-event rule only consults bpmn:ErrorEventDefinition).
62
+ function getEventObjectDetailsMapping(bpmnType) {
63
+ if (bpmnType === "bpmn:ErrorEventDefinition") {
64
+ return { type: "errors", accessor: "data.eventDefinition.errorRef", code: "errorCode" };
65
+ }
66
+ return undefined;
67
+ }
68
+
69
+ function isNilOrEmpty(value) {
70
+ return value === undefined || value === null || (typeof value === "string" && value.trim() === "");
71
+ }
72
+
73
+ // ---------------------------------------------------------------------------
74
+ // Variable / expression helpers — port of VariableUtil.ts
75
+ // ---------------------------------------------------------------------------
76
+
77
+ // Captures the first segment after the prefix: e.g. "vars.response" / vars["response"].
78
+ const VAR_REFS_REGEX = /(^|\b)(vars|result)(?:\.([\w]+)|\["([^"]+)"\])/g;
79
+
80
+ // Special namespaces that are NOT user-declared variables. `iterator.` and
81
+ // `metadata.` never start with `vars.`, so they are excluded by the regex
82
+ // itself; `error` is the boundary-error context exposed as `vars.error`, which
83
+ // IS matched by the regex and therefore must be skipped explicitly here.
84
+ const BUILTIN_NON_VARIABLE_VARS_SEGMENTS = new Set(["error"]);
85
+
86
+ /**
87
+ * Port of VariableUtil.validateNoAssignments. Returns true if the expression
88
+ * contains an assignment operator (excluding comparison/arrow operators).
89
+ */
90
+ export function expressionHasAssignment(expression) {
91
+ if (!expression) return false;
92
+ const offset = expression.startsWith("=") ? 1 : 0;
93
+ const body = expression.slice(offset);
94
+ if (!body.trim()) return false;
95
+ const sanitized = body
96
+ .replaceAll(/"(?:[^"\\]|\\.)*"/g, (m) => " ".repeat(m.length))
97
+ .replaceAll(/'(?:[^'\\]|\\.)*'/g, (m) => " ".repeat(m.length))
98
+ .replaceAll(/`(?:[^`\\]|\\.)*`/g, (m) => " ".repeat(m.length))
99
+ .replaceAll(/\/(?:[^/\\]|\\.)*\/[gimsuy]*/g, (m) => " ".repeat(m.length));
100
+ const assignmentRegex =
101
+ /(\?\?=|&&=|\|\|=|>>>=|<<=|>>=|\*\*=|\+=|-=|\*=|\/=|%=|&=|\|=|\^=|(?<![!=<>+\-*/%.&|^?])=(?![=>]))/;
102
+ return assignmentRegex.test(sanitized);
103
+ }
104
+
105
+ /**
106
+ * Collect every `vars.X` / `result.X` reference in an expression that does NOT
107
+ * resolve. Mirrors VariableUtil.getVariablesInExpression (the `nonExisting`
108
+ * half) + the result-validity split in validateVariablesInExpression:758-782.
109
+ *
110
+ * - `vars.X` resolves against `knownIds` (variable ids/names/canonicalIds,
111
+ * declared anywhere) — matches `existingIdsSet` semantics in the frontend.
112
+ * - `result.X` resolves ONLY against the referencing element's OWN output
113
+ * identifiers (`resultIds`); a `result.X` that names no output of this
114
+ * element is flagged, exactly like `isResultVariableValidForElement`
115
+ * (VariableUtil.ts:166-178) pushing it onto the non-existing set
116
+ * (VariableUtil.ts:263 treats the unresolved result ref as non-existing).
117
+ *
118
+ * `resultIds` defaults to an empty set: in contexts where result refs are not
119
+ * element-local (e.g. edge conditions, which have no own outputs) every
120
+ * `result.X` is unresolved, matching the frontend.
121
+ */
122
+ export function findUnknownVariableRefs(expression, knownIds, resultIds = new Set()) {
123
+ if (!expression) return [];
124
+ const out = [];
125
+ const resolvesAgainst = (seg, ids) => {
126
+ if (ids.has(seg)) return true;
127
+ // Nested-path tolerance: foo.bar resolves if `foo` is known.
128
+ for (const id of ids) {
129
+ if (seg === id || seg.startsWith(`${id}.`)) return true;
130
+ }
131
+ return false;
132
+ };
133
+ for (const match of expression.matchAll(VAR_REFS_REGEX)) {
134
+ const prefix = match[2];
135
+ const seg = match[3] ?? match[4];
136
+ if (!seg) continue;
137
+ if (prefix === "result") {
138
+ // `result.X` is a node-local output alias; valid only if X names one of
139
+ // this element's own outputs (frontend isResultVariableValidForElement).
140
+ if (!resolvesAgainst(seg, resultIds)) out.push(match[0]);
141
+ continue;
142
+ }
143
+ if (BUILTIN_NON_VARIABLE_VARS_SEGMENTS.has(seg)) continue;
144
+ if (!resolvesAgainst(seg, knownIds)) out.push(match[0]);
145
+ }
146
+ return [...new Set(out)];
147
+ }
148
+
149
+ // ---------------------------------------------------------------------------
150
+ // Port of Tools.getAccessorFromType — selects which field of a custom output
151
+ // carries the user expression to validate.
152
+ function getAccessorFromType(type) {
153
+ if (type === "json" || type === "jsonSchema" || type === "array") return "body";
154
+ if (type === "file" || type === "octet-stream") return "target";
155
+ return "source";
156
+ }
157
+
158
+ // ---------------------------------------------------------------------------
159
+ // ISO-8601 duration helpers — port of DateUtil.ts
160
+ // ---------------------------------------------------------------------------
161
+ function isValidIso8601(value) {
162
+ return Duration.fromISO(value).isValid;
163
+ }
164
+ function hasIso8601WeekDesignator(value) {
165
+ return /W/i.test(value);
166
+ }
167
+
168
+ // ===========================================================================
169
+ // RULE 1: ConditionalFlowRule
170
+ // ===========================================================================
171
+ export function validateConditionalSequenceFlow(nodes, _edges, lookupMaps) {
172
+ const errors = [];
173
+ const { edgesBySource, nodeById } = lookupMaps;
174
+ for (const node of nodes) {
175
+ if (node.type !== "bpmn:ExclusiveGateway") continue;
176
+ const outgoing = edgesBySource.get(node.id) ?? [];
177
+ const nonAnnotation = outgoing.filter((f) => nodeById.get(f.target)?.type !== "bpmn:TextAnnotation");
178
+ if (nonAnnotation.length <= 1) continue;
179
+ const hasDefault = nonAnnotation.some((f) => Boolean(f.data?.defaultFlow));
180
+ const missing = nonAnnotation.filter((f) => !f.data?.conditionExpression && !f.data?.defaultFlow);
181
+ if (missing.length === 0) continue;
182
+ for (const flow of missing) {
183
+ errors.push({
184
+ code: "MISSING_CONDITION_EXPRESSION",
185
+ message: "Sequence flow is missing condition expression",
186
+ severity: SEVERITY.ERROR,
187
+ sourceId: flow.source,
188
+ targetId: flow.target,
189
+ elementId: flow.id,
190
+ });
191
+ }
192
+ }
193
+ return errors;
194
+ }
195
+
196
+ // ===========================================================================
197
+ // RULE 2: ConnectionRule
198
+ // ===========================================================================
199
+ const baseAllowedTargets = new Set(["bpmn:TextAnnotation"]);
200
+ const commonAllowedTargets = new Set([
201
+ ...baseAllowedTargets,
202
+ "bpmn:IntermediateThrowEvent",
203
+ "bpmn:IntermediateCatchEvent",
204
+ "bpmn:EndEvent",
205
+ "bpmn:ExclusiveGateway",
206
+ "bpmn:ParallelGateway",
207
+ "bpmn:InclusiveGateway",
208
+ "bpmn:ComplexGateway",
209
+ "bpmn:Task",
210
+ "bpmn:UserTask",
211
+ "bpmn:ServiceTask",
212
+ "bpmn:SendTask",
213
+ "bpmn:ReceiveTask",
214
+ "bpmn:ManualTask",
215
+ "bpmn:BusinessRuleTask",
216
+ "bpmn:ScriptTask",
217
+ "bpmn:CallActivity",
218
+ "bpmn:SubProcess",
219
+ "bpmn:AdHocSubProcess",
220
+ "bpmn:Transaction",
221
+ ]);
222
+ const activityAllowedTargets = new Set([
223
+ ...commonAllowedTargets,
224
+ "bpmn:EventBasedGateway",
225
+ "bpmn:DataOutput",
226
+ "bpmn:DataStoreReference",
227
+ "bpmn:DataObjectReference",
228
+ ]);
229
+ // Port of BPMNTypes.allowedTargetNodeTypesForSourceNodeType (concrete entries).
230
+ const allowedTargetNodeTypesForSourceNodeType = {
231
+ "bpmn:StartEvent": commonAllowedTargets,
232
+ "bpmn:IntermediateThrowEvent": commonAllowedTargets,
233
+ "bpmn:IntermediateCatchEvent": commonAllowedTargets,
234
+ "bpmn:BoundaryEvent": commonAllowedTargets,
235
+ "bpmn:EndEvent": new Set(["bpmn:TextAnnotation"]),
236
+ "bpmn:ExclusiveGateway": commonAllowedTargets,
237
+ "bpmn:ParallelGateway": commonAllowedTargets,
238
+ "bpmn:InclusiveGateway": commonAllowedTargets,
239
+ "bpmn:ComplexGateway": commonAllowedTargets,
240
+ "bpmn:EventBasedGateway": new Set(["bpmn:IntermediateCatchEvent", "bpmn:TextAnnotation"]),
241
+ "bpmn:Task": activityAllowedTargets,
242
+ "bpmn:UserTask": activityAllowedTargets,
243
+ "bpmn:ServiceTask": activityAllowedTargets,
244
+ "bpmn:SendTask": activityAllowedTargets,
245
+ "bpmn:ReceiveTask": activityAllowedTargets,
246
+ "bpmn:ManualTask": activityAllowedTargets,
247
+ "bpmn:BusinessRuleTask": activityAllowedTargets,
248
+ "bpmn:ScriptTask": activityAllowedTargets,
249
+ "bpmn:CallActivity": activityAllowedTargets,
250
+ "bpmn:SubProcess": activityAllowedTargets,
251
+ "bpmn:AdHocSubProcess": activityAllowedTargets,
252
+ "bpmn:Transaction": activityAllowedTargets,
253
+ "bpmn:TextAnnotation": new Set(),
254
+ "bpmn:Participant": baseAllowedTargets,
255
+ "bpmn:Lane": baseAllowedTargets,
256
+ };
257
+
258
+ function canNodeTypesBeConnected(sourceNode, targetNode) {
259
+ const s = sourceNode?.type;
260
+ const t = targetNode?.type;
261
+ if (!sourceNode || !s || !targetNode || !t) return false;
262
+ const allowed = allowedTargetNodeTypesForSourceNodeType[s];
263
+ // No matching rule for the source type → frontend `canNodeTypesBeConnected`
264
+ // returns false (BPMNTypesUtils.ts:51-82: after the explicit-rule and
265
+ // inherited-rule loops exhaust with no match it `return false`). The
266
+ // abstract-type inheritance the frontend additionally walks is already folded
267
+ // into our concrete allow-map (every concrete activity/event type has an
268
+ // explicit entry above), so an unknown source type genuinely has no rule and
269
+ // must be rejected as INVALID_CONNECTION_TYPE.
270
+ if (!allowed) return false;
271
+ return allowed.has(t);
272
+ }
273
+
274
+ export function validateConnections(nodes, edges, lookupMaps) {
275
+ const { nodeById } = lookupMaps;
276
+ const errors = [];
277
+ for (const edge of edges) {
278
+ // Only sequence flows participate in node-type connection rules; message
279
+ // flows/associations have separate rules. Frontend `Edge[]` for a diagram
280
+ // are predominantly sequence flows.
281
+ if (edge.type && edge.type !== "bpmn:SequenceFlow") continue;
282
+ const sourceNode = nodeById.get(edge.source);
283
+ const targetNode = nodeById.get(edge.target);
284
+ if (!sourceNode || !targetNode) {
285
+ errors.push({
286
+ code: "INVALID_CONNECTION",
287
+ message: "Broken flow line: references an element that no longer exists.",
288
+ severity: SEVERITY.WARNING,
289
+ sourceId: edge.source,
290
+ targetId: edge.target,
291
+ elementId: edge.id,
292
+ });
293
+ continue;
294
+ }
295
+ if (sourceNode.id === targetNode.id) {
296
+ errors.push({
297
+ code: "INVALID_CONNECTION",
298
+ message: "Invalid connection: source and target cannot be the same.",
299
+ severity: SEVERITY.WARNING,
300
+ sourceId: edge.source,
301
+ targetId: edge.target,
302
+ elementId: edge.id,
303
+ });
304
+ continue;
305
+ }
306
+ if (!canNodeTypesBeConnected(sourceNode, targetNode)) {
307
+ errors.push({
308
+ code: "INVALID_CONNECTION_TYPE",
309
+ message: `${sourceNode.type} cannot connect to ${targetNode.type}.`,
310
+ severity: SEVERITY.WARNING,
311
+ sourceId: edge.source,
312
+ targetId: edge.target,
313
+ elementId: edge.id,
314
+ });
315
+ }
316
+ }
317
+ return errors;
318
+ }
319
+
320
+ // ===========================================================================
321
+ // RULE 3: DuplicateErrorEventSubprocessRule
322
+ // ===========================================================================
323
+ function getErrorObject(canvasState, errorRef) {
324
+ const errorObjects = canvasState.objects?.errors ?? [];
325
+ return errorObjects.find((o) => o.id === errorRef);
326
+ }
327
+
328
+ export function validateDuplicateErrorEventSubprocess(nodes, canvasState, lookupMaps) {
329
+ const { nodesByParentId } = lookupMaps;
330
+ const infos = [];
331
+ const eventSubprocesses = nodes.filter((n) => n.type === "bpmn:SubProcess" && n.data?.triggeredByEvent === true);
332
+ for (const sp of eventSubprocesses) {
333
+ const children = nodesByParentId.get(sp.id) ?? [];
334
+ const starts = children.filter((c) => c.type === "bpmn:StartEvent" && c.data?.eventDefinition?.type === "bpmn:ErrorEventDefinition");
335
+ for (const se of starts) {
336
+ const ed = se.data?.eventDefinition ?? {};
337
+ infos.push({ node: sp, errorRef: ed.errorRef, errorCode: getErrorObject(canvasState, ed.errorRef)?.errorCode });
338
+ }
339
+ }
340
+ const grouped = new Map();
341
+ for (const i of infos) {
342
+ const scope = i.node.parentId || "root";
343
+ const arr = grouped.get(scope) ?? [];
344
+ arr.push(i);
345
+ grouped.set(scope, arr);
346
+ }
347
+ const errors = [];
348
+ for (const [, scoped] of grouped) {
349
+ const catchAll = scoped.filter((i) => i.errorRef === undefined);
350
+ if (catchAll.length > 1) {
351
+ for (const i of catchAll) {
352
+ errors.push({
353
+ code: "MULTIPLE_CATCH_ALL_ERROR_EVENT_SUBPROCESS",
354
+ message: "Only one catch-all error event subprocess is allowed per scope.",
355
+ severity: SEVERITY.ERROR,
356
+ elementId: i.node.id,
357
+ });
358
+ }
359
+ }
360
+ const byCode = new Map();
361
+ for (const i of scoped) {
362
+ if (i.errorRef !== undefined && i.errorRef !== "" && i.errorCode) {
363
+ const arr = byCode.get(i.errorCode) ?? [];
364
+ arr.push(i);
365
+ byCode.set(i.errorCode, arr);
366
+ }
367
+ }
368
+ for (const [, same] of byCode) {
369
+ if (same.length > 1) {
370
+ for (const i of same) {
371
+ errors.push({
372
+ code: "DUPLICATE_ERROR_EVENT_SUBPROCESS",
373
+ message: "Only one error event subprocess is allowed per error code per scope.",
374
+ severity: SEVERITY.ERROR,
375
+ elementId: i.node.id,
376
+ });
377
+ }
378
+ }
379
+ }
380
+ }
381
+ return errors;
382
+ }
383
+
384
+ // ===========================================================================
385
+ // RULE 4: EmptyStartEventDefinitionInSubProcessRule
386
+ // ===========================================================================
387
+ export function validateEventSubProcessStart(nodes, _edges, lookupMaps) {
388
+ const { nodesByParentId } = lookupMaps;
389
+ const errors = [];
390
+ const allowed = [
391
+ "bpmn:TimerEventDefinition",
392
+ "bpmn:MessageEventDefinition",
393
+ "bpmn:ErrorEventDefinition",
394
+ "bpmn:SignalEventDefinition",
395
+ "bpmn:EscalationEventDefinition",
396
+ ];
397
+ for (const node of nodes) {
398
+ if (node.type !== "bpmn:SubProcess") continue;
399
+ const isEventSubprocess = node.data?.triggeredByEvent === true;
400
+ const children = nodesByParentId.get(node.id) ?? [];
401
+ const starts = children.filter((c) => c.type === "bpmn:StartEvent");
402
+ for (const se of starts) {
403
+ const ed = se.data?.eventDefinition;
404
+ if (isEventSubprocess) {
405
+ if (!ed) {
406
+ errors.push({
407
+ code: "START_EVENT_WITHOUT_DEFINITION_IN_EVENT_SUBPROCESS",
408
+ message: "Start event in an event sub-process must have an event definition.",
409
+ severity: SEVERITY.ERROR,
410
+ elementId: se.id,
411
+ sourceId: node.id,
412
+ });
413
+ } else if (ed.type && !allowed.includes(ed.type)) {
414
+ errors.push({
415
+ code: "INVALID_EVENT_DEFINITION_IN_EVENT_SUBPROCESS",
416
+ message: "Start event in an event sub-process must use Timer/Message/Error/Signal/Escalation.",
417
+ severity: SEVERITY.ERROR,
418
+ elementId: se.id,
419
+ sourceId: node.id,
420
+ });
421
+ }
422
+ } else if (ed) {
423
+ errors.push({
424
+ code: "START_EVENT_WITH_DEFINITION_IN_SUBPROCESS",
425
+ message: "Start event in a regular sub-process must not have an event definition.",
426
+ severity: SEVERITY.ERROR,
427
+ elementId: se.id,
428
+ sourceId: node.id,
429
+ });
430
+ }
431
+ }
432
+ }
433
+ return errors;
434
+ }
435
+
436
+ // ===========================================================================
437
+ // RULE 5: ErrorBoundaryEventRule (validate + duplicate)
438
+ // ===========================================================================
439
+ export function validateErrorBoundaryEvents(nodes, canvasState) {
440
+ const errors = [];
441
+ for (const node of nodes) {
442
+ if (node.type !== "bpmn:BoundaryEvent") continue;
443
+ const ed = node.data?.eventDefinition;
444
+ if (!ed || ed.type !== "bpmn:ErrorEventDefinition") continue;
445
+ const details = getEventObjectDetailsMapping(ed.type);
446
+ if (!details) continue;
447
+ const errorRefId = dotGet(node, details.accessor);
448
+ if (!errorRefId && ed.errorRef !== undefined) {
449
+ errors.push({
450
+ code: "ERROR_BOUNDARY_EVENT_EMPTY_ERROR_REF",
451
+ message: "Error boundary event has an empty error reference.",
452
+ severity: SEVERITY.ERROR,
453
+ elementId: node.id,
454
+ });
455
+ continue;
456
+ }
457
+ if (errorRefId) {
458
+ const errorObject = (canvasState.objects?.[details.type] ?? []).find((o) => o.id === errorRefId);
459
+ if (errorObject && details.code && (!dotGet(errorObject, details.code) || String(dotGet(errorObject, details.code)).trim() === "")) {
460
+ errors.push({
461
+ code: "ERROR_BOUNDARY_EVENT_REQUIRES_ERROR_CODE",
462
+ message: `Error '${errorObject.name || "Unknown"}' referenced by boundary event must have an error code.`,
463
+ severity: SEVERITY.ERROR,
464
+ elementId: node.id,
465
+ });
466
+ }
467
+ }
468
+ }
469
+ return errors;
470
+ }
471
+
472
+ export function validateDuplicateErrorBoundaryEvents(nodes, canvasState) {
473
+ const errors = [];
474
+ const byTask = new Map();
475
+ for (const node of nodes) {
476
+ if (node.type !== "bpmn:BoundaryEvent") continue;
477
+ const ed = node.data?.eventDefinition;
478
+ if (!ed || ed.type !== "bpmn:ErrorEventDefinition") continue;
479
+ const attachedToId = node.data?.attachedToId;
480
+ if (!attachedToId) continue;
481
+ const arr = byTask.get(attachedToId) ?? [];
482
+ arr.push(node);
483
+ byTask.set(attachedToId, arr);
484
+ }
485
+ for (const [, events] of byTask) {
486
+ const catchAll = events.filter((n) => n.data?.eventDefinition?.errorRef === undefined);
487
+ if (catchAll.length > 1) {
488
+ for (const e of catchAll) {
489
+ errors.push({
490
+ code: "MULTIPLE_CATCH_ALL_BOUNDARY_EVENTS_ON_TASK",
491
+ message: "Only one catch-all error boundary event is allowed per task.",
492
+ severity: SEVERITY.ERROR,
493
+ elementId: e.id,
494
+ });
495
+ }
496
+ }
497
+ const byCode = new Map();
498
+ for (const n of events) {
499
+ const ref = n.data?.eventDefinition?.errorRef;
500
+ if (ref !== undefined && ref !== "") {
501
+ const code = getErrorObject(canvasState, ref)?.errorCode;
502
+ if (code) {
503
+ const arr = byCode.get(code) ?? [];
504
+ arr.push(n);
505
+ byCode.set(code, arr);
506
+ }
507
+ }
508
+ }
509
+ for (const [, same] of byCode) {
510
+ if (same.length > 1) {
511
+ for (const n of same) {
512
+ errors.push({
513
+ code: "DUPLICATE_ERROR_BOUNDARY_EVENT_ON_TASK",
514
+ message: "Only one error boundary event is allowed per error code per task.",
515
+ severity: SEVERITY.ERROR,
516
+ elementId: n.id,
517
+ });
518
+ }
519
+ }
520
+ }
521
+ }
522
+ return errors;
523
+ }
524
+
525
+ // ===========================================================================
526
+ // RULE 6: ErrorEndEventRule
527
+ // ===========================================================================
528
+ export function validateErrorEndEvents(nodes) {
529
+ const errors = [];
530
+ for (const node of nodes) {
531
+ if (node.type !== "bpmn:EndEvent") continue;
532
+ const ed = node.data?.eventDefinition;
533
+ if (!ed || ed.type !== "bpmn:ErrorEventDefinition") continue;
534
+ if (!ed.errorRef) {
535
+ errors.push({
536
+ code: "ERROR_END_EVENT_MISSING_EXCEPTION",
537
+ message: "Error end event is missing a configured exception (errorRef).",
538
+ severity: SEVERITY.ERROR,
539
+ elementId: node.id,
540
+ });
541
+ }
542
+ }
543
+ return errors;
544
+ }
545
+
546
+ // ===========================================================================
547
+ // RULE 7: FakeJoinRule
548
+ // ===========================================================================
549
+ // FAITHFUL-PORT NOTE (drift resolved by matching the frontend's *actual*
550
+ // behavior — see validator/test/integration.test.mjs and README "FakeJoin"):
551
+ //
552
+ // The PO.Frontend FakeJoinRule fires only when `node.type === "bpmn:Activity"`
553
+ // or `node.type === "bpmn:Event"` — a LITERAL string equality against the
554
+ // abstract BPMN type names (FakeJoinRule.ts, isActivityOrEvent). However, on the
555
+ // real canvas every node carries its CONCRETE `$type` (`bpmn:Task`,
556
+ // `bpmn:EndEvent`, ...): bpmn-from-xml.ts sets `type: $type` and the validation
557
+ // layer compares concrete types everywhere (ValidateBpmnFlowUtils compares
558
+ // `=== "bpmn:StartEvent"`). The abstract names are never assigned to a real
559
+ // node, so on exported BPMN this frontend rule is effectively DORMANT — it never
560
+ // fires. The rule's own source carries a TODO admitting it must be rewritten to
561
+ // walk the inherited-type chain, which it does not yet do.
562
+ //
563
+ // Our model reconstructs CONCRETE types from the XML, mirroring the canvas.
564
+ // To match the frontend's observable behavior on real BPMN (and avoid the
565
+ // false positives an earlier hand-port produced on valid files), we apply the
566
+ // frontend's exact predicate: literal equality on `node.type`. This keeps the
567
+ // port faithful — same inputs, same outputs as the frontend — rather than
568
+ // inventing a stricter rule the frontend does not have.
569
+ function isFrontendFakeJoinType(type) {
570
+ return type === "bpmn:Activity" || type === "bpmn:Event";
571
+ }
572
+ export function validateFakeJoins(nodes, edges, lookupMaps) {
573
+ if (!nodes || !edges) return [];
574
+ const errors = [];
575
+ const { edgesByTarget } = lookupMaps;
576
+ for (const node of nodes) {
577
+ if (!isFrontendFakeJoinType(node.type)) continue;
578
+ const incoming = (edgesByTarget.get(node.id) ?? []).filter((e) => !e.type || e.type === "bpmn:SequenceFlow");
579
+ if (incoming.length > 1) {
580
+ errors.push({
581
+ code: "FAKE_JOIN",
582
+ message: "Activities and events should not have multiple incoming flows.",
583
+ severity: SEVERITY.ERROR,
584
+ elementId: node.id,
585
+ });
586
+ }
587
+ }
588
+ return errors;
589
+ }
590
+
591
+ // ===========================================================================
592
+ // RULE 8: MessageFlowObjectsPoolRule
593
+ // ===========================================================================
594
+ function buildNodeToPoolMap(nodes, nodeById) {
595
+ const map = new Map();
596
+ for (const node of nodes) {
597
+ let cur = node;
598
+ while (cur) {
599
+ if (cur.type === "bpmn:Participant") {
600
+ map.set(node.id, cur.id);
601
+ break;
602
+ }
603
+ if (!cur.parentId) break;
604
+ const parent = nodeById.get(cur.parentId);
605
+ if (!parent) break;
606
+ cur = parent;
607
+ }
608
+ }
609
+ return map;
610
+ }
611
+ export function validateMessageFlowCrossPool(nodes, edges, lookupMaps) {
612
+ const errors = [];
613
+ if (!nodes.some((n) => n.type === "bpmn:Participant")) return errors;
614
+ const nodeToPool = buildNodeToPoolMap(nodes, lookupMaps.nodeById);
615
+ for (const edge of edges) {
616
+ if (edge.type !== "bpmn:MessageFlow") continue;
617
+ const sp = nodeToPool.get(edge.source);
618
+ const tp = nodeToPool.get(edge.target);
619
+ if (sp && tp && sp === tp) {
620
+ errors.push({
621
+ code: "SAME_POOL_MESSAGE_FLOW",
622
+ message: "Message flow cannot connect elements within the same pool.",
623
+ severity: SEVERITY.ERROR,
624
+ sourceId: edge.source,
625
+ targetId: edge.target,
626
+ elementId: edge.id,
627
+ });
628
+ }
629
+ }
630
+ return errors;
631
+ }
632
+
633
+ // ===========================================================================
634
+ // RULE 9: MissingResourceRule
635
+ // ===========================================================================
636
+ const SERVICE_TYPES_REQUIRING_RESOURCE = new Set([
637
+ "Orchestrator.StartAgentJob",
638
+ "Orchestrator.StartJob",
639
+ "Orchestrator.CreateQueueItem",
640
+ "Orchestrator.CreateAndWaitForQueueItem",
641
+ "Orchestrator.ExecuteApiWorkflowAsync",
642
+ "Actions.HITL",
643
+ "Orchestrator.StartAgenticProcess",
644
+ "Orchestrator.StartAgenticProcessAsync",
645
+ "Orchestrator.StartCaseMgmtProcess",
646
+ "Orchestrator.StartCaseMgmtProcessAsync",
647
+ ]);
648
+ function hasResourceBinding(uipath) {
649
+ if (!uipath?.context) return false;
650
+ const releaseKey = uipath.context.find((c) => c.name === "releaseKey")?.value;
651
+ if (releaseKey) return true;
652
+ const name = uipath.context.find((c) => c.name === "name")?.value;
653
+ return !!name;
654
+ }
655
+ export function validateMissingResource(nodes) {
656
+ const errors = [];
657
+ for (const node of nodes) {
658
+ const uipath = node.data?.uipath;
659
+ const serviceType = uipath?.serviceType;
660
+ if (!serviceType || !SERVICE_TYPES_REQUIRING_RESOURCE.has(serviceType)) continue;
661
+ if (hasResourceBinding(uipath)) continue;
662
+ const label = node.data?.label || node.id;
663
+ errors.push({
664
+ code: "MISSING_RESOURCE",
665
+ message: `Service task '${label}' has no bound resource.`,
666
+ severity: SEVERITY.WARNING,
667
+ elementId: node.id,
668
+ });
669
+ }
670
+ return errors;
671
+ }
672
+
673
+ // ===========================================================================
674
+ // RULE 10: MissingRootVariableRule
675
+ // ===========================================================================
676
+ export function validateMissingRootVariables(nodes, canvasState) {
677
+ const errors = [];
678
+ const rootIds = new Set();
679
+ const rv = canvasState.root?.data?.uipath?.variables;
680
+ for (const v of rv?.inputOutputs ?? []) if (v.id) rootIds.add(v.id);
681
+ for (const v of rv?.outputs ?? []) if (v.id) rootIds.add(v.id);
682
+
683
+ const findNode = (id) => {
684
+ for (const d of Object.values(canvasState.diagramsById)) {
685
+ const n = d.nodes.find((x) => x.id === id);
686
+ if (n) return n;
687
+ }
688
+ return undefined;
689
+ };
690
+ const collectNodeVarIds = (node) => {
691
+ const ids = new Set();
692
+ const nv = node.data?.uipath?.variables;
693
+ for (const v of nv?.inputOutputs ?? []) if (v.id) ids.add(v.id);
694
+ for (const v of nv?.outputs ?? []) if (v.id) ids.add(v.id);
695
+ return ids;
696
+ };
697
+ const scopeIdsFor = (node) => {
698
+ const result = new Set(rootIds);
699
+ let cur = node;
700
+ const visited = new Set();
701
+ while (true) {
702
+ const pe = cur?.data?.parentElement;
703
+ if (pe?.type !== "bpmn:SubProcess" || visited.has(pe.id)) break;
704
+ visited.add(pe.id);
705
+ const spNode = findNode(pe.id);
706
+ if (spNode) for (const id of collectNodeVarIds(spNode)) result.add(id);
707
+ cur = spNode;
708
+ }
709
+ return result;
710
+ };
711
+
712
+ for (const node of nodes) {
713
+ const outputs = node.data?.uipath?.outputs ?? [];
714
+ if (!outputs.length) continue;
715
+ const scopeIds = scopeIdsFor(node);
716
+ const missing = outputs.some((o) => o.var && !scopeIds.has(o.var));
717
+ if (missing) {
718
+ errors.push({
719
+ code: "MISSING_ROOT_VARIABLE",
720
+ message: `Node '${node.data?.label ?? node.id}' references an output variable with no matching scope variable.`,
721
+ severity: SEVERITY.WARNING,
722
+ elementId: node.id,
723
+ });
724
+ }
725
+ }
726
+ return errors;
727
+ }
728
+
729
+ // ===========================================================================
730
+ // RULE 11: NoAssignmentsRule
731
+ // ===========================================================================
732
+ export function validateNoAssignmentsInExpressions(nodes, edges) {
733
+ if (!nodes || !edges) return [];
734
+ const errors = [];
735
+ for (const edge of edges) {
736
+ const expr = edge.data?.conditionExpression;
737
+ if (expr && expressionHasAssignment(expr)) {
738
+ errors.push({
739
+ code: "ASSIGNMENT_NOT_ALLOWED",
740
+ message: "Expression must not contain an assignment operator.",
741
+ severity: SEVERITY.WARNING,
742
+ elementId: edge.id,
743
+ sourceId: edge.source,
744
+ targetId: edge.target,
745
+ });
746
+ }
747
+ }
748
+ for (const node of nodes) {
749
+ const mappings = node.data?.uipath?.errorMapping;
750
+ if (!Array.isArray(mappings)) continue;
751
+ for (const m of mappings) {
752
+ if (m?.condition && expressionHasAssignment(m.condition)) {
753
+ errors.push({
754
+ code: "ASSIGNMENT_NOT_ALLOWED",
755
+ message: "Error-mapping condition must not contain an assignment operator.",
756
+ severity: SEVERITY.WARNING,
757
+ elementId: node.id,
758
+ });
759
+ }
760
+ }
761
+ }
762
+ return errors;
763
+ }
764
+
765
+ // ===========================================================================
766
+ // RULE 12: RequiredFieldsRule (sourced from bpmn-spec.json registry metadata)
767
+ // ===========================================================================
768
+ // Faithful port of ValidateRequiredFieldsInData.findRequiredFieldErrorInData:
769
+ // for each field in context, then inputs, then outputs (frontend order),
770
+ // if (field.required && isNilOrEmpty(field.value)) → first error.
771
+ //
772
+ // On canvas, EVERY field a serviceType declares is present in the node data with
773
+ // its `required` flag set; an unbound required field is present-with-empty-value
774
+ // and the frontend fires on it. In exported BPMN an unbound required field is
775
+ // simply ABSENT. To reach parity, we treat an absent required field exactly as
776
+ // the frontend treats an unbound one: present with an empty value. The required-
777
+ // field names come from the bundled registry (bpmn-spec.json) per serviceType
778
+ // (model.mjs attaches them as `uipath.requiredFieldNames`).
779
+ //
780
+ // BOUNDARY: For dynamic IS-connector activity types whose required-ness is NOT
781
+ // in the static spec — it only materializes after a `registry get` enrichment —
782
+ // `requiredFieldNames` is undefined and absence cannot be judged offline, so we
783
+ // stay conservative (only present-but-empty fires). The frontend needs the same
784
+ // enrichment to know those fields are required, so this is shared, not a gap.
785
+ export function validateRequiredFields(nodes) {
786
+ if (!nodes) return []; // frontend RequiredFieldsRule guards null inputs
787
+ const errors = [];
788
+ for (const node of nodes) {
789
+ const uipath = node.data?.uipath;
790
+ if (!uipath) continue;
791
+ // First (frontend order): present fields flagged when required + empty value.
792
+ const firstEmptyPresent = (fields) => {
793
+ if (!Array.isArray(fields)) return undefined;
794
+ for (const field of fields) {
795
+ if (field.required && isNilOrEmpty(field.value)) return field;
796
+ }
797
+ return undefined;
798
+ };
799
+ let badName;
800
+ const present = firstEmptyPresent(uipath.context) ?? firstEmptyPresent(uipath.inputs) ?? firstEmptyPresent(uipath.outputs);
801
+ if (present) badName = present.name;
802
+ else if (Array.isArray(uipath.requiredFieldNames)) {
803
+ // No present-but-empty required field; check for an entirely ABSENT one
804
+ // (treated by the frontend as present-with-empty, hence required+empty).
805
+ const presentNames = new Set();
806
+ for (const group of [uipath.context, uipath.inputs, uipath.outputs]) {
807
+ if (!Array.isArray(group)) continue;
808
+ for (const f of group) if (f.name) presentNames.add(f.name);
809
+ }
810
+ const absent = uipath.requiredFieldNames.find((name) => !presentNames.has(name));
811
+ if (absent) badName = absent;
812
+ }
813
+ if (badName !== undefined) {
814
+ const label = node.data?.label ?? node.id;
815
+ errors.push({
816
+ code: "EMPTY_REQUIRED_FIELD",
817
+ message: `The field '${badName}' in node '${label}' is required but has no value.`,
818
+ severity: SEVERITY.ERROR,
819
+ elementId: node.id,
820
+ });
821
+ }
822
+ }
823
+ return errors;
824
+ }
825
+
826
+ // ===========================================================================
827
+ // RULE 13: SequenceFlowPoolCrossingRule
828
+ // ===========================================================================
829
+ export function validateSequenceFlowPoolCrossing(nodes, edges, lookupMaps) {
830
+ const errors = [];
831
+ if (!nodes.some((n) => n.type === "bpmn:Participant")) return errors;
832
+ const nodeById = lookupMaps.nodeById;
833
+ const nodeToPool = buildNodeToPoolMap(nodes, nodeById);
834
+ for (const edge of edges) {
835
+ if (edge.type !== "bpmn:SequenceFlow") continue;
836
+ const sp = nodeToPool.get(edge.source);
837
+ const tp = nodeToPool.get(edge.target);
838
+ const targetNode = nodeById.get(edge.target);
839
+ if (sp !== tp && targetNode?.type !== "bpmn:StartEvent") {
840
+ errors.push({
841
+ code: "CROSSING_POOL_BOUNDARY",
842
+ message: "Sequence flow cannot cross pool boundaries.",
843
+ severity: SEVERITY.ERROR,
844
+ sourceId: edge.source,
845
+ targetId: edge.target,
846
+ elementId: edge.id,
847
+ });
848
+ }
849
+ }
850
+ return errors;
851
+ }
852
+
853
+ // ===========================================================================
854
+ // RULE 14: SequenceFlowSubProcessCrossingRule
855
+ // ===========================================================================
856
+ function getLogicalParent(node, nodeMap) {
857
+ const actualParent = node.parentId ? nodeMap.get(node.parentId) : undefined;
858
+ if (node.type === "bpmn:BoundaryEvent") {
859
+ const attachedToId = node.data?.attachedToId;
860
+ const attachedTo = attachedToId ? nodeMap.get(attachedToId) : undefined;
861
+ if (attachedTo) return attachedTo.parentId ? nodeMap.get(attachedTo.parentId) : undefined;
862
+ }
863
+ return actualParent;
864
+ }
865
+ export function validateSequenceFlowSubProcessCrossing(_nodes, edges, lookupMaps) {
866
+ const errors = [];
867
+ const nodeMap = lookupMaps.nodeById;
868
+ for (const edge of edges) {
869
+ if (edge.type !== "bpmn:SequenceFlow") continue;
870
+ const sourceNode = nodeMap.get(edge.source);
871
+ const targetNode = nodeMap.get(edge.target);
872
+ if (!sourceNode || !targetNode) continue;
873
+ const sp = getLogicalParent(sourceNode, nodeMap);
874
+ const tp = getLogicalParent(targetNode, nodeMap);
875
+ if ((sp?.type === "bpmn:SubProcess" || tp?.type === "bpmn:SubProcess") && sp?.id !== tp?.id) {
876
+ errors.push({
877
+ code: "CROSSING_SUBPROCESS_BOUNDARY",
878
+ message: "Sequence flow cannot cross sub-process boundaries.",
879
+ severity: SEVERITY.ERROR,
880
+ sourceId: edge.source,
881
+ targetId: edge.target,
882
+ elementId: edge.id,
883
+ });
884
+ }
885
+ }
886
+ return errors;
887
+ }
888
+
889
+ // ===========================================================================
890
+ // RULE 15: SingleBlankStartEventRule
891
+ // ===========================================================================
892
+ export function validateSingleBlankStartEvent(nodes, edges, lookupMaps) {
893
+ if (!nodes || !edges) return [];
894
+ const errors = [];
895
+ const { nodesByParentId } = lookupMaps;
896
+ const isBlankStart = (n) => n.type === "bpmn:StartEvent" && !n.data?.eventDefinition;
897
+ const containers = nodes.filter((n) => n.type === "bpmn:Process" || n.type === "bpmn:SubProcess");
898
+ for (const container of containers) {
899
+ const scopeNodes = container.type === "bpmn:Process" ? (nodesByParentId.get(undefined) ?? []) : (nodesByParentId.get(container.id) ?? []);
900
+ const blanks = scopeNodes.filter(isBlankStart);
901
+ if (blanks.length > 1) {
902
+ const type = container.type === "bpmn:SubProcess" ? "Sub-process" : "Process";
903
+ errors.push({
904
+ code: "MULTIPLE_BLANK_START_EVENTS",
905
+ message: `${type} should have at most one blank start event.`,
906
+ severity: SEVERITY.ERROR,
907
+ elementId: container.id,
908
+ });
909
+ }
910
+ }
911
+ return errors;
912
+ }
913
+
914
+ // ===========================================================================
915
+ // RULE 16: SingleStartEventInEventSubProcessRule
916
+ // ===========================================================================
917
+ export function validateSingleStartEventInEventSubProcess(nodes, _edges, lookupMaps) {
918
+ const errors = [];
919
+ const { nodesByParentId } = lookupMaps;
920
+ for (const node of nodes) {
921
+ if (!(node.type === "bpmn:SubProcess" && node.data?.triggeredByEvent === true)) continue;
922
+ const children = nodesByParentId.get(node.id) ?? [];
923
+ const starts = children.filter((c) => c.type === "bpmn:StartEvent");
924
+ if (starts.length > 1) {
925
+ errors.push({
926
+ code: "MULTIPLE_START_EVENTS_IN_EVENT_SUBPROCESS",
927
+ message: "Event sub-process can have only one start event.",
928
+ severity: SEVERITY.ERROR,
929
+ elementId: node.id,
930
+ sourceId: node.id,
931
+ });
932
+ }
933
+ }
934
+ return errors;
935
+ }
936
+
937
+ // ===========================================================================
938
+ // RULE 17: SuperfluousGatewayRule
939
+ // ===========================================================================
940
+ export function validateSuperfluousGateway(nodes, edges, lookupMaps) {
941
+ if (!nodes || !edges) return [];
942
+ const errors = [];
943
+ const { edgesBySource, edgesByTarget } = lookupMaps;
944
+ const isGateway = (t) => t === "bpmn:ExclusiveGateway" || t === "bpmn:ParallelGateway" || t === "bpmn:InclusiveGateway";
945
+ for (const node of nodes) {
946
+ if (!isGateway(node.type)) continue;
947
+ const incoming = edgesByTarget.get(node.id) ?? [];
948
+ const outgoing = edgesBySource.get(node.id) ?? [];
949
+ if (incoming.length === 1 && outgoing.length === 1) {
950
+ errors.push({
951
+ code: "SUPERFLUOUS_GATEWAY",
952
+ message: "Gateway should have at least two sources or targets.",
953
+ severity: SEVERITY.ERROR,
954
+ elementId: node.id,
955
+ });
956
+ }
957
+ }
958
+ return errors;
959
+ }
960
+
961
+ // ===========================================================================
962
+ // RULE 18: TaskTimerRule
963
+ // ===========================================================================
964
+ const MIN_TIMER_MINUTES = 15;
965
+ const MAX_TIMER_MINUTES = 90 * 24 * 60;
966
+ function isTimerValueOutOfRange(value) {
967
+ if (value == null || value === "") return false;
968
+ const str = String(value);
969
+ if (str.startsWith("@") || str.startsWith("=")) return false;
970
+ const minutes = Number(str);
971
+ if (Number.isNaN(minutes)) return false;
972
+ return minutes < MIN_TIMER_MINUTES || minutes > MAX_TIMER_MINUTES;
973
+ }
974
+ export function validateTaskTimerRange(nodes) {
975
+ if (!nodes) return [];
976
+ const errors = [];
977
+ for (const node of nodes) {
978
+ const uipath = node.data?.uipath;
979
+ if (uipath?.serviceType !== "actions") continue;
980
+ const timer = uipath.context?.find((c) => c.name === "Timer");
981
+ if (timer?.value == null || timer.value === "") continue;
982
+ if (isTimerValueOutOfRange(timer.value)) {
983
+ errors.push({
984
+ code: "TASK_TIMER_OUT_OF_RANGE",
985
+ message: `Task timer for '${node.data?.label ?? node.id}' must be between 15 minutes and 90 days.`,
986
+ severity: SEVERITY.WARNING,
987
+ elementId: node.id,
988
+ });
989
+ }
990
+ }
991
+ return errors;
992
+ }
993
+
994
+ // ===========================================================================
995
+ // RULE 19: TimerDurationRule
996
+ // ===========================================================================
997
+ export function validateTimerDuration(nodes) {
998
+ if (!nodes) return [];
999
+ const errors = [];
1000
+ for (const node of nodes) {
1001
+ const ed = node.data?.eventDefinition;
1002
+ if (ed?.timerType !== "timeDuration") continue;
1003
+ const value = ed.timeDuration;
1004
+ if (!value) continue;
1005
+ if (value.startsWith("=") || value.startsWith("@")) continue;
1006
+ const label = node.data?.label ?? node.id;
1007
+ if (!isValidIso8601(value)) {
1008
+ errors.push({
1009
+ code: "TIMER_DURATION_INVALID",
1010
+ message: `Timer duration '${value}' on '${label}' is not a valid ISO 8601 duration.`,
1011
+ severity: SEVERITY.ERROR,
1012
+ elementId: node.id,
1013
+ });
1014
+ continue;
1015
+ }
1016
+ if (hasIso8601WeekDesignator(value)) {
1017
+ errors.push({
1018
+ code: "TIMER_DURATION_WEEK_UNSUPPORTED",
1019
+ message: `Timer duration '${value}' on '${label}' uses the unsupported week (W) designator.`,
1020
+ severity: SEVERITY.WARNING,
1021
+ elementId: node.id,
1022
+ });
1023
+ }
1024
+ }
1025
+ return errors;
1026
+ }
1027
+
1028
+ // ---------------------------------------------------------------------------
1029
+ // Variable-existence check across all nodes & edges of the whole model.
1030
+ // Port of VariableUtil.validateVariablesInAllNodesAndEdges (the existence half).
1031
+ // `knownIds` is built from variable ids AND names AND canonicalIds (model.mjs).
1032
+ // ---------------------------------------------------------------------------
1033
+ export function validateVariableExistence(allNodes, allEdges, knownIds) {
1034
+ const errors = [];
1035
+ const flag = (expr, elementId, resultIds, extra = {}) => {
1036
+ const unknown = findUnknownVariableRefs(expr, knownIds, resultIds);
1037
+ for (const ref of unknown) {
1038
+ errors.push({
1039
+ code: "VARIABLE_DOES_NOT_EXIST",
1040
+ message: `Variable reference '${ref}' does not resolve to a declared variable.`,
1041
+ severity: SEVERITY.ERROR,
1042
+ elementId,
1043
+ ...extra,
1044
+ });
1045
+ }
1046
+ };
1047
+ // Edge conditions have no element-local outputs → result.X never resolves.
1048
+ for (const edge of allEdges) {
1049
+ if (edge.data?.conditionExpression) {
1050
+ flag(edge.data.conditionExpression, edge.id, new Set(), { sourceId: edge.source, targetId: edge.target });
1051
+ }
1052
+ }
1053
+ for (const node of allNodes) {
1054
+ const uipath = node.data?.uipath;
1055
+ if (!uipath) continue;
1056
+ // result.X is validated against THIS element's own output identifiers
1057
+ // (var/name/canonicalId), per VariableUtil.isResultVariableValidForElement.
1058
+ const resultIds = new Set();
1059
+ for (const o of uipath.outputs ?? []) {
1060
+ if (o.var) resultIds.add(o.var);
1061
+ if (o.name) resultIds.add(o.name);
1062
+ if (o.canonicalId) resultIds.add(o.canonicalId);
1063
+ }
1064
+ const exprs = [];
1065
+ for (const c of uipath.context ?? []) {
1066
+ if (typeof c.value === "string") exprs.push(c.value);
1067
+ if (typeof c.body === "string") exprs.push(c.body);
1068
+ }
1069
+ for (const i of uipath.inputs ?? []) {
1070
+ if (typeof i.value === "string") exprs.push(i.value);
1071
+ if (typeof i.body === "string") exprs.push(i.body);
1072
+ }
1073
+ // Custom-output expressions: gate the field by accessor type, mirroring
1074
+ // VariableUtil.ts:952-968 (source only when accessor is `source`, body only
1075
+ // when accessor is `body`).
1076
+ for (const o of uipath.outputs ?? []) {
1077
+ if (!o.custom) continue;
1078
+ const accessor = getAccessorFromType(o.type);
1079
+ if (accessor === "source" && typeof o.source === "string") exprs.push(o.source);
1080
+ else if (accessor === "body" && typeof o.body === "string") exprs.push(o.body);
1081
+ }
1082
+ for (const m of uipath.errorMapping ?? []) {
1083
+ if (typeof m.condition === "string") exprs.push(m.condition);
1084
+ }
1085
+ for (const expr of exprs) flag(expr, node.id, resultIds);
1086
+ }
1087
+ return errors;
1088
+ }
1089
+
1090
+ // ---------------------------------------------------------------------------
1091
+ // VARIABLE_NOT_SET — port of the flow-reachability half of
1092
+ // VariableUtil.validateVariablesInExpression (VariableUtil.ts:758-866).
1093
+ //
1094
+ // A variable can be DECLARED (exists in the known-id set) yet NOT SET at a given
1095
+ // element because no flow path reaches that element from the node that produces
1096
+ // it. The frontend computes, per element, the set of variables available via a
1097
+ // backward walk over sequence-flow edges (+ scope/parent chain, boundary
1098
+ // re-parenting, event-subprocess shared scope, subprocess EndEvent exposure),
1099
+ // then warns on every referenced+declared variable not in that set.
1100
+ //
1101
+ // Faithful port of:
1102
+ // getSourceEdgeMappings (VariableUtil.ts:121-130)
1103
+ // mapNodeOutputsToVariables (VariableUtil.ts:539-579, uipath outputs)
1104
+ // getVariablesForSubProcess (VariableUtil.ts:495-525)
1105
+ // getAvailableVariablesFromSourceNodes (VariableUtil.ts:303-389)
1106
+ // getAvailableVariablesForElement (VariableUtil.ts:401-481)
1107
+ // Skipped entirely for Case Management (VariableUtil.ts:826-828).
1108
+ // ---------------------------------------------------------------------------
1109
+
1110
+ // A node output declares a variable whose identifier is `var` (falling back to
1111
+ // `value` when shouldIdFallbackToValue, per the frontend mapNodeOutputsToVariables).
1112
+ // Returns id + canonicalId + name. The frontend's availability match keys on
1113
+ // id/canonicalId; this port additionally includes `name`, consistent with the
1114
+ // rest of the port's variable resolution (collectKnownVariableIds /
1115
+ // findUnknownVariableRefs resolve by id AND name AND canonicalId), because
1116
+ // exported BPMN expressions may reference a variable by its serialized name.
1117
+ function nodeOutputVariableIds(node, idFallbackToValue) {
1118
+ const ids = [];
1119
+ for (const o of node?.data?.uipath?.outputs ?? []) {
1120
+ const id = o.var ?? (idFallbackToValue ? (o.value ?? "") : "");
1121
+ if (id) ids.push(id);
1122
+ if (o.canonicalId) ids.push(o.canonicalId);
1123
+ if (o.name) ids.push(o.name);
1124
+ }
1125
+ return ids;
1126
+ }
1127
+
1128
+ // Port of getVariablesForSubProcess: the variables a subprocess EXPOSES to a
1129
+ // sibling selection (the subprocess node's own outputs + its EndEvent children's
1130
+ // outputs). `isSelfSelected` is always false here (the selection is never the
1131
+ // subprocess being traversed past), matching the edge-traversal path.
1132
+ function subProcessExposedVarIds(subProcessId, nodes) {
1133
+ const ids = [];
1134
+ for (const node of nodes) {
1135
+ const outs = nodeOutputVariableIds(node, false);
1136
+ if (!outs.length) continue;
1137
+ if (node.id === subProcessId) {
1138
+ for (const i of outs) ids.push(i);
1139
+ continue;
1140
+ }
1141
+ if (node.parentId === subProcessId || node.data?.parentElement?.id === subProcessId) {
1142
+ if (node.type === "bpmn:EndEvent") for (const i of outs) ids.push(i);
1143
+ }
1144
+ }
1145
+ return ids;
1146
+ }
1147
+
1148
+ // Backward BFS over sequence-flow edges from `selectionElementId`, collecting
1149
+ // every available variable id. Port of getAvailableVariablesFromSourceNodes.
1150
+ function availableVarIdsFromSourceNodes(selectionElementId, selectionElementType, nodes, edges, rootVarIds, nodeById) {
1151
+ const edgeToSource = new Map();
1152
+ const sourceToEdges = new Map();
1153
+ for (const edge of edges) {
1154
+ edgeToSource.set(edge.id, edge.source);
1155
+ const arr = sourceToEdges.get(edge.target) ?? [];
1156
+ arr.push(edge.id);
1157
+ sourceToEdges.set(edge.target, arr);
1158
+ }
1159
+
1160
+ const available = new Set(rootVarIds); // root variables are globally available
1161
+ const visitedEdges = new Set();
1162
+
1163
+ // The selected element's own outputs are available.
1164
+ const selected = nodeById.get(selectionElementId);
1165
+ if (selected) for (const i of nodeOutputVariableIds(selected, true)) available.add(i);
1166
+
1167
+ const edgesToVisit = [];
1168
+ let currentEdgeId = selectionElementId;
1169
+ if (selectionElementType === "node") {
1170
+ edgesToVisit.push(...(sourceToEdges.get(selectionElementId) ?? []));
1171
+ currentEdgeId = edgesToVisit.shift();
1172
+ }
1173
+
1174
+ while (currentEdgeId) {
1175
+ let sourceNode = nodeById.get(edgeToSource.get(currentEdgeId) ?? "");
1176
+ // Boundary events have no incoming edge; re-parent to their host.
1177
+ if (sourceNode?.type === "bpmn:BoundaryEvent" && sourceNode?.id) {
1178
+ const parentId = sourceNode.parentId;
1179
+ sourceNode = parentId ? nodeById.get(parentId) : undefined;
1180
+ }
1181
+ if (sourceNode?.type !== "bpmn:SubProcess" && sourceNode?.id) {
1182
+ for (const i of nodeOutputVariableIds(sourceNode, true)) available.add(i);
1183
+ }
1184
+ if (sourceNode?.type === "bpmn:SubProcess" && sourceNode?.id) {
1185
+ for (const i of subProcessExposedVarIds(sourceNode.id, nodes)) available.add(i);
1186
+ }
1187
+ visitedEdges.add(currentEdgeId);
1188
+
1189
+ let nextEdge = sourceToEdges.get(sourceNode?.id ?? "");
1190
+ if (!nextEdge && sourceNode?.parentId) {
1191
+ const sourceParent = nodeById.get(sourceNode.parentId);
1192
+ if (sourceParent?.type === "bpmn:SubProcess") nextEdge = sourceToEdges.get(sourceParent.id);
1193
+ }
1194
+ edgesToVisit.push(...(nextEdge ?? []).filter((e) => !visitedEdges.has(e)));
1195
+ currentEdgeId = edgesToVisit.shift();
1196
+ }
1197
+ return available;
1198
+ }
1199
+
1200
+ // Port of getAvailableVariablesForElement: source-node BFS + subprocess scope +
1201
+ // parent chain (with event-subprocess shared-scope handling).
1202
+ function availableVarIdsForElement(selectionElementId, selectionElementType, nodes, edges, rootVarIds, nodeById) {
1203
+ const available = availableVarIdsFromSourceNodes(selectionElementId, selectionElementType, nodes, edges, rootVarIds, nodeById);
1204
+
1205
+ const selected = nodeById.get(selectionElementId);
1206
+ if (selected?.type === "bpmn:SubProcess") {
1207
+ // Self-selected: expose all child variables.
1208
+ for (const node of nodes) {
1209
+ if (node.parentId === selectionElementId || node.data?.parentElement?.id === selectionElementId) {
1210
+ for (const i of nodeOutputVariableIds(node, false)) available.add(i);
1211
+ }
1212
+ }
1213
+ }
1214
+
1215
+ let parentElementId = selected?.data?.parentElement?.id;
1216
+ if (!parentElementId) return available;
1217
+
1218
+ const visitedParentIds = new Set();
1219
+ while (parentElementId && !visitedParentIds.has(parentElementId)) {
1220
+ visitedParentIds.add(parentElementId);
1221
+ const parentNode = nodeById.get(parentElementId);
1222
+ if (!parentNode) break;
1223
+
1224
+ const isParentEventSubprocess = parentNode.type === "bpmn:SubProcess" && parentNode.data?.triggeredByEvent === true;
1225
+ if (isParentEventSubprocess) {
1226
+ const grandparentNodeId = parentNode.data?.parentElement?.id;
1227
+ if (!grandparentNodeId) break;
1228
+ for (const node of nodes) {
1229
+ const nodeScope = node.data?.parentElement?.id;
1230
+ if (nodeScope === grandparentNodeId && node.id !== parentElementId) {
1231
+ if (node.type === "bpmn:SubProcess") {
1232
+ for (const i of subProcessExposedVarIds(node.id, nodes)) available.add(i);
1233
+ } else {
1234
+ for (const i of nodeOutputVariableIds(node, true)) available.add(i);
1235
+ }
1236
+ }
1237
+ }
1238
+ parentElementId = grandparentNodeId;
1239
+ continue;
1240
+ }
1241
+
1242
+ for (const i of availableVarIdsFromSourceNodes(parentElementId, "node", nodes, edges, rootVarIds, nodeById)) available.add(i);
1243
+ parentElementId = parentNode.data?.parentElement?.id;
1244
+ }
1245
+ return available;
1246
+ }
1247
+
1248
+ // Collect the `vars.X` identifiers in an expression that are DECLARED (resolve
1249
+ // against the model's known ids) — these are the candidates for VARIABLE_NOT_SET.
1250
+ function declaredVarRefsInExpression(expression, knownIds) {
1251
+ if (!expression) return [];
1252
+ const out = new Set();
1253
+ for (const match of expression.matchAll(VAR_REFS_REGEX)) {
1254
+ const prefix = match[2];
1255
+ if (prefix !== "vars") continue;
1256
+ const seg = match[3] ?? match[4];
1257
+ if (!seg || BUILTIN_NON_VARIABLE_VARS_SEGMENTS.has(seg)) continue;
1258
+ let resolvedId;
1259
+ if (knownIds.has(seg)) resolvedId = seg;
1260
+ else {
1261
+ for (const id of knownIds) {
1262
+ if (seg.startsWith(`${id}.`)) {
1263
+ resolvedId = id;
1264
+ break;
1265
+ }
1266
+ }
1267
+ }
1268
+ if (resolvedId) out.add(resolvedId);
1269
+ }
1270
+ return [...out];
1271
+ }
1272
+
1273
+ // `varExpressionsForElement` mirrors getInputExpressions + the output accessor
1274
+ // gate used by the frontend node loop (VariableUtil.ts:949-971).
1275
+ function varExpressionsForNode(uipath) {
1276
+ const exprs = [];
1277
+ for (const c of uipath.context ?? []) {
1278
+ if (typeof c.value === "string") exprs.push(c.value);
1279
+ if (typeof c.body === "string") exprs.push(c.body);
1280
+ }
1281
+ for (const i of uipath.inputs ?? []) {
1282
+ if (typeof i.value === "string") exprs.push(i.value);
1283
+ if (typeof i.body === "string") exprs.push(i.body);
1284
+ }
1285
+ for (const o of uipath.outputs ?? []) {
1286
+ if (!o.custom) continue;
1287
+ const accessor = getAccessorFromType(o.type);
1288
+ if (accessor === "source" && typeof o.source === "string") exprs.push(o.source);
1289
+ else if (accessor === "body" && typeof o.body === "string") exprs.push(o.body);
1290
+ }
1291
+ return exprs;
1292
+ }
1293
+
1294
+ // Emit VARIABLE_NOT_SET (WARNING) for declared variables referenced at an
1295
+ // element that are not reachable in flow order. Skipped for Case Management.
1296
+ export function validateVariableNotSet(allNodes, allEdges, knownIds, canvasState, options = {}) {
1297
+ if (options.isCaseManagement) return []; // frontend skips (VariableUtil.ts:826-828)
1298
+ const errors = [];
1299
+ const nodeById = new Map(allNodes.map((n) => [n.id, n]));
1300
+
1301
+ // Root variable identifiers (id + canonicalId + name) — globally available.
1302
+ // `name` included for the same port-consistency reason as nodeOutputVariableIds.
1303
+ const rootVarIds = [];
1304
+ const rv = canvasState?.root?.data?.uipath?.variables;
1305
+ for (const v of [...(rv?.inputs ?? []), ...(rv?.inputOutputs ?? [])]) {
1306
+ if (v.id) rootVarIds.push(v.id);
1307
+ if (v.canonicalId) rootVarIds.push(v.canonicalId);
1308
+ if (v.name) rootVarIds.push(v.name);
1309
+ }
1310
+
1311
+ const check = (elementId, elementType, expression) => {
1312
+ const declared = declaredVarRefsInExpression(expression, knownIds);
1313
+ if (!declared.length) return;
1314
+ const available = availableVarIdsForElement(elementId, elementType, allNodes, allEdges, rootVarIds, nodeById);
1315
+ for (const ref of declared) {
1316
+ if (!available.has(ref)) {
1317
+ errors.push({
1318
+ code: "VARIABLE_NOT_SET",
1319
+ message: `Variable '${ref}' is not set at this point in the flow.`,
1320
+ severity: SEVERITY.WARNING,
1321
+ elementId,
1322
+ });
1323
+ }
1324
+ }
1325
+ };
1326
+
1327
+ for (const edge of allEdges) {
1328
+ if (typeof edge.data?.conditionExpression === "string") check(edge.id, "edge", edge.data.conditionExpression);
1329
+ }
1330
+ for (const node of allNodes) {
1331
+ const uipath = node.data?.uipath;
1332
+ if (!uipath) continue;
1333
+ const expr = varExpressionsForNode(uipath).join(" ; ");
1334
+ if (expr) check(node.id, "node", expr);
1335
+ }
1336
+ return errors;
1337
+ }
1338
+
1339
+ // ---------------------------------------------------------------------------
1340
+ // Orchestrator: run every rule against one diagram's CanvasState. Mirrors the
1341
+ // per-diagram loop in ValidateBpmnFlowUtils.validateBpmnFlow.
1342
+ // ---------------------------------------------------------------------------
1343
+ export function validateDiagram(diagram, canvasState, options = {}) {
1344
+ const nodes = diagram.nodes;
1345
+ const edges = diagram.edges;
1346
+ const lm = buildValidationLookupMaps(nodes, edges);
1347
+ const errors = [];
1348
+ errors.push(...validateConnections(nodes, edges, lm));
1349
+ errors.push(...validateMessageFlowCrossPool(nodes, edges, lm));
1350
+ errors.push(...validateSequenceFlowSubProcessCrossing(nodes, edges, lm));
1351
+ errors.push(...validateSequenceFlowPoolCrossing(nodes, edges, lm));
1352
+ errors.push(...validateConditionalSequenceFlow(nodes, edges, lm));
1353
+ errors.push(...validateSuperfluousGateway(nodes, edges, lm));
1354
+ errors.push(...validateFakeJoins(nodes, edges, lm));
1355
+ errors.push(...validateSingleBlankStartEvent(nodes, edges, lm));
1356
+ errors.push(...validateEventSubProcessStart(nodes, edges, lm));
1357
+ errors.push(...validateSingleStartEventInEventSubProcess(nodes, edges, lm));
1358
+ errors.push(...validateErrorBoundaryEvents(nodes, canvasState));
1359
+ errors.push(...validateDuplicateErrorBoundaryEvents(nodes, canvasState));
1360
+ errors.push(...validateErrorEndEvents(nodes));
1361
+ errors.push(...validateDuplicateErrorEventSubprocess(nodes, canvasState, lm));
1362
+ errors.push(...validateRequiredFields(nodes));
1363
+ errors.push(...validateMissingResource(nodes));
1364
+ errors.push(...validateNoAssignmentsInExpressions(nodes, edges));
1365
+ if (options.enableMissingRootVariableValidation) {
1366
+ errors.push(...validateMissingRootVariables(nodes, canvasState));
1367
+ }
1368
+ errors.push(...validateTaskTimerRange(nodes));
1369
+ errors.push(...validateTimerDuration(nodes));
1370
+ return errors;
1371
+ }
1372
+
1373
+ export const RULE_CODES = [
1374
+ "MISSING_CONDITION_EXPRESSION",
1375
+ "INVALID_CONNECTION",
1376
+ "INVALID_CONNECTION_TYPE",
1377
+ "DUPLICATE_ERROR_EVENT_SUBPROCESS",
1378
+ "MULTIPLE_CATCH_ALL_ERROR_EVENT_SUBPROCESS",
1379
+ "START_EVENT_WITHOUT_DEFINITION_IN_EVENT_SUBPROCESS",
1380
+ "INVALID_EVENT_DEFINITION_IN_EVENT_SUBPROCESS",
1381
+ "START_EVENT_WITH_DEFINITION_IN_SUBPROCESS",
1382
+ "ERROR_BOUNDARY_EVENT_EMPTY_ERROR_REF",
1383
+ "ERROR_BOUNDARY_EVENT_REQUIRES_ERROR_CODE",
1384
+ "MULTIPLE_CATCH_ALL_BOUNDARY_EVENTS_ON_TASK",
1385
+ "DUPLICATE_ERROR_BOUNDARY_EVENT_ON_TASK",
1386
+ "ERROR_END_EVENT_MISSING_EXCEPTION",
1387
+ "FAKE_JOIN",
1388
+ "SAME_POOL_MESSAGE_FLOW",
1389
+ "MISSING_RESOURCE",
1390
+ "MISSING_ROOT_VARIABLE",
1391
+ "ASSIGNMENT_NOT_ALLOWED",
1392
+ "EMPTY_REQUIRED_FIELD",
1393
+ "CROSSING_POOL_BOUNDARY",
1394
+ "CROSSING_SUBPROCESS_BOUNDARY",
1395
+ "MULTIPLE_BLANK_START_EVENTS",
1396
+ "MULTIPLE_START_EVENTS_IN_EVENT_SUBPROCESS",
1397
+ "SUPERFLUOUS_GATEWAY",
1398
+ "TASK_TIMER_OUT_OF_RANGE",
1399
+ "TIMER_DURATION_INVALID",
1400
+ "TIMER_DURATION_WEEK_UNSUPPORTED",
1401
+ "VARIABLE_DOES_NOT_EXIST",
1402
+ "VARIABLE_NOT_SET",
1403
+ ];