@salesforce/afv-skills 1.68.0 → 1.69.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 (188) 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/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -73,7 +73,7 @@ Outside contract: `SESSION_CONSUMER_ID`, `CONTEXT_AGENT_ID`, `CONTEXT_AGENT_VERS
73
73
 
74
74
  | Element | Notes |
75
75
  |---------|-------|
76
- | `<clause>` | `WHEN` or `UNLESS` — match the wrapper |
76
+ | `<clause>` | Always `WHEN`. Do not author `UNLESS`; use the negated operator (`CONTAINS_NONE`, `NOT_EQUALS`) instead |
77
77
  | `<operator>` | Always required |
78
78
  | `<resourcePath>` | What about the resource to inspect |
79
79
  | `<principalPath>` | What about the principal to inspect |
@@ -42,6 +42,39 @@ Start with two conditions in this exact order: entity type `OBJECT`, entity type
42
42
 
43
43
  The validated FLS example uses `Forbid`. Condition 1 is entity type `FIELD`; it has no `OBJECT` condition. Add requested principal conditions and tag/classification resource conditions after it. Construct the conjunction from the requested semantics rather than copying the example's grouping blindly. This evidence does not establish whether a Permit FLS variant is valid.
44
44
 
45
+ ### Deny unless
46
+
47
+ Request: "block field F for everyone unless they have custom permission P" (or "only people with P can see it"). The UI-renderable shape is `Forbid` + `Read` + `FIELD`, with the exemption written as a negated principal condition in the `WHEN` conjunction. Do not emit `<unlessPolicyRuleDefinitionClauseConjunction>` or `<clause>UNLESS</clause>`: the Data Governance UI nulls it on save and cannot open the policy.
48
+
49
+ ```xml
50
+ <whenPolicyRuleDefinitionClauseConjunction>
51
+ <conditions> <!-- 1: entity type -->
52
+ <clause>WHEN</clause><operator>IS</operator>
53
+ <policyRuleValueSet><valueText>FIELD</valueText></policyRuleValueSet>
54
+ <resourcePath>ENTITYTYPE</resourcePath>
55
+ </conditions>
56
+ <conditions> <!-- 2: the field's tag -->
57
+ <clause>WHEN</clause><operator>CONTAINS_ANY</operator>
58
+ <policyRuleValueSet>
59
+ <valueReference>{RESOLVED_TAG}</valueReference>
60
+ <valueReferenceType>STANDARD_TAG</valueReferenceType>
61
+ </policyRuleValueSet>
62
+ <resourcePath>TAG</resourcePath>
63
+ </conditions>
64
+ <conditions> <!-- 3: user.permission != P -->
65
+ <clause>WHEN</clause><operator>CONTAINS_NONE</operator>
66
+ <policyRuleValueSet>
67
+ <valueReference>{RESOLVED_CUSTOM_PERMISSION}</valueReference>
68
+ <valueReferenceType>CUSTOM_PERMISSION</valueReferenceType>
69
+ </policyRuleValueSet>
70
+ <principalPath>ASSIGNED_PERMISSIONS_PATH</principalPath>
71
+ </conditions>
72
+ <conjunctionExpression>(AND 1 (AND 2) (AND 3))</conjunctionExpression>
73
+ </whenPolicyRuleDefinitionClauseConjunction>
74
+ ```
75
+
76
+ Check before deploy: no `UNLESS` anywhere, the permission condition uses `CONTAINS_NONE` (not `CONTAINS_ANY`), and the permission is a resolved developer name. If the user instead asks to deny the permission *holders*, that is `CONTAINS_ANY` and a different request; ask rather than rewriting. The category is `GOVERNANCE_POLICY_RULE_DEFINITION` for this DATACLOUD FLS/OLS shape, as in `examples/FieldReadDeny/`.
77
+
45
78
  ## Masking
46
79
 
47
80
  Use category `TRANSFORM_POLICY_RULE_DEFINITION`, effect `Transform`, action `Read`, and resource scope `FIELD`. Set `resourceTransform` to the requested transform. Condition 1 is entity type `FIELD`. Do not add an `OBJECT` condition.
@@ -26,7 +26,7 @@ Source: `conjunctionExpressionSteelthread`
26
26
  </unlessPolicyRuleDefinitionClauseConjunction>
27
27
  ```
28
28
 
29
- > Note: `<unlessPolicyRuleDefinitionClauseConjunction>` blocks are **not UI-editable** — silently dropped on first save. Prefer WHEN + negated operator for UI-compatible policies.
29
+ > Note: `<unlessPolicyRuleDefinitionClauseConjunction>` blocks are **not UI-editable** — silently dropped on first save. Never author UNLESS; always use WHEN + negated operator (see `policy-shapes.md` "Deny unless"). This block is shown only so you can recognize it in retrieved API-only policies.
30
30
 
31
31
  ---
32
32
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  The Data Governance Policy Builder edits a **strict subset** of the MDAPI. Anything outside that subset must be maintained through the MDAPI package path for the policy's lifetime — admins cannot open it in the builder without silent data loss or a hard crash.
4
4
 
5
- > **Default goal**: produce policies that can eventually be validated in Policy Builder. `<builderCompatible>` and `<builderValidated>` are both server-managed fields — the server sets them on save/create, authoring either one in generated XML has no effect, and authoring `true` is never legitimate regardless of how many items on this checklist a shape satisfies. Omit both. Only an actual Policy Builder open/save/retrieve comparison can establish UI compatibility for a specific shape.
5
+ > **Default goal**: produce policies that can eventually be validated in Policy Builder. Author `<builderCompatible>true</builderCompatible>` on the set by default; omit it (or author `false`) only when the user explicitly asks for a policy that is not builder-compatible. `<builderValidated>` is server-managed — never author it. Authoring `builderCompatible=true` declares intent; only an actual Policy Builder open/save/retrieve comparison can establish UI compatibility for a specific shape, so keep the checklist below satisfied.
6
6
 
