@salesforce/afv-skills 1.68.0 → 1.70.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 (284) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/data360-code-extension-generate/SKILL.md +160 -252
  63. package/skills/data360-code-extension-generate/references/README.md +34 -172
  64. package/skills/data360-code-extension-generate/references/environment-setup.md +198 -0
  65. package/skills/data360-code-extension-generate/references/mcp-integration.md +36 -0
  66. package/skills/data360-code-extension-generate/references/quick-reference.md +132 -202
  67. package/skills/data360-code-extension-generate/references/run-logs.md +31 -0
  68. package/skills/data360-code-extension-generate/references/schema-discovery.md +45 -0
  69. package/skills/data360-code-extension-generate/references/troubleshooting.md +45 -0
  70. package/skills/data360-code-extension-generate/scripts/check_env.sh +197 -0
  71. package/skills/data360-code-extension-generate/scripts/venv_hook.sh +22 -0
  72. package/skills/dx-devops-work-item-manage/SKILL.md +24 -8
  73. package/skills/dx-devops-work-item-manage/examples/common-workflows.md +32 -0
  74. package/skills/dx-devops-work-item-manage/references/review-api.md +95 -0
  75. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  76. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  77. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  78. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  79. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  80. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  81. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  82. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  83. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  84. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  85. package/skills/dx-org-manage/SKILL.md +12 -12
  86. package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +1 -3
  87. package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +1 -3
  88. package/skills/dx-org-manage/references/opening-org.md +1 -1
  89. package/skills/dx-org-manage/references/scratch-org-operations.md +15 -20
  90. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  91. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  92. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +3 -4
  93. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  94. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  95. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  96. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  97. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  98. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  99. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  100. package/skills/education-cloud-academic-calendar-generate/SKILL.md +2 -2
  101. package/skills/education-cloud-course-catalog-migrate/SKILL.md +1 -1
  102. package/skills/education-cloud-domain-configure/references/domain-features/recruitment-admissions.md +8 -7
  103. package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -0
  104. package/skills/education-cloud-multi-campus-configure/references/error_handling.md +7 -6
  105. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +2 -0
  106. package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +2 -0
  107. package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +1 -1
  108. package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +5 -4
  109. package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +1 -1
  110. package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +1 -1
  111. package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +1 -1
  112. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  113. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  114. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  115. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  116. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  117. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  118. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  119. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  120. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  121. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  122. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  123. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  124. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  125. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  126. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  127. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  128. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  129. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  130. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  131. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  132. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  133. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  134. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  135. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  136. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  137. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  138. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  139. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  140. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  141. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  142. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  143. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  144. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  145. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  146. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  147. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  148. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  149. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  150. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  151. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  152. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  153. package/skills/experience-cms-content-type-generate/SKILL.md +8 -7
  154. package/skills/experience-cms-content-type-generate/references/agent-checklist.md +3 -3
  155. package/skills/experience-cms-content-type-generate/references/anti-patterns.md +2 -2
  156. package/skills/experience-cms-content-type-generate/references/discovery-details.md +1 -1
  157. package/skills/experience-cms-content-type-generate/references/retrieve-and-reconcile.md +5 -9
  158. package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.mjs +10 -0
  159. package/skills/field-service-data-capture-migrate/references/converter-builder-contract.md +2 -2
  160. package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +2 -2
  161. package/skills/field-service-data-capture-migrate/scripts/analyze_flow.py +1 -1
  162. package/skills/field-service-data-capture-migrate/scripts/convert_to_dc_spec.py +1 -1
  163. package/skills/field-service-data-capture-migrate/scripts/fsm_dc_catalog.py +2 -2
  164. package/skills/field-service-data-capture-migrate/scripts/generate_summary.py +2 -2
  165. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  166. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  167. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  168. package/skills/platform-custom-application-generate/SKILL.md +97 -104
  169. package/skills/platform-custom-application-generate/references/app-properties.md +52 -0
  170. package/skills/platform-custom-application-generate/references/app-visibility.md +19 -0
  171. package/skills/platform-custom-application-generate/references/utility-bar.md +55 -0
  172. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  173. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  174. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  175. package/skills/platform-datamask-run/SKILL.md +1 -1
  176. package/skills/platform-datamask-run/references/policy-authoring.md +41 -18
  177. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  178. package/skills/platform-dsar-policy-manage/SKILL.md +7 -6
  179. package/skills/platform-dsar-policy-manage/references/export-and-history.md +10 -8
  180. package/skills/platform-dsar-policy-manage/references/report-format.md +4 -2
  181. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  182. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  183. package/skills/platform-metadata-grounding-get/SKILL.md +7 -7
  184. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  185. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  186. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  187. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  188. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  189. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  190. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  191. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  192. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  193. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  194. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  195. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  196. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  197. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  198. package/skills/platform-report-generate/SKILL.md +29 -8
  199. package/skills/platform-report-generate/references/column-names.md +12 -1
  200. package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
  201. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  202. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  203. package/skills/platform-sharing-rules-generate/SKILL.md +12 -3
  204. package/skills/platform-sharing-rules-generate/references/rule-types.md +1 -0
  205. package/skills/service-agentforce-channel-configure/SKILL.md +6 -3
  206. package/skills/service-agentforce-channel-configure/references/agent-wiring.md +5 -3
  207. package/skills/service-agentforce-channel-configure/references/channel-branch-email.md +24 -15
  208. package/skills/service-agentforce-channel-configure/references/input-validation.md +23 -0
  209. package/skills/service-agentforce-channel-configure/references/live-traffic-gate.md +13 -7
  210. package/skills/service-agentforce-channel-configure/references/queue-resolution.md +3 -1
  211. package/skills/service-agentforce-human-escalation-configure/references/_vendored/input-validation.md +23 -0
  212. package/skills/service-agentforce-human-escalation-configure/references/_vendored/queue-resolution.md +146 -0
  213. package/skills/service-agentforce-human-escalation-configure/references/escalation-mechanism.md +1 -1
  214. package/skills/service-agentforce-human-escalation-configure/scripts/tests/_bootstrap.py +42 -11
  215. package/skills/service-agentforce-human-escalation-configure/scripts/tests/test_escalation_contracts.py +45 -0
  216. package/skills/service-agentforce-human-escalation-configure/scripts/verify-and-configure.sh +23 -9
  217. package/skills/service-de-channel-activate/SKILL.md +10 -10
  218. package/skills/service-de-channel-activate/references/gotchas.md +4 -4
  219. package/skills/service-de-channel-activate/references/phone-verification.md +43 -19
  220. package/skills/service-de-channel-create/SKILL.md +1 -1
  221. package/skills/service-de-channel-create/references/facebook.md +1 -1
  222. package/skills/service-de-channel-create/references/whatsapp.md +33 -6
  223. package/skills/service-de-channel-routing-configure/SKILL.md +5 -1
  224. package/skills/service-de-channel-routing-configure/references/gotchas.md +3 -1
  225. package/skills/service-de-channel-routing-configure/references/named-queue.md +39 -0
  226. package/skills/service-de-channel-settings-configure/SKILL.md +3 -1
  227. package/skills/service-de-channel-settings-configure/references/channel-settings-facets.md +2 -2
  228. package/skills/service-de-channel-settings-configure/references/gotchas.md +12 -1
  229. package/skills/service-de-headless-channel-configure/SKILL.md +68 -74
  230. package/skills/service-de-headless-channel-configure/references/gotchas.md +6 -2
  231. package/skills/service-de-headless-channel-configure/references/inputs.md +19 -0
  232. package/skills/service-de-headless-channel-configure/references/output-envelopes.md +23 -1
  233. package/skills/service-de-headless-channel-configure/references/partial-success.md +1 -0
  234. package/skills/service-de-headless-channel-configure/references/requested-settings.md +55 -0
  235. package/skills/service-de-headless-channel-configure/references/worked-examples.md +35 -1
  236. package/skills/service-digital-engagement-channel-configure/SKILL.md +45 -108
  237. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  238. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  239. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  240. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  241. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  242. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  243. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +17 -21
  244. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  245. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  246. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  247. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  248. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  249. package/skills/service-digital-engagement-deployment-configure/SKILL.md +2 -2
  250. package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +4 -2
  251. package/skills/service-digital-engagement-deployment-configure/scripts/check-api-version.sh +1 -1
  252. package/skills/service-e911-configure/SKILL.md +242 -0
  253. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  254. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  255. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  256. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  257. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  258. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  259. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  260. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  261. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  262. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  263. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  264. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  265. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  266. package/skills/service-omni-command-center-configure/SKILL.md +1 -1
  267. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  268. package/skills/data360-schema-get/SKILL.md +0 -388
  269. package/skills/data360-schema-get/references/README.md +0 -191
  270. package/skills/data360-schema-get/scripts/get_dlo_schema.py +0 -244
  271. package/skills/data360-schema-get/scripts/get_dmo_schema.py +0 -233
  272. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  273. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  274. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  275. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  276. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  277. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  278. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  279. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  280. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  281. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  282. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
  283. package/skills/field-service-prework-brief-deployer-configure/SKILL.md +0 -646
  284. package/skills/field-service-voice-to-form-configure/SKILL.md +0 -650