7
- > **Evidence boundary:** MDAPI dry-run, deploy, and retrieve prove metadata validity and persistence. They do not prove that Policy Builder can open and save the policy without normalization or loss. A retrieved set with `<builderCompatible>false</builderCompatible>` is persisted-shape evidence only.
7
+ > **Evidence boundary:** MDAPI dry-run, deploy, and retrieve prove metadata validity and persistence. They do not prove that Policy Builder can open and save the policy without normalization or loss. A retrieved set's `<builderCompatible>` and `<builderValidated>` values are persisted-shape evidence only.
8
8
 
9
- > **ACCESS distinction:** An OR-of-ENTITYTYPE discriminator prevents the builder crash for object-level ACCESS-shaped rules, but ACCESS categories still do not round-trip as ACCESS; the builder rewrites them to GOVERNANCE. Treat explicitly requested ACCESS output as API-only and record that status in the description or an XML comment, not in compatibility fields.
9
+ > **ACCESS distinction:** An OR-of-ENTITYTYPE discriminator prevents the builder crash for object-level ACCESS-shaped rules, but ACCESS categories still do not round-trip as ACCESS; the builder rewrites them to GOVERNANCE. Treat explicitly requested ACCESS output as API-only and record that status in the description or an XML comment and author `<builderCompatible>false</builderCompatible>` on the parent set (the policy is not authored with builder-renderable intent).
10
10
 
11
11
  ---
12
12
 
@@ -95,7 +95,7 @@ The policy will **not** round-trip through the UI without data loss or silent fa
95
95
  - [ ] `ruleConsumer` ≠ `DATACLOUD`
96
96
  - [ ] More than one `<action>`, or action is not `Read` / `TupleRead`
97
97
  - [ ] **No top-level `resourcePath=ENTITYTYPE` discriminator group** for ACCESS/GOVERNANCE rules — this causes a **hard crash** (`Cannot use 'in' operator to search for 'Permit' in undefined`), not a graceful degradation. OLS uses an `(OR OBJECT FIELD)` group; FLS uses `FIELD` only. A `TupleRead` OLS rule without its OR group still deploys and works at runtime — the crash is UI-only.
98
- - [ ] **Bare top-level condition index** in `<conjunctionExpression>` (e.g. `3` instead of `(AND 3)`) — causes crash in `buildCriteria` (`param.params.map(...)` = `undefined.map()`)
98
+ - [ ] **Bare top-level condition index** in `<conjunctionExpression>` for a tag/classification, permission, record-field or dataspace condition (e.g. `3` instead of `(AND 3)`) — causes crash in `buildCriteria` (`param.params.map(...)` = `undefined.map()`). Only a solitary `ENTITYTYPE IS FIELD` condition (FLS/Transform) may stay bare, as in `examples/FieldReadDeny`.
99
99
  - [ ] More than one `<resourceDomain>`
100
100
  - [ ] An `<unlessPolicyRuleDefinitionClauseConjunction>` block present
101
101
  - [ ] Any `<conditions>` uses `<clause>UNLESS</clause>`
@@ -138,7 +138,7 @@ Whenever a request would produce a UI-incompatible policy:
138
138
 
139
139
  3. **Wait for explicit confirmation.** Do not write the file until confirmed.
140
140
 
141
- 4. **On confirmation**, add an in-source marker to `<description>` (or a comment above the rule): `# API-only: not editable in Data Governance Policy Builder. Reasons: <bullets>`. Do not author server-managed compatibility fields on the parent set.
141
+ 4. **On confirmation**, add an in-source marker to `<description>` (or a comment above the rule): `# API-only: not editable in Data Governance Policy Builder. Reasons: <bullets>`. Author `<builderCompatible>false</builderCompatible>` on the parent set; never author `builderValidated` (server-managed).
142
142
 
143
143
  ---
144
144
 
@@ -95,6 +95,20 @@ Determine `<sourceDir>` from `sfdx-project.json` (commonly `force-app/main/defau
95
95
 
96
96
  Use `INTERVAL_CURRENT` for "this quarter", `INTERVAL_CURY` for "this year", `INTERVAL_LAST30` for last 30 days. Do NOT use `INTERVAL_CURQ` — it is not valid. See `references/date-intervals.md` for the full list.
97
97
 
98
+ ### Rule 16: Custom Summary Formulas Need Summary/Matrix + a Grouping Context
99
+
100
+ `<aggregates>` (custom summary formulas, CSFs) evaluate **only** in `Summary`, `Matrix`, or `Joined` reports — never `Tabular`. Each CSF must declare where it is computed via `<downGroupingContext>` (and `<acrossGroupingContext>` for Matrix): use `GRAND_SUMMARY` for the report total, or a 0-based grouping level (`0`, `1`, …). A context that references a grouping level that does not exist is a deploy failure. See `references/summary-formulas-sorting-limits.md`.
101
+
102
+ ### Rule 17: Report-Level Sort Is `<sortColumn>` + `<sortOrder>`; Group Sort Lives on the Grouping
103
+
104
+ - **Detail sort:** set top-level `<sortColumn>` (a platform column name that also appears in `<columns>`) plus `<sortOrder>` (`Asc` or `Desc`).
105
+ - **Grouping sort:** do NOT use `<sortColumn>` — set `<sortOrder>` on the `<groupingsDown>` / `<groupingsAcross>` element. To sort a grouping by a measure, match `<sortType>` to what `<sortByName>` names: `<sortType>Aggregate</sortType>` with a summarized column name (e.g. `AMOUNT`, which must carry an `<aggregateTypes>`, or `RowCount`); `<sortType>CustomSummaryFormula</sortType>` with a CSF `<developerName>` (e.g. `FORMULA1`). Pairing `Aggregate` with a CSF name deploys but silently sorts by the grouping field instead. Default `<sortType>` is `Column`.
106
+ - `<sortOrder>` is case-sensitive: `Asc` / `Desc` (not `ASC`/`Ascending`). See `references/summary-formulas-sorting-limits.md`.
107
+
108
+ ### Rule 18: Row Limit / Top-N Is Tabular-Only and Requires a Sort
109
+
110
+ `<rowLimit>` (the "Row Limit" / top-N feature used for tabular dashboard components) is valid **only** on `Tabular` reports and **must** be paired with `<sortColumn>` + `<sortOrder>` that define what "top" means: `Desc` = top N, `Asc` = bottom N. Setting `<rowLimit>` on Summary/Matrix, or without a sort column, fails to deploy. Max 99. See `references/summary-formulas-sorting-limits.md`.
111
+
98
112
  ## Top-Level Elements
99
113
 
100
114
  | Element | Required | Notes |
@@ -105,8 +119,12 @@ Use `INTERVAL_CURRENT` for "this quarter", `INTERVAL_CURY` for "this year", `INT
105
119
  | `<scope>` | Recommended | `organization` (or `org` for LeadList) |
106
120
  | `<columns>` | Yes | Field columns — each has `<field>` and optional `<aggregateTypes>` |
107
121
  | `<filter>` | No | Contains `<criteriaItems>` with `<column>`, `<operator>`, `<value>` |
108
- | `<groupingsDown>` | Conditional | Row groupings: `<field>`, `<dateGranularity>`, `<sortOrder>` |
122
+ | `<groupingsDown>` | Conditional | Row groupings: `<field>`, `<dateGranularity>`, `<sortOrder>`, and `<sortType>`/`<sortByName>` for measure sort |
109
123
  | `<groupingsAcross>` | Conditional | Column groupings (Matrix only) |
124
+ | `<aggregates>` | No | Custom summary formulas (Summary/Matrix/Joined only) — see Rule 16 |
125
+ | `<sortColumn>` | No | Platform column name to sort detail rows by; pair with `<sortOrder>`; required for `<rowLimit>` |
126
+ | `<sortOrder>` | No | `Asc` or `Desc` (case-sensitive) — used at report level and on each grouping |
127
+ | `<rowLimit>` | No | Tabular-only top-N (1–99); requires `<sortColumn>` + `<sortOrder>` — see Rule 18 |
110
128
  | `<timeFrameFilter>` | Recommended | `<dateColumn>`, `<interval>`, optional `<startDate>`/`<endDate>` |
111
129
  | `<chart>` | No | See `references/chart-types.md` |
112
130
  | `<buckets>` | No | Bucket field definitions |
@@ -159,6 +177,7 @@ Common operators: `equals`, `notEqual`, `lessThan`, `greaterThan`, `contains`, `
159
177
  | `references/filter-operations.md` | When building filters — complete operator reference |
160
178
  | `references/verification-checklist.md` | Step 6 — pre-deploy validation |
161
179
  | `references/errors-and-troubleshooting.md` | When fields are missing or deployment fails |
180
+ | `references/summary-formulas-sorting-limits.md` | When adding custom summary formulas, sorting, or a row limit / top-N (Rules 16–18) |
162
181
  | `examples/TabularOpportunitiesReport.report-meta.xml` | Tabular report template |
163
182
  | `examples/OpportunitiesByStageReport.report-meta.xml` | Summary report with chart |
164
183
  | `examples/OpportunitiesByStageAndQuarter.report-meta.xml` | Matrix report template |
@@ -0,0 +1,118 @@
1
+ # Custom Summary Formulas, Sorting & Row Limits
2
+
3
+ Covers three report-metadata capabilities beyond the core columns/groupings/filters:
4
+ custom summary formulas (`<aggregates>`), report and grouping sort
5
+ (`<sortColumn>` / `<sortOrder>` / grouping `<sortType>`), and tabular row limit /
6
+ top-N (`<rowLimit>`). See Rules 16–18 in `SKILL.md`.
7
+
8
+ ## Custom Summary Formulas (`<aggregates>`)
9
+
10
+ Custom summary formulas (CSFs) compute a value from a report's summaries. They are valid
11
+ **only** in `Summary`, `Matrix`, and `Joined` reports.
12
+
13
+ **Summary report** (no `<acrossGroupingContext>`):
14
+
15
+ ```xml
16
+ <aggregates>
17
+ <calculatedFormula>AMOUNT:SUM / RowCount</calculatedFormula>
18
+ <datatype>currency</datatype>
19
+ <developerName>FORMULA1</developerName>
20
+ <downGroupingContext>GRAND_SUMMARY</downGroupingContext>
21
+ <isActive>true</isActive>
22
+ <isCrossBlock>false</isCrossBlock>
23
+ <masterLabel>Avg Deal Size</masterLabel>
24
+ <scale>2</scale>
25
+ </aggregates>
26
+ ```
27
+
28
+ **Matrix report only**: add `<acrossGroupingContext>` next to `<downGroupingContext>`:
29
+
30
+ ```xml
31
+ <acrossGroupingContext>GRAND_SUMMARY</acrossGroupingContext>
32
+ <downGroupingContext>GRAND_SUMMARY</downGroupingContext>
33
+ ```
34
+
35
+ | Sub-element | Notes |
36
+ |-------------|-------|
37
+ | `<developerName>` | Unique per report (`FORMULA1`, `FORMULA2`, …). Referenced by charts and grouping sort (`<sortByName>` with `<sortType>CustomSummaryFormula</sortType>`). |
38
+ | `<calculatedFormula>` | Uses summary references such as `AMOUNT:SUM`, `AMOUNT:AVG`, and `RowCount`. |
39
+ | `<datatype>` | `number`, `currency`, or `percent`. |
40
+ | `<scale>` | Decimal places (0–18). |
41
+ | `<downGroupingContext>` | `GRAND_SUMMARY` or a 0-based grouping level (`0`, `1`, …). Required. |
42
+ | `<acrossGroupingContext>` | Matrix only; `GRAND_SUMMARY` or a 0-based across-grouping level. |
43
+ | `<isCrossBlock>` | `true` only for cross-block formulas in Joined reports. |
44
+
45
+ Include `<acrossGroupingContext>` **only** for Matrix reports. On a Summary report it fails
46
+ to deploy with `acrossBreakContext not allowed for summary reports, only for matrix reports`
47
+ — use `<downGroupingContext>` alone. A grouping context that references a level the report
48
+ does not have is also a deployment failure.
49
+
50
+ ## Sorting (`<sortColumn>`, `<sortOrder>`, grouping `<sortType>`)
51
+
52
+ **Sort detail rows** (Tabular, or the detail area of Summary/Matrix):
53
+
54
+ ```xml
55
+ <sortColumn>AMOUNT</sortColumn>
56
+ <sortOrder>Desc</sortOrder>
57
+ ```
58
+
59
+ The `<sortColumn>` must be a platform column name that also appears in `<columns>`.
60
+ `<sortOrder>` is case-sensitive — `Asc` or `Desc`.
61
+
62
+ **Sort a grouping by its own value:**
63
+
64
+ ```xml
65
+ <groupingsDown>
66
+ <field>STAGE_NAME</field>
67
+ <sortOrder>Asc</sortOrder>
68
+ </groupingsDown>
69
+ ```
70
+
71
+ **Sort a grouping by a summary** (e.g. show the group with the biggest total first):
72
+
73
+ ```xml
74
+ <groupingsDown>
75
+ <field>STAGE_NAME</field>
76
+ <sortType>Aggregate</sortType>
77
+ <sortByName>AMOUNT</sortByName>
78
+ <sortOrder>Desc</sortOrder>
79
+ </groupingsDown>
80
+ ```
81
+
82
+ With `<sortType>Aggregate</sortType>`, `<sortByName>` = a summarized column name (e.g.
83
+ `AMOUNT`, which must carry an `<aggregateTypes>`, or `RowCount`). Do NOT use the Analytics
84
+ REST `s!` prefix here — in report metadata the plain column name is required. Default
85
+ `<sortType>` is `Column` (sort by the grouping's own value).
86
+
87
+ **Sort a grouping by a custom summary formula**: use `<sortType>CustomSummaryFormula</sortType>`
88
+ with the CSF's `<developerName>`:
89
+
90
+ ```xml
91
+ <groupingsDown>
92
+ <field>STAGE_NAME</field>
93
+ <sortType>CustomSummaryFormula</sortType>
94
+ <sortByName>FORMULA1</sortByName>
95
+ <sortOrder>Desc</sortOrder>
96
+ </groupingsDown>
97
+ ```
98
+
99
+ Do NOT pair `<sortType>Aggregate</sortType>` with a CSF name: it deploys without error but
100
+ the sort silently falls back to the grouping field.
101
+
102
+ ## Row Limit / Top-N (`<rowLimit>`)
103
+
104
+ Row Limit restricts a **Tabular** report to the top or bottom N rows — commonly used for
105
+ "Top N" dashboard table components. It requires a sort column that defines the ranking.
106
+
107
+ ```xml
108
+ <format>Tabular</format>
109
+ <rowLimit>10</rowLimit>
110
+ <sortColumn>AMOUNT</sortColumn>
111
+ <sortOrder>Desc</sortOrder>
112
+ ```
113
+
114
+ - `Desc` → top N; `Asc` → bottom N.
115
+ - Valid only on `Tabular`; requires `<sortColumn>` + `<sortOrder>`.
116
+ - Value 1–99.
117
+
118
+ Setting `<rowLimit>` on a Summary/Matrix report, or without a sort column, fails to deploy.
@@ -53,3 +53,15 @@ Run through these checks before deploying any generated report metadata.
53
53
  - [ ] Maximum 3 cross-filters per report
54
54
  - [ ] Maximum 5 criteria items per cross-filter
55
55
  - [ ] `<operation>` is `with` or `without`
56
+
57
+ ## Custom Summary Formula Checks (if applicable)
58
+ - [ ] `<aggregates>` only on Summary/Matrix/Joined (never Tabular)
59
+ - [ ] `<datatype>` is `number`, `currency`, or `percent`; `<scale>` is 0–18
60
+ - [ ] `<downGroupingContext>` (and `<acrossGroupingContext>` for Matrix) resolves to `GRAND_SUMMARY` or an existing grouping level
61
+ - [ ] `<developerName>` is unique within the report
62
+
63
+ ## Sort & Row Limit Checks (if applicable)
64
+ - [ ] `<sortColumn>` (when present) names a column that appears in `<columns>`; `<sortOrder>` is exactly `Asc` or `Desc`
65
+ - [ ] Grouping `<sortType>Aggregate</sortType>` pairs with a summarized column name in `<sortByName>` (like `AMOUNT` or `RowCount` — NOT the Analytics-REST `s!` prefix)
66
+ - [ ] Grouping sorted by a CSF uses `<sortType>CustomSummaryFormula</sortType>` with the CSF `<developerName>` (like `FORMULA1`) — `Aggregate` + a CSF name deploys but silently sorts by the grouping field
67
+ - [ ] `<rowLimit>` only on `Tabular`, value 1–99, with `<sortColumn>` + `<sortOrder>` present
@@ -30,72 +30,44 @@ Creates `MessagingChannel` metadata XML for Salesforce Messaging for In-App and
30
30
 
31
31
  ## Entry points and transport
32
32
 
33
- - **Delegated** (`context.calledFrom == "service-onboarding"`): use the approved `values`, ask nothing, and return `failed` naming any missing required key. **Standalone** (no `context`): run Clarifying Questions.
33
+ - **Delegated** (`context.calledFrom == "service-onboarding"`): use the approved `values`, ask nothing, and return `failed` naming any missing required key. **Standalone** (no `context`): ask for the Inputs below.
34
+ - **Shell safety**: org alias and bot name must match `^[A-Za-z0-9_.@+-]+$` before use in a command; otherwise stop and ask (delegated: `failed`). Pass the channel label single-quoted, escaping any `'` as `'\''`.
34
35
  - **Transport A** (primary): headless-360 MCP `dispatch` / `dispatch_readonly` on `/headless/metadata`. **Transport B**: the `sf` commands below, only where a probe shows Transport A unavailable.
35
36
 
36
37
  Details: `references/onboarding_contract.md` (§1 entry points, §2 transport, §3 pre-scan, §5 result).
37
38
 
38
39
  ---
39
40
 
40
- ## Clarifying Questions
41
+ ## Inputs
41
42
 
42
- Before generating, ask the user if not already clear (standalone only):
43
+ Standalone: ask for anything not already clear. Delegated: take `values`.
43
44
 
44
- - What is the channel name / label? (used for `masterLabel` and file name)
45
- - What routing type? (Omni-Channel Flow, Omni-Channel Queue, User, or Agentforce Service Agent)
46
- - What is the routing target? (Flow API name, Queue developer name, User ID, or ASA bot name)
47
- - For Flow, User, or ASA routing: What is the fallback queue name?
48
- - Should User Verification be enabled? (defaults to `true` per this skill)
49
- - Are there pre-chat form fields required? If so, which fields and types?
45
+ - **Channel name**: `masterLabel` and file name (`<Name>.messagingChannel-meta.xml`)
46
+ - **Routing type**: `Queue`, `Flow`, `User`, or `AgentforceServiceAgent`
47
+ - **Routing target**: developer name of the queue, flow, user, or ASA bot
48
+ - **Fallback queue** (Flow, User, and ASA): developer name for escalation
49
+ - **User verification**: JWT-based identity verification (default `false`, so `authMode` `UnAuth`). `true` makes an `Auth` channel; a keyset name is optional (with one, also an `authIdentifier`, a free-form label defaulting to the file name). Creating keys is a separate setup
50
+ - **Pre-chat fields** (optional): which fields and types
50
51
 
51
- ---
52
-
53
- ## Required Inputs
54
-
55
- Gather or infer before proceeding:
56
-
57
- - **Channel name**: Used for `masterLabel` and the file name (`<Name>.messagingChannel-meta.xml`)
58
- - **Routing type**: One of `Queue`, `Flow`, `User`, or `AgentforceServiceAgent`
59
- - **Routing target**: The developer name of the queue, flow, user, or ASA bot
60
- - **Fallback queue** (Flow, User, and ASA): The developer name of the fallback queue for escalation
61
- - **User verification**: Whether to require JWT-based identity verification (default: `true`)
62
-
63
- Defaults unless specified:
64
- - `messagingChannelType`: `EmbeddedMessaging`
65
- - `authMode`: `Auth`
66
- - `chatAbandonmentTimeout`: `5` (minutes)
67
- - `endUserIdleTimeOut`: `5` (minutes)
68
- - `isAttachmentUploadEnabled`: `true`
69
- - `maxFileSize`: `5` (MB)
70
- - `allowedFileTypes`: `bmp,csv,doc,docx,gif,jpg,pdf,png,tiff,txt,xls,xml`
71
- - `anonymousUserJwtExpirationTime`: `360` (minutes, required for UnAuth, range 60-4320)
72
- - `verifiedUserJwtExpirationTime`: `60` (minutes, required for Auth, range 60-240)
73
- - `isAbandonedChatsEnabled`: `false`
74
- - `isSaveTranscriptEnabled`: `false`
75
- - `isFallbackMessageEnabled`: `false`
76
- - `isEstimatedWaitTimeEnabled`: `false`
77
- - `isFileAttachmentExtUnrestricted`: `false`
78
- - `isQueuePositionEnabled`: `false`
79
- - `isSynchronousChatEnabled`: `false`
80
- - `isVoiceModeEnabled`: `false`
52
+ Apply every other default from `references/channel_settings.md` unless the user specifies otherwise.
81
53
 
82
54
  ---
83
55
 
84
56
  ## Workflow
85
57
 
86
- All steps are sequential. Do not skip or reorder.
58
+ Run in order; step 3a may jump to step 15 or Phase 4. All SOQL below: Transport A `dispatch_readonly` first, `sf data query` as fallback.
87
59
 
88
60
  ### Phase 1 — Gather Context
89
61
 
90
- 1. **Verify org API version** — run `scripts/check-api-version.sh 67.0 <org-alias>` and report any errors it returns. If the script fails, generate a `sfdx-project.json` in the metadata output folder with `"sourceApiVersion": "67.0"`.
62
+ 1. **Verify org API version** — run `scripts/check-api-version.sh 67.0 '<org-alias>'` (skip it when Transport A is in use). Exit 1 = org below 67.0: stop (delegated: `failed`). Exit 2 = version unknown: say so and continue. Create `sfdx-project.json` with `"sourceApiVersion": "67.0"` in the output folder only if none exists.
91
63
 
92
- 2. **Collect inputs** — standalone: per Clarifying Questions. Delegated: from `values`. Then probe transport with a read-only `GET` of `MessagingChannel` (contract §2).
64
+ 2. **Collect inputs** — standalone: ask for the Inputs. Delegated: from `values`. Then probe transport with a read-only `GET` of `MessagingChannel` (contract §2).
93
65
 
94
- 3. **Determine file name** — run `scripts/normalize-channel-name.sh "<LABEL>"` and surface any errors it returns.
66
+ 3. **Determine file name** — run `scripts/normalize-channel-name.sh '<LABEL>'` and surface any errors it returns.
95
67
 
96
68
  3a. **Pre-scan** — `GET` `MessagingChannel` by the step 3 name (contract §3): none → create; matches and active → no write, `already-configured`, skip to Phase 4; matches but inactive → activate only (step 15); differs → announce each change, then write the full document (standalone: ask first).
97
69
 
98
- 4. **Verify routing target exists** — skip when step 3a ended in `already-configured` or activate-only, so a re-run never creates a queue. Query the org to confirm the referenced routing target exists:
70
+ 4. **Verify routing target exists** — skip when step 3a ended in `already-configured` or activate-only, so a re-run never creates a queue. Names must match `^[A-Za-z0-9_.@+-]+$` before they go into a query. Query the org to confirm the referenced routing target exists:
99
71
  - For Queue: `sf data query --query "SELECT Id, DeveloperName FROM Group WHERE Type='Queue' AND DeveloperName='<QUEUE_NAME>'" --target-org <org-alias>`
100
72
  - For Flow: `sf data query --query "SELECT Id, ApiName FROM FlowDefinitionView WHERE ApiName='<FLOW_NAME>' AND IsActive=true" --target-org <org-alias>`
101
73
  - For User: `sf data query --query "SELECT Id, Username FROM User WHERE Id='<USER_ID>' AND IsActive=true" --target-org <org-alias>`
@@ -110,7 +82,7 @@ All steps are sequential. Do not skip or reorder.
110
82
 
111
83
  ### Phase 2 — Generate Metadata
112
84
 
113
- 6. **Read the metadata template** — load `assets/messaging_channel_template.xml` as the starting structure.
85
+ 6. **Read the metadata template** — new channel: load `assets/messaging_channel_template.xml` as the starting structure. Existing channel (3a): start from its current document (Transport A `GET` `xmlRep`; Transport B `sf project retrieve start -m MessagingChannel:<Name>`) and change only the targeted elements, so pre-chat, responses, and authorizations survive.
114
86
 
115
87
  7. **Apply routing configuration** — set `sessionHandlerType` and the corresponding handler field:
116
88
 
@@ -123,20 +95,9 @@ All steps are sequential. Do not skip or reorder.
123
95
 
124
96
  > **v67 note — `<sessionHandlerAsa>` is required** (omitting it fails with "Missing required Agentforce Service Agent"); the deploy then binds `SessionHandlerId`, no PATCH needed. The bot must be Active first: run `sf agent activate -o <org> --api-name <BotDevName>` and confirm `BotVersion.Status = Active`.
125
97
 
126
- 8. **Apply user verification** — if enabled, set `embeddedConfig.authMode` to `Auth` and include `<messagingAuthorizations>`. If not enabled, set `embeddedConfig.authMode` to `UnAuth` and omit `<messagingAuthorizations>`.
127
-
128
- 9. **Configure embedded settings** — populate `<embeddedConfig>` with:
129
- - `allowedFileTypes` — comma-separated file extensions (no spaces)
130
- - `anonymousUserJwtExpirationTime` — JWT expiration in minutes (required for UnAuth)
131
- - `verifiedUserJwtExpirationTime` — JWT expiration in minutes (required for Auth)
132
- - `chatAbandonmentTimeout` — minutes before abandoned conversation cleanup
133
- - `isAbandonedChatsEnabled` — enable abandoned chat detection
134
- - `isAttachmentUploadEnabled` — file upload support
135
- - `isEstimatedWaitTimeEnabled` — show estimated wait time
136
- - `isFallbackMessageEnabled` — fallback when agents unavailable
137
- - `isFileAttachmentExtUnrestricted` — allow any file extension
138
- - `isSaveTranscriptEnabled` — save conversation transcripts
139
- - `maxFileSize` — maximum attachment size in MB
98
+ 8. **Apply user verification** — not enabled: set `embeddedConfig.authMode` to `UnAuth` and omit `<messagingAuthorizations>`. Enabled: follow `references/user_verification.md` (add `<messagingAuthorizations>` only for a keyset name the user gave; never invent one, and without one still write `Auth`).
99
+
100
+ 9. **Configure embedded settings** — populate `<embeddedConfig>` per `references/channel_settings.md`: `anonymousUserJwtExpirationTime` for UnAuth, `verifiedUserJwtExpirationTime` for Auth.
140
101
 
141
102
  9a. **Configure session inactivity (optional)** — ask using the Setup labels and set the top-level fields per `references/channel_settings.md` → "Setup Prompts: Session Inactivity".
142
103
 
@@ -144,11 +105,11 @@ All steps are sequential. Do not skip or reorder.
144
105
  - `OptOut` type with individual `<keyword>` elements: cancel, end, quit, stop, stopall, unsubscribe
145
106
  - `Help` type with `<keyword>`: help
146
107
 
147
- 11. **Apply standard parameters** — if the user needs standard pre-chat fields, generate `<standardParameters>` elements with `parameterType`. If the channel uses Flow-based routing and the user specifies flow variable mappings, include `<actionParameterMappings>` with `actionParameterName` to map each parameter to a flow input variable.
108
+ 11. **Apply standard parameters** — if the user needs standard pre-chat fields, follow `references/prechat_params.md` → Standard parameters.
148
109
 
149
- 12. **Apply custom parameters** — if the user needs pre-chat data collection, generate `<customParameters>` elements with `name`, `masterLabel`, `parameterDataType`, `externalParameterName`, and `maxLength`. Always set `parameterDataType` to `String` — the channel accepts no other value (the field's actual type, including Checkbox/Number/dropdown, is set at the deployment level via `formFieldType`, not here). If the channel uses Flow-based routing and the user specifies flow variable mappings, include `<actionParameterMappings>` with `actionParameterName` to map each parameter to a flow input variable.
110
+ 12. **Apply custom parameters** — if the user needs pre-chat data collection, follow `references/prechat_params.md` → Custom parameters (`parameterDataType` is always `String`).
150
111
 
151
- 13. **Generate the file** — produce the `.messagingChannel-meta.xml` file following the template structure. Place at the path the user specifies, or default to the project's metadata source path under `messagingChannels/`.
112
+ 13. **Generate the file** — produce the `.messagingChannel-meta.xml` file following the template structure. Place at the path the user specifies, or default to `<source-path>/messagingChannels/<ChannelName>.messagingChannel-meta.xml` under the project's metadata source path.
152
113
 
153
114
  ### Phase 3 — Deploy and Activate
154
115
 
@@ -157,6 +118,11 @@ All steps are sequential. Do not skip or reorder.
157
118
  sf project deploy start --source-dir <path-to-messagingChannels-folder> --target-org <org-alias>
158
119
  ```
159
120
 
121
+ 15. **Activate the channel** — after a successful write, activate the messaging channel (`IsActive` is not part of the metadata). Transport A: sObject update `{"IsActive": true}` through `dispatch`. Transport B:
122
+ ```bash
123
+ sf data update record --sobject MessagingChannel --where "DeveloperName='<CHANNEL_NAME>'" --values "IsActive=true" --target-org <org-alias>
124
+ ```
125
+
160
126
  15a. **ASA routing only — verify the bind landed** (skip for Queue, Flow, User):
161
127
 
162
128
  ```bash
@@ -166,19 +132,15 @@ All steps are sequential. Do not skip or reorder.
166
132
 
167
133
  Both must be non-null; if not, check both handler elements were in the XML and the bot was Active before the deploy.
168
134
 
169
- 15. **Activate the channel** — after a successful write, activate the messaging channel (`IsActive` is not part of the metadata). Transport A: sObject update `{"IsActive": true}` through `dispatch`. Transport B:
170
- ```bash
171
- sf data update record --sobject MessagingChannel --where "DeveloperName='<CHANNEL_NAME>'" --values "IsActive=true" --target-org <org-alias>
172
- ```
173
-
174
135
  ### Phase 4 — Validate
175
136
 
176
137
  16. **Verify against checklist** — confirm all items in the Verification Checklist below pass before presenting output.
177
138
 
178
139
  17. **Report** — delegated: return the contract §5 result and stop. Standalone: continue.
179
140
 
180
- 18. **Present output** (standalone) — show the generated file to the user with a summary of configured settings and confirm activation status. Offer next steps:
141
+ 18. **Present output** (standalone) — in a few lines: confirm the channel is created and its activation status, and list each setting the user asked for with its final value, whatever field it is. Say everything else uses the defaults, without listing them. Give transport details, file paths and record Ids only after a failure or if asked. Then offer next steps:
181
142
  - **Automated responses** — ask which messages the user wants using the Setup labels per `references/channel_settings.md` → "Setup Prompts: Automated Responses", then redeploy.
143
+ - **reCAPTCHA** — not settable by this skill; say this skill does not set or check it and offer the admin handoff in `references/recaptcha_handoff.md`.
182
144
 
183
145
  ---
184
146
 
@@ -190,8 +152,6 @@ All steps are sequential. Do not skip or reorder.
190
152
  | `sessionHandlerType` must match the handler fields present | Setting `Queue` but populating `sessionHandlerFlow` causes deployment error |
191
153
  | Flow routing requires both `sessionHandlerFlow` and `sessionHandlerQueue` | Queue is the mandatory fallback for human escalation |
192
154
  | User routing requires both `sessionHandlerUser` and `sessionHandlerQueue` | Queue is the mandatory fallback when user is unavailable |
193
- | ASA routing: include both `sessionHandlerQueue` and `sessionHandlerAsa` in the XML | `sessionHandlerAsa` is required at v67 — the deploy fails with "Missing required Agentforce Service Agent" if omitted; the deploy itself binds `SessionHandlerId`, no PATCH needed |
194
- | Bot must be Active before the metadata deploy that binds `SessionHandlerId` | API rejects with "Only active Agentforce Service Agents are supported" if the bot is inactive |
195
155
  | `masterLabel` max 40 characters | Platform limit on channel labels |
196
156
  | File name must match `^[a-zA-Z][a-zA-Z0-9_]*$` | API name format enforced by Metadata API |
197
157
  | `allowedFileTypes` is a comma-separated string with no spaces | Not a nested list or array |
@@ -208,16 +168,18 @@ All steps are sequential. Do not skip or reorder.
208
168
 
209
169
  | Issue | Resolution |
210
170
  |-------|------------|
171
+ | ASA routing: include both `sessionHandlerQueue` and `sessionHandlerAsa` in the XML | `sessionHandlerAsa` is required at v67 — the deploy fails with "Missing required Agentforce Service Agent" if omitted; the deploy itself binds `SessionHandlerId`, no PATCH needed |
172
+ | Bot must be Active before the metadata deploy that binds `SessionHandlerId` | API rejects with "Only active Agentforce Service Agents are supported" if the bot is inactive |
211
173
  | Channel name conflicts with existing channel | Check org for existing channels; file name must be unique |
212
174
  | Queue not found on deploy | Ensure the referenced queue exists and has `MessagingSession` as a `queueSobject` type |
213
175
  | Channel deploys and activates fine, but widget shows "Agents are not available. Try again later." at session start | The queue has no `QueueRoutingConfig` — this is silent at deploy time. Check `SELECT QueueRoutingConfigId FROM Group WHERE Id='<QUEUE_ID>'`; if null, resolve/create one per `queue-resolution.md` Step 4 |
214
176
  | Omni-Channel Flow not found on deploy | Ensure the referenced flow exists and is active before deploying the channel |
215
177
  | ASA bot reference invalid | Bot must be published and active; use exact developer name from BotDefinition metadata |
216
- | ASA channel deploy fails with "Missing required Agentforce Service Agent" | `<sessionHandlerAsa>{BotDevName}</sessionHandlerAsa>` is missing from the XML — it's required at v67, not optional |
217
178
  | ASA channel deployed but `SessionHandlerId` is null after deploy | Bot was not Active at deploy time — run `sf agent activate`, confirm `BotVersion.Status = Active`, then redeploy |
179
+ | ASA channel deploy fails with "Missing required Agentforce Service Agent" | `<sessionHandlerAsa>{BotDevName}</sessionHandlerAsa>` is missing from the XML — it's required at v67, not optional |
218
180
  | "Only active Agentforce Service Agents are supported" on deploy | Bot is inactive — run `sf agent activate` before deploying |
219
181
  | Flow or ASA routing fails without fallback queue | `sessionHandlerQueue` is mandatory when `sessionHandlerType` is `Flow` or `AgentforceServiceAgent` |
220
- | JWT verification not working | Connected app and certificate must be configured for the org |
182
+ | JWT verification not working | The keyset (`PublicKeyCertificateSet`) named in `messagingAuthorizations` must exist in the org and match the token's `kid` and issuer |
221
183
  | Custom parameters not collected | `name` must be unique per channel |
222
184
  | `<customParameters>` deploy fails: "bad value for restricted picklist field" | `parameterDataType` was set to something other than `String`. Channel custom parameters are always `String`; set the field's actual type (Number, Checkbox, dropdown) at the deployment level, not here |
223
185
  | Removing a custom parameter: "can't be deleted as it is referenced elsewhere" | **Check before deploying, not after.** Every deployment on this channel whose pre-chat form uses the param must first drop that field and be published (user-approved); remove the param's `actionParameterMappings` in a separate deploy first. See `references/channel_settings.md` §Removing a Custom Parameter |
@@ -229,10 +191,12 @@ All steps are sequential. Do not skip or reorder.
229
191
 
230
192
  ## Verification Checklist
231
193
 
232
- ### Universal Checks
233
- - [ ] Does the file name match `^[a-zA-Z][a-zA-Z0-9_]*$`?
234
- - [ ] Is `masterLabel` 40 characters or fewer?
235
- - [ ] Is `messagingChannelType` set to `EmbeddedMessaging`?
194
+ ### Universal, Verification, Config, and Keyword Checks
195
+ - [ ] File name matches `^[a-zA-Z][a-zA-Z0-9_]*$`, `masterLabel` is 40 characters or fewer, `messagingChannelType` is `EmbeddedMessaging`?
196
+ - [ ] `embeddedConfig.authMode` is `Auth` when verification is enabled, `UnAuth` when not, with the matching JWT expiration set in range (`references/channel_settings.md`)?
197
+ - [ ] `chatAbandonmentTimeout` is a positive integer, `allowedFileTypes` is comma-separated with no spaces, `maxFileSize` is 1-5 MB?
198
+ - [ ] An `OptOut` keyword is defined, keywords are individual `<keyword>` elements, and `language` is set on each keyword block?
199
+ - [ ] Session inactivity / automated responses (only if requested) checked against `references/channel_settings.md`?
236
200
 
237
201
  ### Routing Checks
238
202
  - [ ] Is exactly one `sessionHandlerType` value set (`Queue`, `Flow`, `User`, or `AgentforceServiceAgent`)?
@@ -243,40 +207,12 @@ All steps are sequential. Do not skip or reorder.
243
207
  - [ ] For ASA routing: was step 15a run? Are `SessionHandlerId` and `FallbackQueueId` non-null after the deploy?
244
208
  - [ ] Does the routing target reference an existing entity in the org?
245
209
 
246
- ### User Verification Checks
247
- - [ ] If verification is enabled, is `embeddedConfig.authMode` set to `Auth`?
248
- - [ ] If verification is disabled, is `embeddedConfig.authMode` set to `UnAuth`?
249
-
250
- ### Embedded Config Checks
251
- - [ ] Is `chatAbandonmentTimeout` a positive integer (minutes)?
252
- - [ ] Is `allowedFileTypes` a comma-separated string with no spaces?
253
- - [ ] Is `maxFileSize` a value between 1-5 MB?
254
- - [ ] If UnAuth, is `anonymousUserJwtExpirationTime` set (default 360, range 60-4320)?
255
- - [ ] If Auth, is `verifiedUserJwtExpirationTime` set (default 60, range 60-240)?
256
-
257
- ### Session Inactivity / Automated Response Checks (only if user requested)
258
- - [ ] Checked against `references/channel_settings.md` (Session Settings, Automated Responses)?
259
-
260
- ### Keyword Checks
261
- - [ ] Is there at least an `OptOut` keyword type defined?
262
- - [ ] Are keywords individual `<keyword>` elements (not comma-separated)?
263
- - [ ] Is `language` set on each keyword block?
264
-
265
210
  ### Activation Checks
266
211
  - [ ] Was the channel deployed successfully?
267
212
  - [ ] Was the channel activated after deployment (`IsActive=true`)?
268
213
 
269
214
  ---
270
215
 
271
- ## Output Expectations
272
-
273
- Deliverables:
274
- - **Messaging Channel metadata**: `<source-path>/messagingChannels/<ChannelName>.messagingChannel-meta.xml`
275
-
276
- File structure follows the template in `assets/messaging_channel_template.xml`.
277
-
278
- ---
279
-
280
216
  ## Cross-Skill Integration
281
217
 
282
218
  | Need | Delegate to |
@@ -295,8 +231,9 @@ File structure follows the template in `assets/messaging_channel_template.xml`.
295
231
  | `references/onboarding_contract.md` | Delegated mode (`context.calledFrom == "service-onboarding"`), org writes (transport), module registration |
296
232
  | `assets/messaging_channel_template.xml` | Before generating — use as the starting structure |
297
233
  | `references/channel_settings.md` | When configuring channel options beyond defaults |
234
+ | `references/user_verification.md` | The user turns user verification (Auth mode) on |
235
+ | `references/prechat_params.md` | The user needs standard or custom pre-chat parameters |
236
+ | `references/recaptcha_handoff.md` | The user asks about reCAPTCHA / captcha, or at the end of standalone output |
298
237
  | `scripts/check-api-version.sh` | Phase 1 — verify org API version meets the passed minimum (67.0) |
299
238
  | `scripts/normalize-channel-name.sh` | Phase 1 — derive file API name from channel label |
300
- | `examples/omni_flow_channel.xml` | To verify output for Omni-Channel Flow routing |
301
- | `examples/omni_queue_channel.xml` | To verify output for Omni-Channel Queue routing |
302
- | `examples/asa_agent_channel.xml` | To verify output for Agentforce Service Agent routing |
239
+ | `examples/omni_flow_channel.xml`, `omni_queue_channel.xml`, `asa_agent_channel.xml`, `auth_queue_channel.xml` (Auth with keyset) | To verify output for Flow, Queue, or Agentforce Service Agent routing |
@@ -62,7 +62,9 @@
62
62
  <!-- Embedded Configuration -->
63
63
  <embeddedConfig>
64
64
  <allowedFileTypes>{COMMA_SEPARATED_EXTENSIONS}</allowedFileTypes>
65
+ <!-- Keep exactly one expiry: anonymousUserJwtExpirationTime for UnAuth (default 360), verifiedUserJwtExpirationTime for Auth (60-240) -->
65
66
  <anonymousUserJwtExpirationTime>{JWT_EXPIRATION_MINUTES}</anonymousUserJwtExpirationTime>
67
+ <!-- <verifiedUserJwtExpirationTime>{VERIFIED_JWT_EXPIRATION_MINUTES}</verifiedUserJwtExpirationTime> -->
66
68
  <authMode>{UnAuth|Auth}</authMode>
67
69
  <chatAbandonmentTimeout>{MINUTES}</chatAbandonmentTimeout>
68
70
  <isAbandonedChatsEnabled>{true|false}</isAbandonedChatsEnabled>
@@ -14,8 +14,8 @@
14
14
  </automatedResponses>
15
15
  <embeddedConfig>
16
16
  <allowedFileTypes>bmp,csv,doc,docx,gif,jpg,pdf,png,tiff,txt,xls,xml</allowedFileTypes>
17
- <authMode>Auth</authMode>
18
- <verifiedUserJwtExpirationTime>60</verifiedUserJwtExpirationTime>
17
+ <anonymousUserJwtExpirationTime>360</anonymousUserJwtExpirationTime>
18
+ <authMode>UnAuth</authMode>
19
19
  <chatAbandonmentTimeout>5</chatAbandonmentTimeout>
20
20
  <isAbandonedChatsEnabled>true</isAbandonedChatsEnabled>
21
21
  <isAttachmentUploadEnabled>true</isAttachmentUploadEnabled>