@@ -11,8 +11,10 @@ Resolve the org's **true max** supported API version and stop if it is below 68.
11
11
  ```bash
12
12
  ORG_API_VERSION=$(sf api request rest --target-org "$ORG" "/services/data" \
13
13
  | python3 -c "import sys, json; print(max((v['version'] for v in json.load(sys.stdin)), key=float))")
14
+ API_VERSION_RE='^[0-9]{2}\.[0-9]$'
15
+ [[ "$ORG_API_VERSION" =~ $API_VERSION_RE ]] || { echo "Org API version '$ORG_API_VERSION' fails the ORG_API_VERSION grammar. Stopping without making changes."; exit 1; }
14
16
 
15
- python3 -c "import sys; sys.exit(0 if float('$ORG_API_VERSION') >= 68.0 else 1)" || {
17
+ python3 -c "import sys; sys.exit(0 if float(sys.argv[1]) >= 68.0 else 1)" "$ORG_API_VERSION" || {
16
18
  echo "Org API version $ORG_API_VERSION is below 68.0 — Agentforce Email-to-Case (BotEmailDefinition) is not available on this org. Stopping without making changes."
17
19
  exit 1
18
20
  }
@@ -53,6 +55,8 @@ Ask the user via `AskUserQuestion`:
53
55
  > *"What email address should receive support emails? This is the address customers will email — e.g. `support@yourcompany.com`.*
54
56
  > *Note: Salesforce will send a verification email to this address. You must click the verification link before inbound emails will be processed."*
55
57
 
58
+ Validate `SUPPORT_EMAIL` against its grammar in `input-validation.md` before any command uses it; if it doesn't match, ask again. Never escape and continue: the value is pasted into the `--values` string below and into SOQL and XML later.
59
+
56
60
  2. Create the `EmailRoutingAddress` record:
57
61
  ```bash
58
62
  sf data create record --target-org $ORG \
@@ -94,7 +98,7 @@ Ask the user via `AskUserQuestion`:
94
98
 
95
99
  ### If using an existing routing address
96
100
 
97
- Set `ROUTING_ADDRESS_ID` to the selected record's `Id` and continue. No provisioning steps needed.
101
+ Set `ROUTING_ADDRESS_ID` to the selected record's `Id` and `SUPPORT_EMAIL` to its `Address`, validate both per `input-validation.md`, and continue. No provisioning steps needed.
98
102
 
99
103
  ---
100
104
 
@@ -145,10 +149,10 @@ This is a surface-only add with no outbound flow, so it is self-contained here
145
149
 
146
150
  3. Republish and activate. The agent is already active at this point (Phase 1), and **publishing a surface/connection change onto an active agent fails** with `We couldn't find the default agent user <username>` — the active version holds the agent user, so it must be released first. Deactivate → publish → activate:
147
151
  ```bash
148
- echo "Y" | sf agent deactivate --api-name {AGENT_DEVELOPER_NAME} --json
149
- sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
150
- sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
151
- echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --json
152
+ echo "Y" | sf agent deactivate --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
153
+ sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
154
+ sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
155
+ echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
152
156
  ```
153
157
 
154
158
  **Batch escalation here to avoid a second publish cycle.** Each surface/connection change on an active agent costs a full deactivate → publish → activate. If the user will also want outbound escalation (Phase 3), wire it in *this* edit instead of republishing again later: resolve the escalation queue and create the outbound `QueueBased` RoutingFlow first (`references/queue-resolution.md`, `references/routing-flow.md`), then add the outbound-route fields to this same `connection service_email:` block (per `references/agent-wiring.md`) before the single publish/activate above — the surface `description` and the outbound route then go live together.
@@ -161,6 +165,8 @@ Verify the block is present in the deployed bundle before continuing. Escalation
161
165
 
162
166
  The `BotEmailDefinition` component links the agent to Service Email (the "Agentforce for Service on Email" feature). Read `references/botemaildefinition.md` in full before this step. Run this only after Step 3 confirmed `connection service_email:` is deployed on the agent.
163
167
 
168
+ Create a private work directory once with `mktemp -d` and use the path it prints as `{WORK_DIR}` in Steps 4c and 4d. Shell variables don't persist between commands, so substitute the literal path. Don't use a fixed `/tmp` path: another local user can create it first and swap the files you deploy.
169
+
164
170
  ### Step 4a — Preflight the save-time gates (fail fast, in Core's order)
165
171
 
166
172
  `BotEmailDefinition`'s save-time validation runs in a fixed order (see `references/botemaildefinition.md`). Check the agent-side gates now so a deploy failure isn't the first signal:
@@ -203,17 +209,17 @@ The agent needs an ASA-valid `EmailTemplate` (`uiType=SFX`, HTML, public, contai
203
209
 
204
210
  Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and `replyAll` (reply-all vs reply-to-sender) from the user. Choose a `DeveloperName`, e.g. `{AgentDevName}_Email_Config`.
205
211
 
206
- 1. Copy `assets/BotEmailDefinition.botEmailDefinition-meta.xml` to `/tmp/sfskills/{DeveloperName}.botEmailDefinition-meta.xml` and substitute `{AGENT_DEVELOPER_NAME}`, `{EMAIL_TEMPLATE_FOLDER}/{EMAIL_TEMPLATE_DEVELOPER_NAME}` (= `EMAIL_TEMPLATE`), `{LABEL}`, `{LEGAL_DISCLAIMER_TEXT}`, `{SIGNATURE_TEXT}`, and `replyAll`.
212
+ 1. Copy `assets/BotEmailDefinition.botEmailDefinition-meta.xml` to `{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml` and substitute `{AGENT_DEVELOPER_NAME}`, `{EMAIL_TEMPLATE_FOLDER}/{EMAIL_TEMPLATE_DEVELOPER_NAME}` (= `EMAIL_TEMPLATE`), `{LABEL}`, `{LEGAL_DISCLAIMER_TEXT}`, `{SIGNATURE_TEXT}`, and `replyAll`. Make the substitutions with the Edit/Write tools, never `sed` or a heredoc, and XML-escape the free-text values (`input-validation.md`).
207
213
 
208
214
  2. Validate:
209
215
  ```bash
210
- python3 scripts/validate-botemaildefinition.py /tmp/sfskills/{DeveloperName}.botEmailDefinition-meta.xml
216
+ python3 scripts/validate-botemaildefinition.py "{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml"
211
217
  ```
212
218
  Resolve any errors before deploying.
213
219
 
214
220
  3. Assemble the metadata-format package and deploy (source deploy naming the type directly fails — it is absent from the SDR registry):
215
221
  ```bash
216
- MDDIR=/tmp/sfskills/botemaildef-mdapi
222
+ MDDIR="{WORK_DIR}/botemaildef-mdapi"
217
223
  mkdir -p "$MDDIR/botEmailDefinitions"
218
224
  # package.xml: from assets/mdapi-package.xml, substituting the member name and
219
225
  # {API_VERSION} = ORG_API_VERSION from the Precondition.
@@ -221,7 +227,7 @@ Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and
221
227
  -e "s/{API_VERSION}/{ORG_API_VERSION}/" \
222
228
  assets/mdapi-package.xml > "$MDDIR/package.xml"
223
229
  # component file: same XML as the source file, WITHOUT the -meta.xml suffix
224
- cp /tmp/sfskills/{DeveloperName}.botEmailDefinition-meta.xml \
230
+ cp "{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml" \
225
231
  "$MDDIR/botEmailDefinitions/{DeveloperName}.botEmailDefinition"
226
232
  sf project deploy start --metadata-dir "$MDDIR" --target-org $ORG --json
227
233
  ```
@@ -233,10 +239,11 @@ Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and
233
239
 
234
240
  In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EMAIL}` from Step 1): the `botEmailDefinition` binding to `BOT_EMAIL_DEFINITION_NAME`, **plus** the Step 2 inbound-routing fields — either `caseOwner` = `BOT_USER_USERNAME` + `caseOwnerType: User` (Path A), or `routingFlow` = `INBOUND_FLOW_DEVELOPER_NAME` + `fallbackQueue` = `QUEUE_DEVELOPER_NAME` (Path B). `casePriority` is **required** on every routing address — carry it, or the deploy fails with `Missing casePriority`. A settings deploy **replaces** the `emailToCase.routingAddresses` collection, so the deployed file must carry **every** existing address — dropping one unbinds it. There is no pre-existing `Case.settings-meta.xml` in the project; you must generate it from the current org state first.
235
241
 
236
- 1. **Read the current CaseSettings** to get the full `emailToCase` block, including all routing addresses:
242
+ 1. **Read the current CaseSettings** to get the full `emailToCase` block, including all routing addresses. Keep the response as the pre-deploy snapshot; the read-back check after point 3 compares against it:
237
243
  ```bash
238
244
  sf api request rest -o "$ORG" --method GET \
239
- "/services/data/v{ORG_API_VERSION}/tooling/query?q=SELECT+Metadata+FROM+CaseSettings+LIMIT+1"
245
+ "/services/data/v{ORG_API_VERSION}/tooling/query?q=SELECT+Metadata+FROM+CaseSettings+LIMIT+1" \
246
+ > "{WORK_DIR}/casesettings-before.json"
240
247
  ```
241
248
 
242
249
  2. **Write `Case.settings-meta.xml`** to the project's settings directory (e.g. `force-app/main/default/settings/Case.settings-meta.xml`). Include the `emailToCase` toggles and **one `<routingAddresses>` entry per existing address** from the read. For each address, carry over **every** field the read returned except the read-only `emailServicesAddress`/`isVerified` — preserve whatever the org actually set (e.g. `addressType`, `caseOrigin`, `emailAddress`, `routingName`, and fields like `casePriority`), rather than a fixed subset. On the entry whose `emailAddress` matches `{SUPPORT_EMAIL}`, add `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` plus the Step 2 path's fields. The example below shows **Path A** (case owner); for **Path B**, swap in `<routingFlow>`+`<fallbackQueue>` instead:
@@ -259,14 +266,16 @@ In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EM
259
266
  <!-- Path B: replace <caseOwner>/<caseOwnerType> with
260
267
  <fallbackQueue>{QUEUE_DEVELOPER_NAME}</fallbackQueue> + <routingFlow>{INBOUND_FLOW_DEVELOPER_NAME}</routingFlow>.
261
268
  casePriority is required. Include whatever else the read returned (minus emailServicesAddress/isVerified).
262
- Repeat <routingAddresses> for every OTHER existing address, without botEmailDefinition/caseOwner/routingFlow. -->
269
+ Repeat <routingAddresses> for every OTHER existing address, carrying every field over exactly as read
270
+ (including any botEmailDefinition, caseOwner, caseOwnerType, routingFlow, fallbackQueue, casePriority).
271
+ Only the target address changes. -->
263
272
  </emailToCase>
264
273
  </CaseSettings>
265
274
  ```
266
275
 
267
276
  3. **Deploy in metadata format** so the version comes from the manifest — do **not** mutate `sfdx-project.json`. A source deploy of `Settings:Case` reads `sourceApiVersion` (which `--api-version` does not override), so pinning it there would persist to every later deploy in the user's project. Assemble a metadata-format package versioned at `ORG_API_VERSION` (already ≥68.0 from the Precondition — `botEmailDefinition` on a routing address needs v68.0+):
268
277
  ```bash
269
- MDDIR=/tmp/sfskills/casesettings-mdapi
278
+ MDDIR="{WORK_DIR}/casesettings-mdapi"
270
279
  mkdir -p "$MDDIR/settings"
271
280
  # package.xml: from assets/settings-mdapi-package.xml, {API_VERSION} = ORG_API_VERSION.
272
281
  sed -e "s/{API_VERSION}/{ORG_API_VERSION}/" \
@@ -276,7 +285,7 @@ In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EM
276
285
  sf project deploy start --metadata-dir "$MDDIR" --target-org $ORG --json
277
286
  ```
278
287
 
279
- Verify the read-back (`emailToCase.routingAddresses`): the **set of `emailAddress` values matches the pre-deploy set** — not just that the count is unchanged, since a dropped-and-added swap preserves the count — and the target address (`{SUPPORT_EMAIL}`) now carries `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` and the chosen path's fields (`<caseOwner>` with `caseOwnerType` `User`, or `<routingFlow>`+`<fallbackQueue>`). If any pre-deploy address is missing from the read-back, stop and surface it — a live routing address was unbound.
288
+ Verify the read-back (`emailToCase.routingAddresses`): the **set of `emailAddress` values matches the pre-deploy set** — not just that the count is unchanged, since a dropped-and-added swap preserves the count — and the target address (`{SUPPORT_EMAIL}`) now carries `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` and the chosen path's fields (`<caseOwner>` with `caseOwnerType` `User`, or `<routingFlow>`+`<fallbackQueue>`). If any pre-deploy address is missing from the read-back, stop and surface it — a live routing address was unbound. Then compare every **non-target** address field by field with `casesettings-before.json` (including `botEmailDefinition`, `caseOwner`, `caseOwnerType`, `routingFlow`, `fallbackQueue`, and `casePriority`). If any field changed, stop and report the drift — another address's live routing was altered.
280
289
 
281
290
  Branch C is complete once the binding is verified. Outbound escalation is added via Phase 3 (`agent-wiring.md`) exactly like the other channels — offer it rather than skipping it (the user can decline; it does not block inbound completion). If you already batched the outbound route into the Step 3 `connection service_email:` block, escalation is done — just confirm `outboundRouteName`/`outboundRouteType` round-tripped (per `agent-wiring.md`) instead of republishing.
282
291
 
@@ -0,0 +1,23 @@
1
+ # Input validation (before any command)
2
+
3
+ Every `{PLACEHOLDER}` in this skill's commands is pasted, unescaped, into a shell string, a SOQL literal, or metadata XML. A stray `'`, `;`, `$(...)`, or `<` in a value would rewrite the command or the deployed file. Check each value against its grammar before the first command that uses it. This covers values the user types and values read back from the org (Ids, `Address`, `Queue.Name`, the org's username and API version).
4
+
5
+ On a mismatch, stop and ask the user for a corrected value. Never escape and continue: an escaped value that reaches the org is still not the name the user meant. For a value read back from the org, say which record failed; when adopting an existing queue, offer to create a new one instead.
6
+
7
+ | Value | Grammar |
8
+ |---|---|
9
+ | DeveloperName / API name: `AGENT_DEVELOPER_NAME`, `CHANNEL_DEVELOPER_NAME`, `QUEUE_DEVELOPER_NAME`, and every flow or `BotEmailDefinition` name | `^[A-Za-z][A-Za-z0-9_]{0,79}$` |
10
+ | Record Id: `BOT_ID`, `BOT_USER_ID`, `CHAN_ID`, `QUEUE_ID`, `ROUTING_ADDRESS_ID`, `CASE_SETTINGS_ID` | `^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$` |
11
+ | Queue label: `QUEUE_NAME` (typed, or an existing queue's `Name`) | `^[A-Za-z0-9][A-Za-z0-9 _.-]{0,79}$` |
12
+ | `CAPACITY_PERCENTAGE` | `^[0-9]{1,3}$` (an integer from the `queue-resolution.md` table) |
13
+ | `ORG_API_VERSION` | `^[0-9]{2}\.[0-9]$` |
14
+ | `SUPPORT_EMAIL` | `^[A-Za-z0-9][A-Za-z0-9._%+-]*@[A-Za-z0-9][A-Za-z0-9.-]*\.[A-Za-z]{2,}$` |
15
+ | `ORG` (alias or username), `ORG_USERNAME` | `^[A-Za-z0-9][A-Za-z0-9._@+-]*$` |
16
+
17
+ None of these grammars admits a quote, `;`, `$`, backtick, `|`, `&`, `<`, or `>`, and none lets a value start with `-`, so a matching value can't escape its shell, SOQL, `sed`, or XML context or be read as a CLI option. Only `QUEUE_NAME` admits a space, and every command quotes it.
18
+
19
+ `ORG_USERNAME` and `ORG_API_VERSION` are captured into a shell variable and used in the same block, so their commands check the grammar inline with `[[ ... =~ ... ]]` before first use.
20
+
21
+ ## Free text
22
+
23
+ Values with no grammar above can't be passed through the shell: labels other than `QUEUE_NAME`, `legalDisclaimer`, `signature`, `routingName`, escalation messages, and the bot user's username (`BOT_USER_USERNAME`). Write them into the metadata file with the Edit/Write tools, XML-escaping `&` → `&amp;`, `<` → `&lt;`, `>` → `&gt;`, `"` → `&quot;`, and `'` → `&apos;`. A value that must reach a shell command needs a grammar in the table first.
@@ -1,11 +1,12 @@
1
1
  # Live-traffic warning gate (Phase 2)
2
2
 
3
- Runs once, before any branch, whenever Phase 2 begins. Prevents an unattended re-route of live traffic on a channel that already has active inbound routing.
3
+ Runs once per Phase 2, before the first step that changes routing: at the start of Branch A or B, and in Branch C right after the Step 1 address choice, since whether routing is live depends on which address is chosen (Steps 0–1 bind nothing to the agent). Prevents an unattended re-route of live traffic on a channel that already has active inbound routing.
4
4
 
5
5
  ## Detect existing routing
6
6
 
7
7
  - **Branch A (Enhanced Chat / Enhanced Messaging):** retrieve the MessagingChannel and inspect `SessionHandlerType`. If it is non-empty, routing is live.
8
- - **Branches B/C (Voice / Email-to-Case):** query `FlowDefinitionView WHERE ProcessType='RoutingFlow'` for any flow assigned to this service channel with a non-null `ActiveVersionId`.
8
+ - **Branch B (Voice):** routing is live if the `PstnVoice` MessagingChannel already has a non-null `SessionHandlerId`, or if `FlowDefinitionView WHERE ProcessType='RoutingFlow'` shows a flow assigned to this service channel with a non-null `ActiveVersionId`.
9
+ - **Branch C (Email-to-Case):** run this check after the Step 1 address choice in `channel-branch-email.md`. An **existing** routing address chosen there is live: it already turns inbound email into cases, so changing its BotEmailDefinition, owner, or flow re-routes them. A **new** address created in Step 1 is not live.
9
10
 
10
11
  If the channel has no existing routing, skip this gate entirely and proceed directly to the branch.
11
12
 
@@ -41,10 +42,11 @@ If `AskUserQuestion` returns without a clear selection — timeout, empty answer
41
42
 
42
43
  ## If the user chooses "Set up, then wire manually"
43
44
 
44
- Set `DEFER_INBOUND_ROUTING=true` and continue:
45
+ Set `DEFER_INBOUND_ROUTING=true` and continue. Steps that create new, unbound components still run; every step that points the live channel or routing address at the agent is skipped:
45
46
 
46
- - **Branch A:** create the queue normally. Skip the `sf project deploy start` for the MessagingChannel entirely.
47
- - **Branches B/C:** create the queue and write + deploy the RoutingFlow normally (the flow is safe to deploy — it only becomes live when assigned to the channel). Skip any step that assigns the flow as the active routing flow for the channel.
47
+ - **Branch A:** create the queue normally. Skip Steps 3–5: (1) the `sf project deploy start` for the MessagingChannel, (2) the Data API PATCH that binds `SessionHandlerId`/`FallbackQueueId` on the channel, and (3) the verify that expects them set.
48
+ - **Branch B:** create the queue and write + deploy the RoutingFlow normally (the flow is safe to deploy — it only becomes live when assigned to the channel). Skip `channel-branch-voice.md` Step 4, the MessagingChannel deploy that assigns the flow to the channel.
49
+ - **Branch C:** create the queue, write + deploy the RoutingFlow (Omni-Channel path), and deploy the BotEmailDefinition (Step 4c) normally; none takes effect until a routing address references it. Skip: (1) the Step 4d Settings:Case metadata deploy that binds `botEmailDefinition`, `caseOwner`, or `routingFlow` on the routing address, and (2) any direct Tooling API PATCH that sets those fields on the target address.
48
50
 
49
51
  After Phase 2 completes, if `DEFER_INBOUND_ROUTING=true`, print manual wiring instructions before the Phase 3 prompt.
50
52
 
@@ -81,6 +83,10 @@ sf data query -o {ORG} --json \
81
83
  -q "SELECT SessionHandlerId, FallbackQueueId FROM MessagingChannel WHERE Id='${CHAN_ID}'"
82
84
  ```
83
85
 
84
- ### Branches B/C — activate when ready
86
+ ### Branch B — activate when ready
85
87
 
86
- > The RoutingFlow `{FLOW_DEVELOPER_NAME}` is deployed and active. To assign it as the inbound routing flow, go to **Setup → Omni-Channel → Service Channels** and point the channel at this flow — or re-run this skill against the same channel; the existing flow will be detected and reused, and only the channel assignment step will run.
88
+ > The RoutingFlow `{FLOW_DEVELOPER_NAME}` is deployed and active. To assign it as the inbound routing flow, run `channel-branch-voice.md` Step 4 (the MessagingChannel deploy that sets `sessionHandlerFlow`) — or re-run this skill against the same channel; the existing flow will be detected and reused, and only the channel assignment step will run.
89
+
90
+ ### Branch C — activate when ready
91
+
92
+ > The BotEmailDefinition `{BOT_EMAIL_DEFINITION_NAME}` (and, on the Omni-Channel path, the RoutingFlow `{INBOUND_FLOW_DEVELOPER_NAME}`) is deployed but not yet bound to `{SUPPORT_EMAIL}`. To cut over, run `channel-branch-email.md` Step 4d against that address. Re-read CaseSettings first, because addresses may have changed since setup, and carry every other address over exactly as read.
@@ -15,7 +15,7 @@ sf data query --target-org $ORG --json \
15
15
 
16
16
  ## Step 2 — Present to user via AskUserQuestion
17
17
 
18
- - **One or more found** → present each as an option: `{Queue.Name} ({Queue.DeveloperName})`, plus a final option *"Create a new queue"*. If the user picks an existing queue, capture its `DeveloperName` and `Id` and skip queue creation.
18
+ - **One or more found** → present each as an option: `{Queue.Name} ({Queue.DeveloperName})`, plus a final option *"Create a new queue"*. If the user picks an existing queue, capture its `Name`, `DeveloperName`, and `Id` as `QUEUE_NAME`, `QUEUE_DEVELOPER_NAME`, and `QUEUE_ID`, validate all three per [input-validation.md](input-validation.md), and skip queue creation. If one fails its grammar, don't use that queue; offer to create a new one.
19
19
  - **Zero found** → inform the user no compatible queue exists; proceed directly to create one.
20
20
 
21
21
  ## Step 3 — Create a new queue (if needed)
@@ -46,6 +46,8 @@ sf data create record --target-org $ORG \
46
46
  ```bash
47
47
  ORG_USERNAME=$(sf org display --target-org $ORG --json \
48
48
  | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['username'])")
49
+ UNAME_RE='^[A-Za-z0-9][A-Za-z0-9._@+-]*$'
50
+ [[ "$ORG_USERNAME" =~ $UNAME_RE ]] || { echo "Org username '$ORG_USERNAME' fails the ORG_USERNAME grammar. Stopping."; exit 1; }
49
51
  RUNNING_USER_ID=$(sf data query --target-org $ORG --json \
50
52
  --query "SELECT Id FROM User WHERE Username='$ORG_USERNAME'" \
51
53
  | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
@@ -0,0 +1,23 @@
1
+ # Input validation (before any command)
2
+
3
+ Every `{PLACEHOLDER}` in this skill's commands is pasted, unescaped, into a shell string, a SOQL literal, or metadata XML. A stray `'`, `;`, `$(...)`, or `<` in a value would rewrite the command or the deployed file. Check each value against its grammar before the first command that uses it. This covers values the user types and values read back from the org (Ids, `Address`, `Queue.Name`, the org's username and API version).
4
+
5
+ On a mismatch, stop and ask the user for a corrected value. Never escape and continue: an escaped value that reaches the org is still not the name the user meant. For a value read back from the org, say which record failed; when adopting an existing queue, offer to create a new one instead.
6
+
7
+ | Value | Grammar |
8
+ |---|---|
9
+ | DeveloperName / API name: `AGENT_DEVELOPER_NAME`, `CHANNEL_DEVELOPER_NAME`, `QUEUE_DEVELOPER_NAME`, and every flow or `BotEmailDefinition` name | `^[A-Za-z][A-Za-z0-9_]{0,79}$` |
10
+ | Record Id: `BOT_ID`, `BOT_USER_ID`, `CHAN_ID`, `QUEUE_ID`, `ROUTING_ADDRESS_ID`, `CASE_SETTINGS_ID` | `^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$` |
11
+ | Queue label: `QUEUE_NAME` (typed, or an existing queue's `Name`) | `^[A-Za-z0-9][A-Za-z0-9 _.-]{0,79}$` |
12
+ | `CAPACITY_PERCENTAGE` | `^[0-9]{1,3}$` (an integer from the `queue-resolution.md` table) |
13
+ | `ORG_API_VERSION` | `^[0-9]{2}\.[0-9]$` |
14
+ | `SUPPORT_EMAIL` | `^[A-Za-z0-9][A-Za-z0-9._%+-]*@[A-Za-z0-9][A-Za-z0-9.-]*\.[A-Za-z]{2,}$` |
15
+ | `ORG` (alias or username), `ORG_USERNAME` | `^[A-Za-z0-9][A-Za-z0-9._@+-]*$` |
16
+
17
+ None of these grammars admits a quote, `;`, `$`, backtick, `|`, `&`, `<`, or `>`, and none lets a value start with `-`, so a matching value can't escape its shell, SOQL, `sed`, or XML context or be read as a CLI option. Only `QUEUE_NAME` admits a space, and every command quotes it.
18
+
19
+ `ORG_USERNAME` and `ORG_API_VERSION` are captured into a shell variable and used in the same block, so their commands check the grammar inline with `[[ ... =~ ... ]]` before first use.
20
+
21
+ ## Free text
22
+
23
+ Values with no grammar above can't be passed through the shell: labels other than `QUEUE_NAME`, `legalDisclaimer`, `signature`, `routingName`, escalation messages, and the bot user's username (`BOT_USER_USERNAME`). Write them into the metadata file with the Edit/Write tools, XML-escaping `&` → `&amp;`, `<` → `&lt;`, `>` → `&gt;`, `"` → `&quot;`, and `'` → `&apos;`. A value that must reach a shell command needs a grammar in the table first.
@@ -0,0 +1,146 @@
1
+ # Queue resolution
2
+
3
+ Run this before any channel wiring. The fallback queue must exist and have the correct `QueueSobject` record for the channel type's SobjectType.
4
+
5
+ ## Step 1 — Query existing compatible queues
6
+
7
+ Determine the SobjectType from the channel type (see `references/channel-types.md`), then query:
8
+
9
+ ```bash
10
+ sf data query --target-org $ORG --json \
11
+ --query "SELECT Queue.Name, Queue.DeveloperName, Queue.Id
12
+ FROM QueueSobject
13
+ WHERE SobjectType='{SOBJECT_TYPE}'"
14
+ ```
15
+
16
+ ## Step 2 — Present to user via AskUserQuestion
17
+
18
+ - **One or more found** → present each as an option: `{Queue.Name} ({Queue.DeveloperName})`, plus a final option *"Create a new queue"*. If the user picks an existing queue, capture its `Name`, `DeveloperName`, and `Id` as `QUEUE_NAME`, `QUEUE_DEVELOPER_NAME`, and `QUEUE_ID`, validate all three per [input-validation.md](input-validation.md), and skip queue creation. If one fails its grammar, don't use that queue; offer to create a new one.
19
+ - **Zero found** → inform the user no compatible queue exists; proceed directly to create one.
20
+
21
+ ## Step 3 — Create a new queue (if needed)
22
+
23
+ **Naming:** `{ChannelTypeLabel} Queue` / DeveloperName `{Channel_Type_Label}_Queue`
24
+
25
+ Examples:
26
+ - Voice → `Voice Queue` / `Voice_Queue`
27
+ - Enhanced Chat → `Enhanced Chat Queue` / `Enhanced_Chat_Queue`
28
+ - Email → `Email Queue` / `Email_Queue`
29
+
30
+ ### 1. Create the Group record
31
+ ```bash
32
+ QUEUE_ID=$(sf data create record --target-org $ORG \
33
+ --sobject Group \
34
+ --values "Type='Queue' Name='{QUEUE_NAME}' DeveloperName='{QUEUE_DEVELOPER_NAME}'" \
35
+ --json | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['id'])")
36
+ ```
37
+
38
+ ### 2. Grant queue access to the correct SobjectType
39
+ ```bash
40
+ sf data create record --target-org $ORG \
41
+ --sobject QueueSobject \
42
+ --values "QueueId='$QUEUE_ID' SobjectType='{SOBJECT_TYPE}'"
43
+ ```
44
+
45
+ ### 3. Add the running user as a queue member
46
+ ```bash
47
+ ORG_USERNAME=$(sf org display --target-org $ORG --json \
48
+ | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['username'])")
49
+ UNAME_RE='^[A-Za-z0-9][A-Za-z0-9._@+-]*$'
50
+ [[ "$ORG_USERNAME" =~ $UNAME_RE ]] || { echo "Org username '$ORG_USERNAME' fails the ORG_USERNAME grammar. Stopping."; exit 1; }
51
+ RUNNING_USER_ID=$(sf data query --target-org $ORG --json \
52
+ --query "SELECT Id FROM User WHERE Username='$ORG_USERNAME'" \
53
+ | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
54
+ sf data create record --target-org $ORG \
55
+ --sobject GroupMember \
56
+ --values "GroupId='$QUEUE_ID' UserOrGroupId='$RUNNING_USER_ID'"
57
+ ```
58
+
59
+ ## Step 4 — Resolve or create a Routing Configuration
60
+
61
+ The queue must have a `QueueRoutingConfig` so Omni-Channel knows how to handle capacity. `QueueRoutingConfig` has **no `QueueId` column** — the link is the reverse direction (the queue's `Group` record points at the config via `QueueRoutingConfigId`), so resolve an existing config through the `Group` record, not by filtering the config on a queue Id:
62
+
63
+ ```bash
64
+ sf data query --target-org $ORG --json \
65
+ --query "SELECT QueueRoutingConfigId FROM Group WHERE Id='{QUEUE_ID}'"
66
+ ```
67
+
68
+ - **`QueueRoutingConfigId` is non-null** → the queue already has a routing config; use it as-is and skip creation.
69
+ - **`QueueRoutingConfigId` is null** → create one using the capacity percentage for the channel type, then link it to the queue:
70
+
71
+ | Channel type | `CapacityPercentage` |
72
+ |---|---|
73
+ | Enhanced Chat / Enhanced Messaging | `50` |
74
+ | Voice | `100` |
75
+ | Email-to-Case | `25` |
76
+
77
+ All use `RoutingModel: LeastActive`.
78
+
79
+ `QueueRoutingConfig` uses `MasterLabel` (there is **no `Name` field**), has **no `QueueId`**, and **requires `RoutingPriority`** — a non-nillable integer with no default; set `1`. Create the config standalone, capture its Id, then point the queue's `Group` record at it:
80
+
81
+ ```bash
82
+ QRC_ID=$(sf data create record --target-org $ORG \
83
+ --sobject QueueRoutingConfig \
84
+ --values "MasterLabel='{QUEUE_NAME} Routing' DeveloperName='{QUEUE_DEVELOPER_NAME}_Routing' CapacityPercentage={CAPACITY_PERCENTAGE} RoutingModel='LeastActive' RoutingPriority=1 IsAttributeBased=false" \
85
+ --json | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['id'])")
86
+
87
+ # Link is the REVERSE direction — the queue's Group record points at the config:
88
+ sf data update record --target-org $ORG \
89
+ --sobject Group --record-id "{QUEUE_ID}" \
90
+ --values "QueueRoutingConfigId='$QRC_ID'"
91
+ ```
92
+
93
+ Verify the queue now references the config:
94
+ ```bash
95
+ sf data query --target-org $ORG --json \
96
+ --query "SELECT Id, QueueRoutingConfigId FROM Group WHERE Id='{QUEUE_ID}'"
97
+ ```
98
+ `QueueRoutingConfigId` must be non-null.
99
+
100
+ ## Step 5 — Capture for use in Phase 2
101
+
102
+ Store:
103
+ - `QUEUE_DEVELOPER_NAME` — used in the MessagingChannel XML (Branch A) or RoutingFlow `queueId` lookup (Branches B/C)
104
+ - `QUEUE_NAME` (the `Name` field, e.g. `Voice Queue`) — used as `queueLabel` in the RoutingFlow XML
105
+ - `QUEUE_ID` (18-char record Id) — used as `queueId` in the RoutingFlow XML
106
+
107
+ If an existing queue was chosen, query its Id if not already available:
108
+ ```bash
109
+ QUEUE_ID=$(sf data query --target-org $ORG --json \
110
+ --query "SELECT Id FROM Group WHERE Type='Queue' AND DeveloperName='{QUEUE_DEVELOPER_NAME}'" \
111
+ | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Step 6 — Escalation queue resolution (Phase 3 only)
117
+
118
+ Run this step when the user opts into outbound escalation (Branches A/B). The escalation queue is the human queue that receives escalated conversations — it may be the same as the inbound fallback queue, or a different one.
119
+
120
+ ### Check whether other compatible queues exist
121
+
122
+ Query for queues with the correct SobjectType, excluding the inbound fallback queue already selected:
123
+
124
+ ```bash
125
+ sf data query --target-org $ORG --json \
126
+ --query "SELECT Queue.Name, Queue.DeveloperName, Queue.Id
127
+ FROM QueueSobject
128
+ WHERE SobjectType='{SOBJECT_TYPE}'
129
+ AND Queue.DeveloperName != '{QUEUE_DEVELOPER_NAME}'"
130
+ ```
131
+
132
+ ### Branch on results
133
+
134
+ **Zero other queues exist** → no choice to offer; reuse the inbound fallback queue. Set `ESCALATION_QUEUE_DEVELOPER_NAME = QUEUE_DEVELOPER_NAME` and `ESCALATION_QUEUE_ID = QUEUE_ID`. Continue without asking.
135
+
136
+ **One or more other queues exist** → ask the user via `AskUserQuestion`:
137
+
138
+ > *"Which queue should receive escalated conversations from the agent?"*
139
+ > - *Use the same queue as inbound fallback: `{QUEUE_NAME}` ({QUEUE_DEVELOPER_NAME})* **(Recommended)**
140
+ > - *{OtherQueue.Name} ({OtherQueue.DeveloperName})* — one option per additional compatible queue
141
+
142
+ If the user picks the fallback: `ESCALATION_QUEUE_DEVELOPER_NAME = QUEUE_DEVELOPER_NAME`, `ESCALATION_QUEUE_ID = QUEUE_ID`.
143
+
144
+ If the user picks a different queue: capture its `DeveloperName` and `Id` as `ESCALATION_QUEUE_DEVELOPER_NAME` and `ESCALATION_QUEUE_ID`.
145
+
146
+ Use `ESCALATION_QUEUE_DEVELOPER_NAME` (not `QUEUE_DEVELOPER_NAME`) when writing the outbound RoutingFlow XML in Phase 3.
@@ -51,7 +51,7 @@ After deploy, `FlowDefinitionView.ActiveVersionId` for the flow must be non-null
51
51
 
52
52
  The escalation target is a queue whose `QueueSobject` includes the routed context object
53
53
  (`MessagingSession` by default, for Enhanced Chat / MIAW), plus a `QueueRoutingConfig`. See
54
- [queue-resolution.md](../../service-agentforce-channel-configure/references/queue-resolution.md)
54
+ [queue-resolution.md](_vendored/queue-resolution.md)
55
55
  for the create-or-adopt recipe. Provision any broader routing infrastructure through an
56
56
  approved Omni setup workflow before running this skill.
57
57
 
@@ -12,16 +12,25 @@ from pathlib import Path
12
12
  SKILLS_ROOT = Path(__file__).resolve().parents[3]
13
13
 
14
14
 
15
- def _find_flat_skills_root(start: Path) -> Path:
16
- """Walk up from this file to the repo's flat skills/ root, which bundles every skill
17
- exactly once. Cross-skill references that aren't part of this skill's own plugin roster
18
- (like the ITSM coordinator's verdict script below) must resolve here, not under
19
- SKILLS_ROOT, since a plugin mirror's SKILLS_ROOT only contains its own bundled skills."""
15
+ _COORDINATOR = "service-itsm-agentic-setup-agentforce-coordinate"
16
+
17
+
18
+ def _find_flat_skills_root(start: Path) -> Path | None:
19
+ """Walk up from this file to the directory holding the ITSM coordinator skill: the repo's
20
+ flat skills/ root, or its team directory under contributed-skills/. Cross-skill references
21
+ that aren't part of this skill's own plugin roster (like the coordinator's verdict script
22
+ below) must resolve here, not under SKILLS_ROOT, since a plugin mirror's SKILLS_ROOT only
23
+ contains its own bundled skills. The walk stops at the repo root so a stray skills/ tree in
24
+ a parent directory is never executed; None means the coordinator isn't in this checkout."""
20
25
  for parent in start.parents:
21
- candidate = parent / "skills" / "service-itsm-agentic-setup-agentforce-coordinate"
22
- if candidate.is_dir():
26
+ if (parent / "skills" / _COORDINATOR).is_dir():
23
27
  return parent / "skills"
24
- raise RuntimeError("could not locate the repo's flat skills/ root")
28
+ for team_copy in sorted((parent / "contributed-skills").glob(f"*/{_COORDINATOR}")):
29
+ if team_copy.is_dir():
30
+ return team_copy.parent
31
+ if (parent / ".git").exists():
32
+ break
33
+ return None
25
34
 
26
35
 
27
36
  FLAT_SKILLS_ROOT = _find_flat_skills_root(Path(__file__).resolve())
@@ -196,7 +205,15 @@ start_agent support_agent:
196
205
  AGENT
197
206
  fi
198
207
  elif printf '%s' "$args" | grep -q "GenAiPlugin:"; then
199
- echo '<canEscalate>true</canEscalate>' > "$dir/plugin.xml"
208
+ if [ "${FAKE_AUTHORING_FIXTURE:-0}" = "1" ]; then
209
+ # Metadata-format bundle whose GenAiPlugin has no XSD anchor, so the canEscalate patcher
210
+ # refuses after the deactivate and the rollback path runs.
211
+ mkdir -p "$dir/genAiPlugins"
212
+ echo '<?xml version="1.0"?><Package xmlns="x"></Package>' > "$dir/package.xml"
213
+ printf '<?xml version="1.0"?>\n<GenAiPlugin xmlns="x"></GenAiPlugin>\n' > "$dir/genAiPlugins/Escalate_Topic.genAiPlugin"
214
+ else
215
+ echo '<canEscalate>true</canEscalate>' > "$dir/plugin.xml"
216
+ fi
200
217
  elif printf '%s' "$args" | grep -q "GenAiPlannerBundle:"; then
201
218
  [ "$TARGET_MODEL" = "classic" ] || [ "$TARGET_MODEL" = "both" ] || exit 1
202
219
  cat > "$dir/bundle.xml" <<BXML
@@ -215,14 +232,28 @@ BXML
215
232
  echo '{"status":0,"result":{"success":true}}'; exit 0;;
216
233
  "project deploy")
217
234
  echo '{"status":0,"result":{"success":true,"files":[{"fullName":"Human_Escalation_Outbound_Flow","type":"Flow","state":"Created"}]}}'; exit 0;;
235
+ "agent activate")
236
+ # FAKE_ACTIVATE_FAIL=1 → reactivation fails, so a rollback must report the agent left inactive.
237
+ if [ "${FAKE_ACTIVATE_FAIL:-0}" = "1" ]; then
238
+ echo '{"status":1,"message":"FAKE_ACTIVATE_FAILED"}'; exit 1
239
+ fi
240
+ echo '{"status":0,"result":{}}'; exit 0;;
218
241
  *) echo '{"status":0,"result":{}}'; exit 0;;
219
242
  esac
220
243
  """
221
244
 
245
+ # Only what bash, node, and version-manager shims need, so tokens, SF_* overrides, and
246
+ # NODE_OPTIONS from the developer's shell never reach the scripts under test.
247
+ _ENV_PASSTHROUGH = ("PATH", "HOME", "TERM", "TMPDIR", "LANG", "LC_ALL", "USER", "SHELL")
248
+
249
+
250
+ def _base_env():
251
+ return {k: os.environ[k] for k in _ENV_PASSTHROUGH if k in os.environ}
252
+
222
253
 
223
254
  def run(args, path_prefix=None, scrub_sf=False, extra_env=None):
224
255
  """Run the orchestrator; return (returncode, merged stdout+stderr)."""
225
- env = dict(os.environ)
256
+ env = _base_env()
226
257
  if scrub_sf:
227
258
  kept = [d for d in env.get("PATH", "").split(os.pathsep)
228
259
  if d and not os.path.exists(os.path.join(d, "sf"))]
@@ -244,7 +275,7 @@ def run_node(script_rel, args, root=None):
244
275
  base = root if root is not None else SKILLS_ROOT
245
276
  proc = subprocess.run(
246
277
  ["node", str(base / script_rel), *args],
247
- capture_output=True, text=True, cwd=str(base),
278
+ capture_output=True, text=True, cwd=str(base), env=_base_env(),
248
279
  )
249
280
  return proc.returncode, (proc.stdout or "")
250
281
 
@@ -113,6 +113,14 @@ class InputContractTests(unittest.TestCase):
113
113
  self.assertEqual(rc, 1, out)
114
114
  self.assertIn("planner_bundle_api_name", out)
115
115
 
116
+ def test_injection_service_channel_name_rejected(self):
117
+ # Substituted into the flow XML via sed: a `|` would end the s||| expression and run
118
+ # a `w` (write-file) command.
119
+ rc, out = run(["myorg"], scrub_sf=True,
120
+ extra_env={"SERVICE_CHANNEL_DEV_NAME": "x|w /tmp/esc-pwn"})
121
+ self.assertEqual(rc, 1, out)
122
+ self.assertIn("service_channel_developer_name", out)
123
+
116
124
 
117
125
  class ProductionGuardTests(unittest.TestCase):
118
126
  def test_production_org_refused(self):
@@ -699,6 +707,7 @@ class NgaClassifierHardeningTests(unittest.TestCase):
699
707
  self.assertEqual(rc, 3)
700
708
 
701
709
 
710
+ @unittest.skipIf(FLAT_SKILLS_ROOT is None, "ITSM coordinator skill not present in this checkout")
702
711
  class CoordinatorGateTests(unittest.TestCase):
703
712
  def test_escalation_verdict_mapping(self):
704
713
  rc, out = run_node(VERDICT_SCRIPT, ["escalation", "CONFIGURED"], root=FLAT_SKILLS_ROOT)
@@ -895,6 +904,42 @@ class AuthorSurfacesContractTests(unittest.TestCase):
895
904
  self.assertIn("AUTHOR_SURFACES=1 requires escalation_topic_api_name and/or planner_bundle_api_name",
896
905
  self.block)
897
906
 
907
+ def test_no_activation_result_is_swallowed(self):
908
+ offending = [ln.strip() for ln in self.src.splitlines()
909
+ if "agent activate" in ln and "|| true" in ln]
910
+ self.assertEqual(offending, [], f"activation outcome discarded: {offending}")
911
+
912
+
913
+ class RecoveryReportingTests(unittest.TestCase):
914
+ """A patch failure after deactivate must report both the failure and whether reactivation worked."""
915
+
916
+ def _run(self, activate_fails):
917
+ env = {"AUTHOR_SURFACES": "1", "FAKE_AUTHORING_FIXTURE": "1"}
918
+ if activate_fails:
919
+ env["FAKE_ACTIVATE_FAIL"] = "1"
920
+ with FakeSf(_FAKE_SF_SANDBOX) as fake:
921
+ rc, out = run(["sbx", "Support_Agent", "Human_Support_Queue", "Escalate_Topic"],
922
+ path_prefix=fake, extra_env=env)
923
+ return rc, out, _last_json(out) or {}
924
+
925
+ def test_failed_reactivation_is_reported(self):
926
+ rc, out, verdict = self._run(activate_fails=True)
927
+ self.assertEqual(rc, 1, out)
928
+ self.assertEqual(verdict.get("status"), "BLOCKED", out)
929
+ issue = verdict.get("blocking_issue", "")
930
+ self.assertIn("could not safely set canEscalate", issue)
931
+ self.assertIn("Recovery FAILED", issue)
932
+ self.assertIn("INACTIVE", issue)
933
+ self.assertTrue(verdict.get("manual_actions"), "a stranded agent needs a manual fix")
934
+
935
+ def test_successful_reactivation_is_reported(self):
936
+ rc, out, verdict = self._run(activate_fails=False)
937
+ self.assertEqual(rc, 1, out)
938
+ self.assertEqual(verdict.get("status"), "BLOCKED", out)
939
+ issue = verdict.get("blocking_issue", "")
940
+ self.assertIn("could not safely set canEscalate", issue)
941
+ self.assertIn("was reactivated", issue)
942
+
898
943
 
899
944
  if __name__ == "__main__":
900
945
  unittest.main(verbosity=2)
@@ -75,6 +75,12 @@ if ! [[ "$FLOW_DEV_NAME" =~ $DN_RE ]]; then
75
75
  echo "{\"error\":\"Invalid flow_developer_name '$FLOW_DEV_NAME'. Must match the DeveloperName grammar.\"}" >&2
76
76
  exit 1
77
77
  fi
78
+ # SERVICE_CHANNEL_DEV_NAME is substituted unescaped into the flow XML via sed; the grammar excludes
79
+ # the sed (| & \) and XML (< > & " ') metacharacters that could rewrite the deployed RoutingFlow.
80
+ if ! [[ "$SERVICE_CHANNEL_DEV_NAME" =~ $DN_RE ]]; then
81
+ echo "{\"error\":\"Invalid service_channel_developer_name '$SERVICE_CHANNEL_DEV_NAME'. Must match the DeveloperName grammar.\"}" >&2
82
+ exit 1
83
+ fi
78
84
  # DEFAULT_FAILURE_THRESHOLD must be a small positive integer (1-99).
79
85
  if ! [[ "$DEFAULT_FAILURE_THRESHOLD" =~ ^[1-9][0-9]?$ ]]; then
80
86
  echo "{\"error\":\"Invalid DEFAULT_FAILURE_THRESHOLD '$DEFAULT_FAILURE_THRESHOLD'. Must be a positive integer between 1 and 99.\"}" >&2
@@ -130,6 +136,18 @@ emit_plan() {
130
136
  exit 0
131
137
  }
132
138
 
139
+ # Rollback after the agent was deactivated for authoring: try to reactivate, then block with the
140
+ # original failure AND the recovery outcome, so a failed reactivation never hides an inactive agent.
141
+ block_after_recovery() {
142
+ local msg="$1" rec_out
143
+ if rec_out=$(echo "Y" | sf agent activate --api-name "$AGENT_DN" --target-org "$ORG" --json 2>&1); then
144
+ emit_blocked "$msg Recovery: agent '$AGENT_DN' was reactivated."
145
+ else
146
+ emit_blocked "$msg Recovery FAILED: agent '$AGENT_DN' is left INACTIVE. Raw: $(echo "$rec_out" | head -c 400)" \
147
+ "Setup → Agentforce → Agents → '$AGENT_DN' → activate the latest version"
148
+ fi
149
+ }
150
+
133
151
  # Step 1 - Organization + safe_to_write guard
134
152
  ORG_JSON=$(sf data query --target-org "$ORG" \
135
153
  --query "SELECT Id, IsSandbox, TrialExpirationDate, OrganizationType FROM Organization LIMIT 1" \
@@ -509,25 +527,21 @@ if [ "${AUTHOR_SURFACES:-0}" = "1" ] && [ "$QUEUE_HAS_ACTIVE_DIRECT_USER_MEMBER"
509
527
  fi
510
528
  AGENT_ACTIVE=false
511
529
 
512
- # 4) Patch (XSD-ordered) + deploy (--metadata-dir); on failure, best-effort reactivate then block.
530
+ # 4) Patch (XSD-ordered) + deploy (--metadata-dir); on failure, reactivate and report both outcomes.
513
531
  if [ -n "$APLUGIN" ]; then
514
532
  if ! node "$SCRIPT_DIR/patch-escalation-surfaces.mjs" canEscalate "$APLUGIN" >/dev/null 2>&1; then
515
- echo "Y" | sf agent activate --api-name "$AGENT_DN" --target-org "$ORG" --json >/dev/null 2>&1 || true
516
- emit_blocked "AUTHOR_SURFACES: could not safely set canEscalate=true on GenAiPlugin '$ESCALATION_TOPIC' (no safe XSD-ordered insertion point)."
533
+ block_after_recovery "AUTHOR_SURFACES: could not safely set canEscalate=true on GenAiPlugin '$ESCALATION_TOPIC' (no safe XSD-ordered insertion point)."
517
534
  fi
518
535
  if ! DEPLOY_OUT=$(sf project deploy start --target-org "$ORG" --metadata-dir "$AROOT_PLUGIN" --json 2>/dev/null); then
519
- echo "Y" | sf agent activate --api-name "$AGENT_DN" --target-org "$ORG" --json >/dev/null 2>&1 || true
520
- emit_blocked "AUTHOR_SURFACES: failed to deploy canEscalate patch for '$ESCALATION_TOPIC'. Raw: $(echo "$DEPLOY_OUT" | head -c 400)"
536
+ block_after_recovery "AUTHOR_SURFACES: failed to deploy canEscalate patch for '$ESCALATION_TOPIC'. Raw: $(echo "$DEPLOY_OUT" | head -c 400)"
521
537
  fi
522
538
  fi
523
539
  if [ -n "$ABUNDLE" ]; then
524
540
  if ! node "$SCRIPT_DIR/patch-escalation-surfaces.mjs" outboundRoute "$ABUNDLE" "$FLOW_DEV_NAME" >/dev/null 2>&1; then
525
- echo "Y" | sf agent activate --api-name "$AGENT_DN" --target-org "$ORG" --json >/dev/null 2>&1 || true
526
- emit_blocked "AUTHOR_SURFACES: could not safely wire outboundRouteConfigs on a Messaging surface of '$PLANNER_BUNDLE' (no Messaging-class planner surface / <surface> anchor found)."
541
+ block_after_recovery "AUTHOR_SURFACES: could not safely wire outboundRouteConfigs on a Messaging surface of '$PLANNER_BUNDLE' (no Messaging-class planner surface / <surface> anchor found)."
527
542
  fi
528
543
  if ! DEPLOY_OUT=$(sf project deploy start --target-org "$ORG" --metadata-dir "$AROOT_BUNDLE" --json 2>/dev/null); then
529
- echo "Y" | sf agent activate --api-name "$AGENT_DN" --target-org "$ORG" --json >/dev/null 2>&1 || true
530
- emit_blocked "AUTHOR_SURFACES: failed to deploy outboundRouteConfigs patch for '$PLANNER_BUNDLE'. Raw: $(echo "$DEPLOY_OUT" | head -c 400)"
544
+ block_after_recovery "AUTHOR_SURFACES: failed to deploy outboundRouteConfigs patch for '$PLANNER_BUNDLE'. Raw: $(echo "$DEPLOY_OUT" | head -c 400)"
531
545
  fi
532
546
  fi
533
547