@salesforce/afv-skills 1.47.0 → 1.49.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 (160) hide show
  1. package/package.json +1 -1
  2. package/skills/education-cloud-domain-configure/SKILL.md +234 -0
  3. package/skills/education-cloud-domain-configure/references/dependent-features.md +198 -0
  4. package/skills/education-cloud-domain-configure/references/domain-features/academic-operations.md +386 -0
  5. package/skills/education-cloud-domain-configure/references/domain-features/alumni-relations.md +155 -0
  6. package/skills/education-cloud-domain-configure/references/domain-features/cross-domain-dependencies.md +18 -0
  7. package/skills/education-cloud-domain-configure/references/domain-features/industriessettings-toggle-reference.md +43 -0
  8. package/skills/education-cloud-domain-configure/references/domain-features/mentoring.md +198 -0
  9. package/skills/education-cloud-domain-configure/references/domain-features/recruitment-admissions.md +315 -0
  10. package/skills/education-cloud-domain-configure/references/domain-features/student-management.md +155 -0
  11. package/skills/education-cloud-domain-configure/references/domain-features/student-success.md +249 -0
  12. package/skills/education-cloud-domain-configure/references/domain-features.md +27 -0
  13. package/skills/education-cloud-domain-configure/references/gotchas-extended.md +23 -0
  14. package/skills/education-cloud-domain-configure/references/toggle-write-path.md +67 -0
  15. package/skills/education-cloud-domain-configure/scripts/check_license_provisioned.py +62 -0
  16. package/skills/education-cloud-domain-configure/scripts/check_org_edition.py +44 -0
  17. package/skills/education-cloud-domain-configure/scripts/check_permission_assigned.py +39 -0
  18. package/skills/education-cloud-multi-campus-configure/SKILL.md +2 -0
  19. package/skills/education-cloud-multi-campus-configure/references/foundation_prerequisites.md +4 -3
  20. package/skills/service-agentforce-channel-configure/SKILL.md +33 -28
  21. package/skills/service-agentforce-human-escalation-configure/SKILL.md +205 -0
  22. package/skills/service-agentforce-human-escalation-configure/assets/escalation-thresholds.instructions.md +37 -0
  23. package/skills/service-agentforce-human-escalation-configure/assets/force-app/main/default/flows/Human_Escalation_Outbound_Flow.flow-meta.xml +173 -0
  24. package/skills/service-agentforce-human-escalation-configure/assets/package.xml +8 -0
  25. package/skills/service-agentforce-human-escalation-configure/assets/sfdx-project.json +5 -0
  26. package/skills/service-agentforce-human-escalation-configure/references/classifier-contracts.md +103 -0
  27. package/skills/service-agentforce-human-escalation-configure/references/escalation-mechanism.md +63 -0
  28. package/skills/service-agentforce-human-escalation-configure/references/failure-policy.md +44 -0
  29. package/skills/service-agentforce-human-escalation-configure/references/nga-escalation.md +57 -0
  30. package/skills/service-agentforce-human-escalation-configure/references/runtime-verification.md +72 -0
  31. package/skills/service-agentforce-human-escalation-configure/scripts/classify-agent-active.mjs +49 -0
  32. package/skills/service-agentforce-human-escalation-configure/scripts/classify-nga-escalation.mjs +166 -0
  33. package/skills/service-agentforce-human-escalation-configure/scripts/extract-outbound-route.mjs +67 -0
  34. package/skills/service-agentforce-human-escalation-configure/scripts/patch-escalation-surfaces.mjs +131 -0
  35. package/skills/service-agentforce-human-escalation-configure/scripts/tests/__init__.py +0 -0
  36. package/skills/service-agentforce-human-escalation-configure/scripts/tests/_bootstrap.py +249 -0
  37. package/skills/service-agentforce-human-escalation-configure/scripts/tests/test_escalation_contracts.py +899 -0
  38. package/skills/service-agentforce-human-escalation-configure/scripts/verify-and-configure.sh +705 -0
  39. package/skills/service-agentforce-human-escalation-configure/scripts/verify-escalation-config.mjs +89 -0
  40. package/skills/service-de-channel-routing-configure/SKILL.md +13 -5
  41. package/skills/service-de-channel-routing-configure/scripts/tests/test_skill_contract.py +25 -0
  42. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +23 -10
  43. package/skills/service-itsm-agentic-setup-agentforce-coordinate/examples/output-templates.md +63 -48
  44. package/skills/service-itsm-agentic-setup-agentforce-coordinate/scripts/verify-child-verdict.mjs +6 -2
  45. package/skills/service-omni-agent-users-create/SKILL.md +96 -0
  46. package/skills/service-omni-agent-users-create/assets/create-users.apex.template +80 -0
  47. package/skills/service-omni-agent-users-create/references/apex-patterns.md +135 -0
  48. package/skills/service-omni-agent-users-create/references/apex-template-notes.md +40 -0
  49. package/skills/service-omni-agent-users-create/scripts/detect-and-create.sh +206 -0
  50. package/skills/service-omni-agent-users-create/scripts/detect-existing.sh +122 -0
  51. package/skills/service-omni-agent-users-create/scripts/run-create.sh +298 -0
  52. package/skills/service-omni-agent-users-create/scripts/tests/test_user_create_security.py +171 -0
  53. package/skills/service-omni-agent-work-sharing-configure/SKILL.md +78 -0
  54. package/skills/service-omni-agent-work-sharing-configure/references/api-notes.md +31 -0
  55. package/skills/service-omni-agent-work-sharing-configure/scripts/configure-and-report.sh +186 -0
  56. package/skills/service-omni-agent-work-sharing-configure/scripts/tests/_bootstrap.py +120 -0
  57. package/skills/service-omni-agent-work-sharing-configure/scripts/tests/test_agent_work_sharing_contracts.py +93 -0
  58. package/skills/service-omni-base-settings-configure/SKILL.md +77 -0
  59. package/skills/service-omni-base-settings-configure/assets/force-app/main/default/settings/OmniChannel.settings-meta.xml +8 -0
  60. package/skills/service-omni-base-settings-configure/assets/package.xml +8 -0
  61. package/skills/service-omni-base-settings-configure/assets/sfdx-project.json +12 -0
  62. package/skills/service-omni-base-settings-configure/references/api-notes.md +121 -0
  63. package/skills/service-omni-base-settings-configure/scripts/configure-and-report.sh +164 -0
  64. package/skills/service-omni-base-settings-configure/scripts/detect-existing.sh +69 -0
  65. package/skills/service-omni-channel-setup-coordinate/SKILL.md +168 -0
  66. package/skills/service-omni-channel-setup-coordinate/examples/output-templates.md +161 -0
  67. package/skills/service-omni-channel-setup-coordinate/references/gap-catalog.md +99 -0
  68. package/skills/service-omni-channel-setup-coordinate/scripts/integration-driver.sh +1542 -0
  69. package/skills/service-omni-channel-setup-coordinate/scripts/tests/__init__.py +0 -0
  70. package/skills/service-omni-channel-setup-coordinate/scripts/tests/_bootstrap.py +223 -0
  71. package/skills/service-omni-channel-setup-coordinate/scripts/tests/test_omni_contracts.py +804 -0
  72. package/skills/service-omni-command-center-analyze/SKILL.md +84 -0
  73. package/skills/service-omni-command-center-analyze/references/api-notes.md +54 -0
  74. package/skills/service-omni-command-center-analyze/scripts/analyze.sh +198 -0
  75. package/skills/service-omni-command-center-analyze/scripts/tests/_bootstrap.py +115 -0
  76. package/skills/service-omni-command-center-analyze/scripts/tests/test_command_center_analyze_contracts.py +165 -0
  77. package/skills/service-omni-permission-set-assign/SKILL.md +88 -0
  78. package/skills/service-omni-permission-set-assign/assets/package.xml +8 -0
  79. package/skills/service-omni-permission-set-assign/references/api-notes.md +143 -0
  80. package/skills/service-omni-permission-set-assign/scripts/verify-and-assign.sh +397 -0
  81. package/skills/service-omni-presence-status-deploy/SKILL.md +87 -0
  82. package/skills/service-omni-presence-status-deploy/assets/package.xml +12 -0
  83. package/skills/service-omni-presence-status-deploy/references/api-notes.md +115 -0
  84. package/skills/service-omni-presence-status-deploy/scripts/deploy-and-report.sh +422 -0
  85. package/skills/service-omni-presence-user-config-deploy/SKILL.md +80 -0
  86. package/skills/service-omni-presence-user-config-deploy/references/api-notes.md +60 -0
  87. package/skills/service-omni-presence-user-config-deploy/scripts/deploy-and-report.sh +261 -0
  88. package/skills/service-omni-presence-user-config-deploy/scripts/tests/_bootstrap.py +106 -0
  89. package/skills/service-omni-presence-user-config-deploy/scripts/tests/test_presence_user_config_contracts.py +142 -0
  90. package/skills/service-omni-queue-deploy/SKILL.md +91 -0
  91. package/skills/service-omni-queue-deploy/references/api-notes.md +140 -0
  92. package/skills/service-omni-queue-deploy/scripts/verify-and-align.sh +470 -0
  93. package/skills/service-omni-queue-members-assign/SKILL.md +93 -0
  94. package/skills/service-omni-queue-members-assign/references/api-notes.md +144 -0
  95. package/skills/service-omni-queue-members-assign/scripts/tests/_bootstrap.py +67 -0
  96. package/skills/service-omni-queue-members-assign/scripts/tests/test_queue_members_contracts.py +73 -0
  97. package/skills/service-omni-queue-members-assign/scripts/verify-and-bind.sh +362 -0
  98. package/skills/service-omni-queue-routing-config-deploy/SKILL.md +101 -0
  99. package/skills/service-omni-queue-routing-config-deploy/references/api-notes.md +127 -0
  100. package/skills/service-omni-queue-routing-config-deploy/scripts/tests/_bootstrap.py +90 -0
  101. package/skills/service-omni-queue-routing-config-deploy/scripts/tests/test_queue_routing_config_contracts.py +70 -0
  102. package/skills/service-omni-queue-routing-config-deploy/scripts/upsert-and-report.sh +538 -0
  103. package/skills/service-omni-routing-flow-deploy/SKILL.md +111 -0
  104. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_Case_Trigger.SkillsBased.flow-meta.xml +94 -0
  105. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_Case_Trigger.flow-meta.xml +88 -0
  106. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_Cases.flow-meta.xml +144 -0
  107. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_VoiceCall_Trigger.SkillsBased.flow-meta.xml +94 -0
  108. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_VoiceCall_Trigger.flow-meta.xml +88 -0
  109. package/skills/service-omni-routing-flow-deploy/assets/force-app/main/default/flows/Omni_Route_VoiceCalls.flow-meta.xml +144 -0
  110. package/skills/service-omni-routing-flow-deploy/assets/package.xml +11 -0
  111. package/skills/service-omni-routing-flow-deploy/assets/sfdx-project.json +11 -0
  112. package/skills/service-omni-routing-flow-deploy/references/api-notes.md +265 -0
  113. package/skills/service-omni-routing-flow-deploy/scripts/deploy-and-report.sh +684 -0
  114. package/skills/service-omni-service-channel-configure/SKILL.md +83 -0
  115. package/skills/service-omni-service-channel-configure/assets/force-app/main/default/serviceChannels/Cases.serviceChannel-meta.xml +9 -0
  116. package/skills/service-omni-service-channel-configure/assets/force-app/main/default/serviceChannels/Incidents.serviceChannel-meta.xml +9 -0
  117. package/skills/service-omni-service-channel-configure/assets/force-app/main/default/serviceChannels/MessagingSessions.serviceChannel-meta.xml +9 -0
  118. package/skills/service-omni-service-channel-configure/assets/force-app/main/default/serviceChannels/VoiceCalls.serviceChannel-meta.xml +9 -0
  119. package/skills/service-omni-service-channel-configure/assets/package.xml +11 -0
  120. package/skills/service-omni-service-channel-configure/assets/sfdx-project.json +12 -0
  121. package/skills/service-omni-service-channel-configure/references/api-notes.md +84 -0
  122. package/skills/service-omni-service-channel-configure/scripts/deploy-and-report.sh +383 -0
  123. package/skills/service-omni-sidebar-configure/SKILL.md +77 -0
  124. package/skills/service-omni-sidebar-configure/references/api-notes.md +51 -0
  125. package/skills/service-omni-sidebar-configure/scripts/enable-and-report.sh +315 -0
  126. package/skills/service-omni-sidebar-configure/scripts/tests/_bootstrap.py +142 -0
  127. package/skills/service-omni-sidebar-configure/scripts/tests/test_sidebar_contracts.py +139 -0
  128. package/skills/service-omni-skills-based-routing-configure/SKILL.md +81 -0
  129. package/skills/service-omni-skills-based-routing-configure/references/api-notes.md +50 -0
  130. package/skills/service-omni-skills-based-routing-configure/scripts/configure-and-report.sh +270 -0
  131. package/skills/service-omni-skills-based-routing-configure/scripts/tests/_bootstrap.py +120 -0
  132. package/skills/service-omni-skills-based-routing-configure/scripts/tests/test_sbr_contracts.py +129 -0
  133. package/skills/service-omni-supervisor-config-deploy/SKILL.md +97 -0
  134. package/skills/service-omni-supervisor-config-deploy/assets/force-app/main/default/omniSupervisorConfigs/Omni_Supervisor.omniSupervisorConfig-meta.xml +9 -0
  135. package/skills/service-omni-supervisor-config-deploy/assets/package.xml +8 -0
  136. package/skills/service-omni-supervisor-config-deploy/assets/sfdx-project.json +12 -0
  137. package/skills/service-omni-supervisor-config-deploy/references/api-notes.md +205 -0
  138. package/skills/service-omni-supervisor-config-deploy/scripts/deploy-and-report.sh +586 -0
  139. package/skills/service-omni-supervisor-config-deploy/scripts/tests/_bootstrap.py +153 -0
  140. package/skills/service-omni-supervisor-config-deploy/scripts/tests/test_supervisor_config_contracts.py +116 -0
  141. package/skills/service-omni-supervisor-permset-assign/SKILL.md +88 -0
  142. package/skills/service-omni-supervisor-permset-assign/references/api-notes.md +48 -0
  143. package/skills/service-omni-supervisor-permset-assign/scripts/verify-and-assign.sh +316 -0
  144. package/skills/service-omni-supervisor-surface-deploy/SKILL.md +85 -0
  145. package/skills/service-omni-supervisor-surface-deploy/references/api-notes.md +47 -0
  146. package/skills/service-omni-supervisor-surface-deploy/scripts/deploy-and-report.sh +216 -0
  147. package/skills/service-omni-supervisor-surface-deploy/scripts/tests/_bootstrap.py +95 -0
  148. package/skills/service-omni-supervisor-surface-deploy/scripts/tests/test_supervisor_surface_contracts.py +154 -0
  149. package/skills/service-omni-supervisor-users-create/SKILL.md +92 -0
  150. package/skills/service-omni-supervisor-users-create/assets/create-supervisors.apex.template +72 -0
  151. package/skills/service-omni-supervisor-users-create/references/apex-patterns.md +73 -0
  152. package/skills/service-omni-supervisor-users-create/references/apex-template-notes.md +41 -0
  153. package/skills/service-omni-supervisor-users-create/scripts/detect-and-create.sh +197 -0
  154. package/skills/service-omni-supervisor-users-create/scripts/detect-existing.sh +112 -0
  155. package/skills/service-omni-supervisor-users-create/scripts/run-create.sh +296 -0
  156. package/skills/service-omni-work-skill-routing-configure/SKILL.md +80 -0
  157. package/skills/service-omni-work-skill-routing-configure/references/api-notes.md +67 -0
  158. package/skills/service-omni-work-skill-routing-configure/scripts/configure-and-report.sh +262 -0
  159. package/skills/service-omni-work-skill-routing-configure/scripts/tests/_bootstrap.py +121 -0
  160. package/skills/service-omni-work-skill-routing-configure/scripts/tests/test_work_skill_routing_contracts.py +161 -0
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ // Deterministic verdict from an evidence.json → { verdict, deterministicPass, directivePass, checks[], missing[] }; exit 3 on unparseable. evidence.json contract: references/classifier-contracts.md.
3
+
4
+ import { readFileSync } from 'node:fs';
5
+
6
+ const [evidencePath] = process.argv.slice(2);
7
+ if (!evidencePath) {
8
+ process.stderr.write('usage: node verify-escalation-config.mjs <evidence.json>\n');
9
+ process.exit(2);
10
+ }
11
+
12
+ let e;
13
+ try {
14
+ const text = readFileSync(evidencePath, 'utf8').trim();
15
+ e = text ? JSON.parse(text) : {};
16
+ } catch {
17
+ process.stderr.write(`error: could not read/parse ${evidencePath}\n`);
18
+ process.exit(3);
19
+ }
20
+
21
+ const nonEmpty = (v) => typeof v === 'string' && v.trim() !== '';
22
+ const flowNamesMatch =
23
+ nonEmpty(e.outboundRouteName) &&
24
+ nonEmpty(e.expectedFlowName) &&
25
+ e.outboundRouteName === e.expectedFlowName;
26
+
27
+ // The outbound route is only real when the SAME planner-surface block carries a matching
28
+ // route name AND an OmniChannelFlow route type, on a Messaging-class surface. A bundle that
29
+ // has the right name and an OmniChannelFlow type in unrelated blocks must NOT pass.
30
+ const outboundRouteWired =
31
+ flowNamesMatch &&
32
+ e.outboundRouteType === 'OmniChannelFlow' &&
33
+ e.outboundRouteSameBlock === true &&
34
+ e.outboundRouteMessagingSurface === true;
35
+
36
+ // The routing-infrastructure half is authoring-model-agnostic - it is deterministic in both models.
37
+ const routingChecks = [
38
+ { key: 'outboundFlowActive', ok: nonEmpty(e.flowActiveVersionId), kind: 'deterministic' },
39
+ { key: 'humanQueue', ok: nonEmpty(e.queueId), kind: 'deterministic' },
40
+ { key: 'queueSobject', ok: e.queueSobjectPresent === true, kind: 'deterministic' },
41
+ { key: 'queueHasActiveDirectUserMember', ok: e.queueHasActiveDirectUserMember === true, kind: 'deterministic' },
42
+ { key: 'queueRoutingConfig', ok: e.queueRoutingConfigPresent === true, kind: 'deterministic' },
43
+ { key: 'queueRoutingConfigBound', ok: e.queueRoutingConfigBound === true, kind: 'deterministic' },
44
+ { key: 'agentActive', ok: e.agentActive === true, kind: 'deterministic' },
45
+ ];
46
+
47
+ // Model-specific agent surface: classic authors canEscalate + a same-block Messaging outboundRoute;
48
+ // NGA verifies a reachable @utils.escalate (Service) or create-record (Employee) in the AiAuthoringBundle.
49
+ const authoringModel = e.authoringModel === 'nga' ? 'nga' : 'classic';
50
+ const surfaceChecks =
51
+ authoringModel === 'nga'
52
+ ? [{ key: 'ngaEscalationSurface', ok: e.ngaEscalationSurfacePresent === true, kind: 'deterministic' }]
53
+ : [
54
+ { key: 'canEscalate', ok: e.canEscalate === true, kind: 'deterministic' },
55
+ { key: 'outboundRouteConfigs', ok: outboundRouteWired, kind: 'deterministic' },
56
+ ];
57
+
58
+ const checks = [
59
+ ...surfaceChecks,
60
+ ...routingChecks,
61
+ { key: 'thresholdDirective', ok: e.thresholdAuthored === true, kind: 'directive' },
62
+ ];
63
+
64
+ const deterministic = checks.filter((c) => c.kind === 'deterministic');
65
+ const deterministicPass = deterministic.every((c) => c.ok);
66
+ const directivePass = checks.find((c) => c.key === 'thresholdDirective').ok;
67
+ const missing = checks.filter((c) => !c.ok).map((c) => c.key);
68
+
69
+ const defaultFailureThreshold =
70
+ Number.isInteger(e.defaultFailureThreshold) ? e.defaultFailureThreshold : null;
71
+
72
+ // A missing failure-threshold directive must NOT read as fully CONFIGURED: routing can be complete
73
+ // while the escalation policy (default two-failure / password-reset override) is not yet guaranteed.
74
+ // Distinguish the three cases so a policy gap is never hidden behind a green verdict.
75
+ const verdict = !deterministicPass
76
+ ? 'INCOMPLETE'
77
+ : directivePass
78
+ ? 'CONFIGURED'
79
+ : 'ROUTING_CONFIGURED_POLICY_PENDING';
80
+
81
+ process.stdout.write(JSON.stringify({
82
+ verdict,
83
+ authoringModel,
84
+ deterministicPass,
85
+ directivePass,
86
+ defaultFailureThreshold,
87
+ checks,
88
+ missing,
89
+ }, null, 2) + '\n');
@@ -8,6 +8,8 @@ metadata:
8
8
  cliTools:
9
9
  - tool: ["node"]
10
10
  semver: ">=20.0.0"
11
+ - tool: ["python3"]
12
+ semver: ">=3.9"
11
13
  - tool: ["sf"]
12
14
  semver: ">=2.0.0"
13
15
  relatedSkills:
@@ -53,7 +55,7 @@ Provisioning behavior:
53
55
 
54
56
  ## When NOT to use this skill
55
57
 
56
- - **The channel already has `SessionHandlerId` or `FallbackQueueId` set.** This skill no-ops and tells you — nothing to do. Proceed to activation.
58
+ - **The channel already has `SessionHandlerId` or `FallbackQueueId` set.** This skill revalidates the existing target before no-op. An ASA must still have a BotUser and an Active BotVersion; otherwise it reports `asa-target-inactive` and does not claim readiness.
57
59
  - **The channel doesn't exist yet.** Run the insertion skill first; this skill expects a real `MessagingChannel.Id`.
58
60
  - **You want to replace existing routing.** Safer to clear `SessionHandlerId` manually in the UI, then re-run this skill. The no-op check is a guardrail, not a limitation worth bypassing automatically.
59
61
 
@@ -127,13 +129,13 @@ sf data query --target-org '{ORG_ALIAS}' \
127
129
 
128
130
  Parse with `node -e` or `jq`. If the record is missing — halt with `Error: Channel {CHANNEL_ID} not found — check the id, or run the insertion skill first.`
129
131
 
130
- If `SessionHandlerId` is non-null, branch on the Id prefix to figure out what the existing routing target is, then no-op with the right envelope. The prefix maps 1:1 to the SessionHandler domain (verified against `MessagingChannel.entity.xml`):
132
+ If `SessionHandlerId` is non-null, branch on the Id prefix to figure out what the existing routing target is, then no-op with the right envelope. The prefix maps 1:1 to the SessionHandler domain (verified against `MessagingChannel.entity.xml`). Existing routing is not automatically healthy: the target lookup must return exactly one eligible row before reporting a successful no-op.
131
133
 
132
134
  | Prefix | Domain / Target | Lookup query | routingType |
133
135
  | --- | --- | --- | --- |
134
136
  | `00G` | `Group` (Type=Queue) | `SELECT Id, Name, DeveloperName FROM Group WHERE Id='<sh>' AND Type='Queue'` | `queue` |
135
137
  | `300` | `FlowDefinition` | `SELECT DurableId, Label, ApiName FROM FlowDefinitionView WHERE DurableId='<sh>'` | `flow` |
136
- | `0Xx` | `BotDefinition` (ASA) | `SELECT Id, DeveloperName, MasterLabel, AgentType FROM BotDefinition WHERE Id='<sh>'` | `asa` |
138
+ | `0Xx` | `BotDefinition` (ASA) | `SELECT Id, DeveloperName, MasterLabel, AgentType, BotUserId, (SELECT Id, Status FROM BotVersions WHERE Status='Active' LIMIT 1) FROM BotDefinition WHERE Id='<sh>'` | `asa` |
137
139
  | `1iE` | `AgenticCtxtDecorDefinition` (Digital Worker) | `SELECT Id, DeveloperName, MasterLabel FROM AgenticCtxtDecorDefinition WHERE Id='<sh>'` | `digital_worker` |
138
140
  | `005` | `User` | `SELECT Id, Name FROM User WHERE Id='<sh>'` | `user` |
139
141
 
@@ -143,14 +145,20 @@ PREFIX="${SESSION_HANDLER_ID:0:3}"
143
145
  case "$PREFIX" in
144
146
  00G) sf data query --target-org '{ORG_ALIAS}' --query "SELECT Id, Name, DeveloperName FROM Group WHERE Id = '$SESSION_HANDLER_ID' AND Type = 'Queue'" --json > /tmp/ccr-noop-target.json ;;
145
147
  300) sf data query --target-org '{ORG_ALIAS}' --query "SELECT DurableId, Label, ApiName FROM FlowDefinitionView WHERE DurableId = '$SESSION_HANDLER_ID'" --json > /tmp/ccr-noop-target.json ;;
146
- 0Xx) sf data query --target-org '{ORG_ALIAS}' --query "SELECT Id, DeveloperName, MasterLabel, AgentType FROM BotDefinition WHERE Id = '$SESSION_HANDLER_ID'" --json > /tmp/ccr-noop-target.json ;;
148
+ 0Xx) sf data query --target-org '{ORG_ALIAS}' --query "SELECT Id, DeveloperName, MasterLabel, AgentType, BotUserId, (SELECT Id, Status FROM BotVersions WHERE Status='Active' LIMIT 1) FROM BotDefinition WHERE Id = '$SESSION_HANDLER_ID'" --json > /tmp/ccr-noop-target.json ;;
147
149
  1iE) sf data query --target-org '{ORG_ALIAS}' --query "SELECT Id, DeveloperName, MasterLabel FROM AgenticCtxtDecorDefinition WHERE Id = '$SESSION_HANDLER_ID'" --json > /tmp/ccr-noop-target.json ;;
148
150
  005) sf data query --target-org '{ORG_ALIAS}' --query "SELECT Id, Name FROM User WHERE Id = '$SESSION_HANDLER_ID'" --json > /tmp/ccr-noop-target.json ;;
149
151
  *) echo "{\"records\":[{\"Id\":\"$SESSION_HANDLER_ID\"}]}" > /tmp/ccr-noop-target.json ;;
150
152
  esac
151
153
  ```
152
154
 
153
- Report the success-noop envelope (include the existing `FallbackQueueId` from the Stage 1 read) and return.
155
+ For an existing ASA (`0Xx`), require a non-null `BotUserId` and one returned `BotVersions` row with `Status='Active'`. If either is missing, return the following failure instead of a successful no-op. Do not clear or replace the channel routing automatically:
156
+
157
+ ```json
158
+ {"ok":false,"kind":"asa-target-inactive","routingType":"asa","sessionHandlerId":"0Xx...","hint":"The configured Agentforce Service Agent has no BotUser or active BotVersion. Activate the agent in Setup, then re-run routing validation."}
159
+ ```
160
+
161
+ For other prefixes, require exactly one target lookup row. Report the success-noop envelope (include the existing `FallbackQueueId` from the Stage 1 read) only after the target-specific eligibility check succeeds, then return.
154
162
 
155
163
  If `FallbackQueueId` is non-null but `SessionHandlerId` is null — still no-op. That's a partially-configured Flow/ASA state; don't touch it, but flag it in the envelope `message` (`"FallbackQueue set but SessionHandler null — incomplete routing, review in Setup"`) since activation will still fail readiness without a SessionHandler.
156
164
 
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env python3
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+
6
+ class ExistingAsaRouteTests(unittest.TestCase):
7
+ def test_noop_revalidates_bot_user_and_active_version(self):
8
+ skill = Path(__file__).resolve().parents[2] / "SKILL.md"
9
+ source = skill.read_text()
10
+ noop_contract = source.split(
11
+ "If `SessionHandlerId` is non-null", 1
12
+ )[1].split("For other prefixes", 1)[0]
13
+
14
+ self.assertIn("0Xx) sf data query", noop_contract)
15
+ self.assertIn("BotUserId", noop_contract)
16
+ self.assertIn("WHERE Status='Active'", noop_contract)
17
+ self.assertIn("require a non-null `BotUserId`", noop_contract)
18
+ self.assertIn(
19
+ '{"ok":false,"kind":"asa-target-inactive"',
20
+ noop_contract,
21
+ )
22
+
23
+
24
+ if __name__ == "__main__":
25
+ unittest.main(verbosity=2)
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  name: service-itsm-agentic-setup-agentforce-coordinate
3
- description: "Orchestrator for setting up Agentforce in Salesforce Service Cloud ITSM — Agentforce Studio enablement, the IT Service Fulfiller agent, the IT Service Employee agent, and specialized employee agents. Use when the user asks to set up Agentforce for ITSM, enable Studio and the Fulfiller/Employee agents together, wants a guided Agentforce ITSM walkthrough, or asks what Agentforce features are available for IT Service. Presents available Agentforce capabilities and delegates each selection to a specialized child skill while tracking progress. Triggers on: set up agentforce for itsm, configure agentforce studio and fulfiller, agentforce itsm walkthrough, what agentforce features for it service. DO NOT TRIGGER when: the user asks to enable Agentforce Studio alone, asks to create or activate the Fulfiller or Employee agent alone, or asks about CMDB, Incident Management, Teams, or general ITSM setup without Agentforce intent."
3
+ description: "Orchestrator for setting up Agentforce in Salesforce Service Cloud ITSM — Agentforce Studio enablement, the IT Service Fulfiller agent, the IT Service Employee agent, specialized employee agents, and human escalation. Use when the user asks to set up Agentforce for ITSM, enable Studio and the Fulfiller/Employee agents together, configure employee-agent escalation, wants a guided Agentforce ITSM walkthrough, or asks what Agentforce features are available for IT Service. Presents available Agentforce capabilities and delegates each selection to a specialized child skill while tracking progress. Triggers on: set up agentforce for itsm, configure agentforce studio and fulfiller, agentforce itsm walkthrough, what agentforce features for it service. DO NOT TRIGGER when: the user asks to enable Agentforce Studio alone, asks to create or activate the Fulfiller or Employee agent alone, asks to configure escalation alone, or asks about CMDB, Incident Management, Teams, or general ITSM setup without Agentforce intent."
4
4
  metadata:
5
- version: "1.7"
5
+ version: "1.8"
6
6
  domains: ["Service", "Agentforce"]
7
7
  relatedSkills:
8
+ - "service-agentforce-human-escalation-configure"
8
9
  - "service-itsm-agentic-setup-agentforce-studio-configure"
9
10
  - "service-itsm-agentic-setup-agentforce-studio-validate"
10
11
  - "service-itsm-agentic-setup-employee-agent-configure"
@@ -20,7 +21,7 @@ allowed-tools: Read Bash Write AskUserQuestion
20
21
 
21
22
  # Agentforce for ITSM Setup Orchestrator
22
23
 
23
- Guide the user through setting up Agentforce Studio, the IT Service Fulfiller agent, the IT Service Employee agent, and specialized employee agents in Salesforce Service Cloud ITSM by presenting the available capabilities, delegating to specialized child skills, and tracking progress.
24
+ Guide the user through setting up Agentforce Studio, the IT Service Fulfiller agent, the IT Service Employee agent, specialized employee agents, and Employee-Agent to human escalation in Salesforce Service Cloud ITSM by presenting the available capabilities, delegating to specialized child skills, and tracking progress.
24
25
 
25
26
  ## Goal
26
27
 
@@ -52,22 +53,25 @@ activate agent templates** (the Fulfiller and Employee agents). This separation
52
53
  Stage 1 *enables* org-level platform toggles/preferences, while Stage 2 *installs and activates*
53
54
  agents from a template — they are distinct kinds of action and must read as distinct stages, not one
54
55
  undifferentiated list. Only features with a working child skill appear in the menu — use the
55
- **Feature menu** template in `examples/output-templates.md`. Collect the user's selections through a single multi-select prompt (use `AskUserQuestion` with `multiSelect: true` when tooling permits, otherwise ask the user to reply with a list of numbers such as `1, 2`). Use the **exact Item names from the Feature menu table** as the multi-select option labels — verbatim, including each item's parenthetical note and the word "Agent" and its capitalization (`Agentforce Studio enablement (Foundation for all agents)`, `IT Service Fulfiller Agent`, `IT Service Employee Agent`, `Specialized Agents for Employee`) — so the picker options and the table never diverge. Each item's **Description column matches the wording on the Salesforce Setup → Agentforce for IT Service page** (the Fulfiller and Employee agent-template descriptions and the Specialized Agents for Employee text are used verbatim) so a user evaluating which template to install reads the same purpose/scope here as they would in Setup — do not paraphrase or shorten that product copy. For the three Stage 2 agent items, follow the verbatim product copy with one short trailing `Setup:` line stating what installing does (`Setup: creates the agent from this template and activates a version.` for the Fulfiller and Employee agents; `Setup: pick one specialized template (e.g. Password Manager, Onboarding), then create and activate that standalone agent. Re-run this item to add more.` for Specialized Agents for Employee, for which you first ask the user which specialized template they want and pass that name to the child skill) so a single row carries purpose, scope, and the install action together. The Stage 1 row (Agentforce Studio enablement) is a platform-enablement toggle, not a template install, so it carries no `Setup:` line. When raising `AskUserQuestion`, put that same Description text (product copy + the `Setup:` line) in each option's `description` field so the picker carries the detail too. Do NOT show placeholder features that cannot be executed.
56
+ **Feature menu** template in `examples/output-templates.md`. Collect the user's selections through a single multi-select prompt (use `AskUserQuestion` with `multiSelect: true` when tooling permits, otherwise ask the user to reply with a list of numbers such as `1, 2`). Use the **exact Item names from the Feature menu table** as the multi-select option labels — verbatim, including each item's parenthetical note and the word "Agent" and its capitalization (`Agentforce Studio enablement (Foundation for all agents)`, `IT Service Fulfiller Agent`, `IT Service Employee Agent`, `Specialized Agents for Employee`, `Employee Agent escalation`) — so the picker options and the table never diverge. Each item's **Description column matches the wording on the Salesforce Setup → Agentforce for IT Service page** (the Fulfiller and Employee agent-template descriptions and the Specialized Agents for Employee text are used verbatim) so a user evaluating which template to install reads the same purpose/scope here as they would in Setup — do not paraphrase or shorten that product copy. For the three Stage 2 agent items, follow the verbatim product copy with one short trailing `Setup:` line stating what installing does (`Setup: creates the agent from this template and activates a version.` for the Fulfiller and Employee agents; `Setup: pick one specialized template (e.g. Password Manager, Onboarding), then create and activate that standalone agent. Re-run this item to add more.` for Specialized Agents for Employee, for which you first ask the user which specialized template they want and pass that name to the child skill) so a single row carries purpose, scope, and the install action together. The Stage 1 row (Agentforce Studio enablement) is a platform-enablement toggle, not a template install, so it carries no `Setup:` line. When raising `AskUserQuestion`, put that same Description text (product copy + the `Setup:` line) in each option's `description` field so the picker carries the detail too. Do NOT show placeholder features that cannot be executed.
56
57
 
57
58
  **Report file (harness / non-interactive runs).** If a `${outputDir}` is provided (via the harness's generated-file location directive), write the menu emission (attribution header + feature table with status + delegation targets + dependency signal + the multi-select prompt itself) to `${outputDir}/report.md` **before** raising `AskUserQuestion` — so the report file always exists even when the harness parks at the confirmation gate. Overwrite the same file after each feature completes with the updated status table. Skip these writes when running interactively for a user in a chat surface — write only when `${outputDir}` was passed as an explicit destination.
58
59
 
59
60
  ### 4. Delegate to child skills in dependency order
60
61
 
61
- **Studio-first rule (unconditional).** If Agentforce Studio enablement (#1) is in the user's selection and not already done, run it **first**, always — regardless of the order the user listed their numbers in. The Fulfiller Agent (#2), Employee Agent (#3), and Specialized Agents for Employee (#4) all depend on Studio being enabled and will fail if attempted first. Reorder the queue silently so Studio runs before any agent. This rule is non-negotiable and applies whether the user selected two features (Studio + one agent) or everything.
62
+ **Studio-first rule (unconditional).** If Agentforce Studio enablement (#1) is in the user's selection and not already done, run it **first**, always — regardless of the order the user listed their numbers in. The Fulfiller Agent (#2), Employee Agent (#3), and Specialized Agents for Employee (#4) all depend on Studio being enabled and will fail if attempted first. Reorder the queue silently so Studio runs before any agent. This rule is non-negotiable and applies whether the user selected two features (Studio + one agent) or everything. Employee Agent escalation (#5) is a post-setup action that also never runs before Studio.
62
63
 
63
64
  **User-order rule (among #2, #3, and #4 only).** The Fulfiller Agent (#2), Employee Agent (#3), and Specialized Agents for Employee (#4) are independent of each other — none depends on the others. If more than one is selected, run them in the order the user listed them (default 2 → 3 → 4 when unspecified). This rule applies **only** to the ordering among #2, #3, and #4; it never overrides the Studio-first rule above.
64
65
 
66
+ **Escalation-after-Employee rule (#5 depends on #3).** Employee Agent escalation (#5) configures the Employee agent's hand-off to a human, so it **requires the Employee Agent (#3) to exist and be Active** first. If #5 is selected, ensure #3 has completed successfully in this run (or was already done) before delegating to it; otherwise queue #3 ahead of #5. #5 never runs before Studio (#1) either.
67
+
65
68
  | # | Feature | Stage | Child Skill |
66
69
  |---|---------|-------|-------------|
67
70
  | 1 | Agentforce Studio enablement (Foundation for all agents) | 1 | `service-itsm-agentic-setup-agentforce-studio-configure` |
68
71
  | 2 | IT Service Fulfiller Agent | 2 | `service-itsm-agentic-setup-fulfiller-agent-configure` |
69
72
  | 3 | IT Service Employee Agent | 2 | `service-itsm-agentic-setup-employee-agent-configure` |
70
73
  | 4 | Specialized Agents for Employee | 2 | `service-itsm-agentic-setup-employee-agent-configure` |
74
+ | 5 | Employee Agent escalation | Post | `service-agentforce-human-escalation-configure` (pass the IT scenario inputs: agent `IT_Service_Employee_Agent`, queue `General_IT_Queue`, `CONTEXT_OBJECT=MessagingSession`) |
71
75
 
72
76
  **How #3 and #4 relate.** Both #3 and #4 delegate to the same child skill,
73
77
  `service-itsm-agentic-setup-employee-agent-configure` — the difference is which template it installs.
@@ -95,9 +99,10 @@ to call it as part of the delegation flow above.
95
99
  Once a child skill finishes:
96
100
 
97
101
  1. **Verify** the child skill's own deterministic verdict by running
98
- `node "<skill_dir>/scripts/verify-child-verdict.mjs" <studio|fulfiller|employee> <verdict>` — never
102
+ `node "<skill_dir>/scripts/verify-child-verdict.mjs" <studio|fulfiller|employee|escalation> <verdict>` — never
99
103
  re-derive the success/failure comparison in prose. Pass Studio's `overall` field from
100
- `classify-final-report.mjs`, or Fulfiller/Employee Agent's Phase 8 aggregate verdict, as
104
+ `classify-final-report.mjs`, Fulfiller/Employee Agent's Phase 8 aggregate verdict, or the escalation
105
+ leaf's `status` (`CONFIGURED`/`ALREADY-CONFIGURED`), as
101
106
  `<verdict>`. Exit code `0` means advance; exit code `1` means **stop and surface the failure in
102
107
  plain language — do not advance to the next feature in the queue.** A partially-enabled Studio
103
108
  (e.g. Einstein GenAI on but the parent umbrella still blocked, `overall: PARTIAL`) will make
@@ -115,8 +120,9 @@ When the user says they're done (or all available features are configured), pres
115
120
 
116
121
  ## Setup Stages & Recommended Order
117
122
 
118
- Setup runs in **two sequential stages**. Stage 1 (enable platform features) must complete before
119
- Stage 2 (install & activate agent templates).
123
+ Setup runs in **two sequential setup stages**, followed by optional post-setup escalation. Stage 1
124
+ (enable platform features) must complete before Stage 2 (install & activate agent templates).
125
+ Escalation runs only after the Employee agent is active.
120
126
 
121
127
  ```text
122
128
  Stage 1 — Foundation: enable platform features
@@ -126,6 +132,9 @@ Stage 2 — Agent templates: install & activate (only after Stage 1)
126
132
  2. IT Service Fulfiller Agent (install from template, commit, and activate the agent)
127
133
  3. IT Service Employee Agent (install the broad employee agent from its template and activate it)
128
134
  4. Specialized Agents for Employee (install a specialized employee agent — user picks the template — and activate it)
135
+
136
+ Post-setup — Human escalation (only after item 3 is active)
137
+ 5. Employee Agent escalation (configure canEscalate, outbound routing, a staffed General IT queue, and failure-threshold directives)
129
138
  ```
130
139
 
131
140
  Stage 1 (Agentforce Studio enablement) is the **foundation**: it turns on the org-level Agentforce
@@ -135,7 +144,9 @@ before this foundation is enabled will fail. The three Stage 2 items (Fulfiller,
135
144
  Specialized Agents for Employee) are independent siblings (none depends on the others) — they can be
136
145
  selected together and installed in any order once Stage 1 is done. Specialized Agents for Employee
137
146
  is listed right after the IT Service Employee Agent because both build employee agents from the same
138
- child skill: #3 the broad default, #4 a specialized template the user chooses.
147
+ child skill: #3 the broad default, #4 a specialized template the user chooses. Employee Agent
148
+ escalation (#5) is a post-setup action that builds on a live Employee agent, so it runs only after
149
+ item 3 has succeeded.
139
150
 
140
151
  ---
141
152
 
@@ -149,6 +160,7 @@ child skill: #3 the broad default, #4 a specialized template the user chooses.
149
160
  - If the user says "set up everything" or "all", walk through each available feature sequentially in the recommended order, confirming between each step
150
161
  - Track progress across the conversation — do not re-present completed features as "Not done"
151
162
  - Specialized Agents for Employee (#4) is **re-selectable** — each run builds a *different* specialized employee agent from a template the user picks. Mark the agent just built as `Done`, but keep #4 available to run again for additional specialized agents; do not treat a completed #4 as permanently finished the way #1–#3 are. If the user picks #4 again, ask which specialized template to use next
163
+ - Employee Agent escalation (#5) is a **post-setup** action that requires the IT Service Employee Agent (#3) to be Active first — never delegate #5 before #3 has succeeded in this run (or was already done)
152
164
  - NEVER advance to the next feature in the queue if the current one failed or only partially
153
165
  succeeded — stop and surface the failure in plain language instead
154
166
  - If Agentforce Studio enablement reports the org lacks the Agentforce license (`accessCheck`), STOP
@@ -176,6 +188,7 @@ Before emitting any menu or summary in this skill, mentally confirm each of the
176
188
  - [ ] Each feature row's `Status` column reflects the actual tracked state from the conversation (`Not done`, `In progress`, or `Done`) — not a hard-coded default
177
189
  - [ ] Each feature row's `Description` matches the Salesforce Setup → Agentforce for IT Service page wording (Fulfiller and Employee agent-template descriptions verbatim, not paraphrased), the three Stage 2 rows each end with a short `Setup:` install line, and the `AskUserQuestion` option descriptions carry the same text
178
190
  - [ ] The Specialized Agents for Employee row is present as a Stage 2 item shown right after the IT Service Employee Agent, and #4 is never delegated to `service-itsm-agentic-setup-employee-agent-configure` without first asking the user which specialized template they want (handed no name, the child skill defaults to the broad agent and duplicates #3), and it carries its `Setup:` install line
191
+ - [ ] The Employee Agent escalation row is present as a post-setup item shown after the Stage 2 agents, and #5 is never delegated to `service-agentforce-human-escalation-configure` before the IT Service Employee Agent (#3) is Active
179
192
  - [ ] For a completion summary, the header line and closing line are chosen by the rubric in `examples/output-templates.md` (all `Done` → *Complete*; any `Not done`/`In progress` → *Finished*)
180
193
  - [ ] A feature is being configured only because the user explicitly selected it (or is being walked through sequentially with confirmation under an "all" / "everything" request)
181
194
  - [ ] Studio enablement is verified done before delegating to any Stage 2 agent (Fulfiller, Employee, or Specialized Agents for Employee)
@@ -1,39 +1,43 @@
1
1
  # Output Templates — service-itsm-agentic-setup-agentforce-coordinate
2
2
 
3
3
  Emit one of these text blocks at the corresponding step in the workflow. Setup is presented as
4
- **two sequential stages** — Stage 1 (enable platform features) must finish before Stage 2 (install
5
- & activate agent templates). Only items with a working child skill appear — hide placeholder rows.
4
+ **two sequential setup stages** — Stage 1 (enable platform features) must finish before Stage 2
5
+ (install & activate agent templates). Optional Employee Agent escalation follows Stage 2 and runs
6
+ only after the Employee agent is active. Only items with a working child skill appear — hide
7
+ placeholder rows.
6
8
 
7
9
  ## Feature menu (Behavior step 3)
8
10
 
9
11
  ```text
10
12
  Agentforce for ITSM Setup (via service-itsm-agentic-setup-agentforce-coordinate)
11
13
 
12
- Here are the features available for Agentforce ITSM. Set them up in two stages —
13
- Stage 1 (enable) must finish before Stage 2 (install & activate):
14
-
15
- ┌───┬─────────┬──────────────────────────────┬────────────────────────────────────────────────────────┬──────────┐
16
- │ # │ Stage │ Item │ Description │ Status │
17
- ├───┼─────────┼──────────────────────────────┼────────────────────────────────────────────────────────┼──────────┤
18
- │ 1 │ Stage 1 │ Agentforce Studio enablement │ Turn on org-level Agentforce, Einstein GenAI, and IT │ Not done │
19
- │ │ │ (Foundation for all agents) │ Service agent features │ │
20
- │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Automate actions and simplify critical asks for IT │ Not done │
21
- │ │ │ │ service fulfillers who work with incidents, problems, │ │
22
- │ │ │ │ change requests and more to resolve issues and │ │
23
- │ │ │ │ requests. │ │
24
- │ │ │ │ Setup: creates the agent from this template and │ │
25
- │ │ │ │ activates a version. │ │
26
- │ 3 │ Stage 2 │ IT Service Employee Agent │ Help employees quickly troubleshoot IT issues, raise │ Not done │
27
- │ │ │ │ service requests, and track their incidents with ease. │ │
28
- │ │ │ │ Setup: creates the agent from this template and │ │
29
- │ │ │ │ activates a version. │ │
30
- │ 4 │ Stage 2 │ Specialized Agents │ Use the specialized templates and build agents that │ Not done │
31
- │ │ │ for Employee │ power your employee agent. Refine the agent logic, as │ │
32
- │ │ │ │ necessary, and then activate them. │ │
33
- │ │ │ │ Setup: pick one specialized template (e.g. Password │ │
34
- │ │ │ │ Manager, Onboarding), then create and activate that │ │
35
- │ │ │ │ standalone agent. Re-run this item to add more. │ │
36
- └───┴─────────┴──────────────────────────────┴────────────────────────────────────────────────────────┴──────────┘
14
+ Here are the features available for Agentforce ITSM. Stage 1 (enable) must finish before
15
+ Stage 2 (install & activate). Employee Agent escalation is available after the Employee agent is active:
16
+
17
+ ┌───┬─────────┬──────────────────────────────┬────────────────────────────────────────────────────────┬────────────────────┬──────────┐
18
+ │ # │ Stage │ Item │ Description │ Action │ Status │
19
+ ├───┼─────────┼──────────────────────────────┼────────────────────────────────────────────────────────┼────────────────────┼──────────┤
20
+ │ 1 │ Stage 1 │ Agentforce Studio enablement │ Turn on org-level Agentforce, Einstein GenAI, and IT │ Enable features │ Not done │
21
+ │ │ │ (Foundation for all agents) │ Service agent features │ │ │
22
+ │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Automate actions and simplify critical asks for IT │ Install + activate │ Not done │
23
+ │ │ │ │ service fulfillers who work with incidents, problems, │ │ │
24
+ │ │ │ │ change requests and more to resolve issues and │ │ │
25
+ │ │ │ │ requests. │ │ │
26
+ │ │ │ │ Setup: creates the agent from this template and │ │ │
27
+ │ │ │ │ activates a version. │ │ │
28
+ │ 3 │ Stage 2 │ IT Service Employee Agent │ Help employees quickly troubleshoot IT issues, raise │ Install + activate │ Not done │
29
+ │ │ │ │ service requests, and track their incidents with ease. │ │ │
30
+ │ │ │ │ Setup: creates the agent from this template and │ │ │
31
+ │ │ │ │ activates a version. │ │ │
32
+ │ 4 │ Stage 2 │ Specialized Agents │ Use the specialized templates and build agents that │ Install + activate │ Not done │
33
+ │ │ │ for Employee │ power your employee agent. Refine the agent logic, as │ │ │
34
+ │ │ │ │ necessary, and then activate them. │ │ │
35
+ │ │ │ │ Setup: pick one specialized template (e.g. Password │ │ │
36
+ │ │ │ │ Manager, Onboarding), then create and activate that │ │ │
37
+ │ │ │ │ standalone agent. Re-run this item to add more. │ │ │
38
+ │ 5 │ Post │ Employee Agent escalation │ Configure human handoff to the General IT queue with │ Configure handoff │ Not done │
39
+ │ │ setup │ │ failure-threshold directives. │ │ │
40
+ └───┴─────────┴──────────────────────────────┴────────────────────────────────────────────────────────┴────────────────────┴──────────┘
37
41
 
38
42
  Reply with the numbers of the features you want to set up (one or more, e.g. `1` or `1, 2`).
39
43
  If you pick a Stage 2 template without Stage 1, I'll enable the Stage 1 foundation first.
@@ -42,7 +46,8 @@ If you pick a Stage 2 template without Stage 1, I'll enable the Stage 1 foundati
42
46
  Stage 1 (Agentforce Studio enablement) is the **foundation** — it enables the org-level platform
43
47
  features every agent is built on. Stage 2 items (the Fulfiller agent, the Employee agent, and
44
48
  Specialized Agents for Employee) are **installed from a template and activated**; they can be set up
45
- in any order once Stage 1 is done.
49
+ in any order once Stage 1 is done. The post-setup Employee Agent escalation item requires the
50
+ Employee agent to be active.
46
51
 
47
52
  **Specialized Agents for Employee** is a third Stage 2 item, shown right after the IT Service
48
53
  Employee Agent to keep the two employee options together. Both use the same child skill
@@ -55,6 +60,12 @@ Service Employee Agent), and once given a name it disambiguates a partial or amb
55
60
  chosen template names the agent it creates. The specialized templates themselves are turned on in
56
61
  Stage 1; this item is where you build and activate an agent from them.
57
62
 
63
+ **Employee Agent escalation** is a post-setup item, shown after the Stage 2 agents. It delegates to
64
+ `service-agentforce-human-escalation-configure` and configures the Employee agent's hand-off to a
65
+ human — `canEscalate`, outbound routing, a staffed General IT queue, and failure-threshold
66
+ directives. It requires the IT Service Employee Agent to be Active first, so run it only after item 3
67
+ has succeeded.
68
+
58
69
  ## Post-feature progress (Behavior step 5)
59
70
 
60
71
  Example after Stage 1 (Agentforce Studio enablement) completes:
@@ -63,16 +74,18 @@ Example after Stage 1 (Agentforce Studio enablement) completes:
63
74
  Agentforce Studio — enabled successfully
64
75
  (via service-itsm-agentic-setup-agentforce-studio-configure)
65
76
 
66
- ┌───┬─────────┬──────────────────────────────┬─────────────┐
67
- │ # │ Stage │ Item │ Status │
68
- ├───┼─────────┼──────────────────────────────┼─────────────┤
69
- │ 1 │ Stage 1 │ Agentforce Studio enablement │ Done │
70
- │ │ │ (Foundation for all agents) │ │
71
- │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Not done │
72
- │ 3 │ Stage 2 │ IT Service Employee Agent │ Not done │
73
- │ 4 │ Stage 2 │ Specialized Agents │ Not done │
74
- │ │ │ for Employee │ │
75
- └───┴─────────┴──────────────────────────────┴─────────────┘
77
+ ┌───┬─────────┬───────────────────────────────┬─────────────┐
78
+ │ # │ Stage │ Item │ Status │
79
+ ├───┼─────────┼───────────────────────────────┼─────────────┤
80
+ │ 1 │ Stage 1 │ Agentforce Studio enablement │ Done │
81
+ │ │ │ (Foundation for all agents) │ │
82
+ │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Not done │
83
+ │ 3 │ Stage 2 │ IT Service Employee Agent │ Not done │
84
+ │ 4 │ Stage 2 │ Specialized Agents │ Not done │
85
+ │ │ │ for Employee │ │
86
+ │ 5 │ Post │ Employee Agent escalation │ Not done │
87
+ │ │ setup │ │ │
88
+ └───┴─────────┴───────────────────────────────┴─────────────┘
76
89
 
77
90
  Stage 1 (foundation) is enabled. On to Stage 2 — install and activate the IT
78
91
  Service Fulfiller agent, the IT Service Employee agent, and/or a specialized
@@ -103,16 +116,18 @@ Example — user finished after only enabling Agentforce Studio (the Stage 2 age
103
116
  Agentforce for ITSM Setup — Finished
104
117
  (via service-itsm-agentic-setup-agentforce-coordinate)
105
118
 
106
- ┌───┬─────────┬──────────────────────────────┬─────────────┐
107
- │ # │ Stage │ Item │ Status │
108
- ├───┼─────────┼──────────────────────────────┼─────────────┤
109
- │ 1 │ Stage 1 │ Agentforce Studio enablement │ Done │
110
- │ │ │ (Foundation for all agents) │ │
111
- │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Not done │
112
- │ 3 │ Stage 2 │ IT Service Employee Agent │ Not done │
113
- │ 4 │ Stage 2 │ Specialized Agents │ Not done │
114
- │ │ │ for Employee │ │
115
- └───┴─────────┴──────────────────────────────┴─────────────┘
119
+ ┌───┬─────────┬───────────────────────────────┬─────────────┐
120
+ │ # │ Stage │ Item │ Status │
121
+ ├───┼─────────┼───────────────────────────────┼─────────────┤
122
+ │ 1 │ Stage 1 │ Agentforce Studio enablement │ Done │
123
+ │ │ │ (Foundation for all agents) │ │
124
+ │ 2 │ Stage 2 │ IT Service Fulfiller Agent │ Not done │
125
+ │ 3 │ Stage 2 │ IT Service Employee Agent │ Not done │
126
+ │ 4 │ Stage 2 │ Specialized Agents │ Not done │
127
+ │ │ │ for Employee │ │
128
+ │ 5 │ Post │ Employee Agent escalation │ Not done │
129
+ │ │ setup │ │ │
130
+ └───┴─────────┴───────────────────────────────┴─────────────┘
116
131
 
117
132
  You have finished the items you selected. The remaining items can be
118
133
  resumed later by re-invoking this orchestrator.
@@ -7,7 +7,7 @@
7
7
  // exit code.
8
8
  //
9
9
  // Usage:
10
- // node verify-child-verdict.mjs <studio|fulfiller|employee> <verdict>
10
+ // node verify-child-verdict.mjs <studio|fulfiller|employee|escalation> <verdict>
11
11
  //
12
12
  // Exit 0 -> child succeeded, safe to advance the queue.
13
13
  // Exit 1 -> child failed or only partially succeeded, stop the queue.
@@ -17,12 +17,16 @@ const SUCCESS_VALUES = {
17
17
  studio: new Set(['SUCCESS']),
18
18
  fulfiller: new Set(['CREATED', 'ALREADY-CREATED', 'ACTIVATED']),
19
19
  employee: new Set(['CREATED', 'ALREADY-CREATED', 'ACTIVATED']),
20
+ // Employee-agent escalation leaf (service-agentforce-human-escalation-configure, IT scenario inputs)
21
+ // emits CONFIGURED when every deterministic surface is satisfied; a re-run is an
22
+ // idempotent CONFIGURED. INCOMPLETE/BLOCKED stop the queue.
23
+ escalation: new Set(['CONFIGURED', 'ALREADY-CONFIGURED']),
20
24
  };
21
25
 
22
26
  const [child, verdict] = process.argv.slice(2);
23
27
 
24
28
  if (!child || !verdict || !SUCCESS_VALUES[child]) {
25
- process.stderr.write('usage: node verify-child-verdict.mjs <studio|fulfiller|employee> <verdict>\n');
29
+ process.stderr.write('usage: node verify-child-verdict.mjs <studio|fulfiller|employee|escalation> <verdict>\n');
26
30
  process.exit(2);
27
31
  }
28
32
 
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: service-omni-agent-users-create
3
+ description: "Create reusable agent users for Omni-Channel setup and routing validation. TRIGGER when users ask to create Omni agents, provision Omni test users, seed sandbox users for routing, create Omni-Channel routing agents, or repair missing demo agents. DO NOT TRIGGER for queue membership, permission-set assignment, or supervisor-user creation."
4
+ allowed-tools: Bash Read Write Edit Glob Grep
5
+ metadata:
6
+ version: "1.0"
7
+ domains: ["Service"]
8
+ minApiVersion: "66.0"
9
+ relatedSkills:
10
+ - "service-omni-base-settings-configure"
11
+ - "service-omni-channel-setup-coordinate"
12
+ - "service-omni-permission-set-assign"
13
+ - "service-omni-queue-members-assign"
14
+ - "service-omni-supervisor-users-create"
15
+ accessCheck:
16
+ - type: license
17
+ value: ServiceCloud
18
+ cliTools:
19
+ - tool: ["jq"]
20
+ semver: ">=1.6"
21
+ - tool: ["python3"]
22
+ semver: ">=3.9"
23
+ - tool: ["sf"]
24
+ semver: ">=2.139.6"
25
+ ---
26
+
27
+ # service-omni-agent-users-create
28
+
29
+ Create N agent users on a Salesforce org via Anonymous Apex so Omni-Channel has agents to route work to. Usernames follow a deterministic per-org pattern, detection is SOQL-based, and the skill inserts only the users that are missing — so it is safe to re-run. It is invoked by `service-omni-channel-setup-coordinate` after `service-omni-base-settings-configure` enables Omni-Channel; assigning permission sets (`service-omni-permission-set-assign`) and adding users to queues (`service-omni-queue-members-assign`) are separate leaves. Supervisor users come from `service-omni-supervisor-users-create`.
30
+
31
+ ## Inputs
32
+
33
+ Confirm once, up front:
34
+
35
+ - `org-alias` (required, no default) — must resolve via `sf org display`.
36
+ - User count (optional, default `3`, range `1..10`).
37
+ - Profile name (optional, default `Standard User` for portability). The coordinator overrides this to a Service Cloud profile so agents consume Service Cloud licenses; on many CDOs the Salesforce license pool is saturated while Service Cloud has free slots.
38
+
39
+ Usernames and passwords are never accepted from the operator — both are generated (usernames from the org suffix, passwords via Anonymous Apex). Operator-supplied credentials would break re-run detection and risk weak or leaked secrets.
40
+
41
+ ## Preconditions and safety
42
+
43
+ - Target org authenticated via `sf` CLI (My Domain URL, not `.lightning.force.com`), Service Cloud license present, `sf` CLI ≥ 2.139.6.
44
+ - The executing user has `PermissionsModifyAllData` and `PermissionsManagePasswordPolicies` (standard on System Administrator).
45
+ - **Production guardrail:** the detect script computes `safe_to_write` as `IsSandbox` OR `TrialExpirationDate != null` OR `OrganizationType` in {Developer Edition, Base Edition}, and the skill blocks with no override when it is false. CDOs, scratch orgs, and dev orgs are permitted.
46
+
47
+ **Password handling (fail-closed).** Passwords are set by Anonymous Apex `System.setPassword` (`sf user password generate` cannot target Apex-inserted users — it fails with `NamedOrgNotFoundError`). The password literal appears in the inline executeAnonymous debug log and, only when a debug-log TraceFlag is active for the running user, in a queryable `ApexLog`. The wrapper therefore fails closed *before* the first `System.setPassword`: it proves via a SOQL-filtered Tooling API query (`ExpirationDate > now`) that no active TraceFlag exists. If safety cannot be positively proven — the running user is unresolved, the query fails or is unparseable, or any active TraceFlag exists — it generates no password at all; the user is left ACTIVE, flagged `password_status:"reset_required"`, and a `security_warning` explains why. It never deletes logs, so no plaintext can reach an `ApexLog` and unrelated audit logs are untouched. If `System.setPassword` itself fails for a user, that user is kept ACTIVE and flagged for reset.
48
+
49
+ ## Run
50
+
51
+ ```bash
52
+ # read-only preview (never writes)
53
+ bash scripts/detect-and-create.sh plan <org-alias> [count] [profile-name]
54
+ # detect, enforce safe_to_write, then insert only the missing users
55
+ bash scripts/detect-and-create.sh run <org-alias> [count=3] [profile-name="Standard User"]
56
+ ```
57
+
58
+ `detect-and-create.sh` is the canonical entry point: it re-runs detection, enforces the production guard, and only then inserts. Do not call `scripts/run-create.sh` directly — it is internal and does not enforce the guard on its own.
59
+
60
+ ## Behavior
61
+
62
+ **Detection.** The detector derives an 8-char suffix from `Organization.Id` (`substring(10,18)`, lowercased), resolves the profile by name, and queries `User` for `agent{i}.<suffix>@example.com` to find which of the `count` slot indexes are occupied. A stable, deterministic pattern is what makes re-runs idempotent — the suffix is never a timestamp or UUID.
63
+
64
+ **Insertion.** The Apex loads `assets/create-users.apex.template`, substitutes `__COUNT__`/`__PROFILE_ID__`/`__SUFFIX__`, and inserts only the missing indexes. It re-checks existing users inside the transaction, which prevents a single run from double-inserting; across *concurrent* runs the in-transaction check is not a guarantee (both can pass their pre-query before either commits), so duplicate protection there relies on the global username-uniqueness constraint plus the `DUPLICATE_USERNAME` retry (see references/apex-template-notes.md). It enables the Service Cloud feature (`UserPermissionsSupportUser=true`) so users can go online in Omni; if the profile's license does not allow it, the Apex strips the flag and retries (users are still created, but need a Service-Cloud-license profile for full Omni). Each created user is reported via `AGENT_USER_CREATED|<id>|<username>|<email>` (no password in the marker — passwords are set by the separate `System.setPassword` submission).
65
+
66
+ **Verification.** After insertion the detector re-runs and must show `missing_count == 0`; otherwise the skill fails (the Apex reported success but the users did not persist).
67
+
68
+ ## Output contract
69
+
70
+ `detect-and-create.sh` emits a single JSON object with `status` ∈ `created` | `partial` | `reused` | `action_needed` | `blocked`, plus `detect` (mirrors the detector), `create` (mirrors the inserter, `null` when nothing was created), top-level `reused_users`, `created_count`, `reused_count`, `total_present_after`, `users_needing_password_reset`, `action_required`, and `safe_to_write`. The coordinator combines `reused_users` with newly created users so mixed runs configure presence and skills for the complete requested agent set.
71
+
72
+ - `created` — every missing index landed with a working password.
73
+ - `partial` — some landed but not all, or any user needs a manual password reset, or inactive occupants were found.
74
+ - `reused` — all requested users already existed; nothing created.
75
+ - `action_needed` — plan mode only; reports missing indexes without writing.
76
+ - `blocked` — precondition failed (`safe_to_write=false`, unresolved profile/suffix, or nothing inserted).
77
+
78
+ `create.created_users[].password` is populated only for users created this run whose `System.setPassword` succeeded; `password_status:"reset_required"` means the user is ACTIVE but has no working password yet. Exit code is 0 for `created`/`partial`/`action_needed`/`reused`, 1 for `blocked`.
79
+
80
+ Generated passwords are a secret: the returned JSON is the only place they appear. Any caller that persists stdout must write it only to a restricted `CREDENTIALS.json` (mode 0600), redact it from every other artifact, and delete it after distribution — the coordinator does this automatically; standalone callers own it. Reused users' passwords are not retrievable; recover via Setup → Users → Reset Password.
81
+
82
+ ## Limitations
83
+
84
+ - Username pattern and org suffix are fixed and never operator-configurable — that determinism is what enables idempotent re-runs.
85
+ - Creates only agent users on the given profile; it never deletes, deactivates, or mutates existing users.
86
+ - Common User errors (`DUPLICATE_USERNAME`, `INVALID_EMAIL`, `LICENSE_LIMIT_EXCEEDED`) are translated into operator-friendly messages rather than surfaced raw.
87
+
88
+ ## References
89
+
90
+ | File | When to read |
91
+ |---|---|
92
+ | `references/apex-patterns.md` | Before running the Apex — Apex structure, User field defaults, password policy, and the profile-localization risk |
93
+ | `references/apex-template-notes.md` | When user creation returns a duplicate, license, or password error — explains template substitutions and retry behavior |
94
+ | `assets/create-users.apex.template` | Loaded by `scripts/run-create.sh` when missing agent users must be inserted |
95
+ | `scripts/detect-existing.sh` | Loaded by the canonical entry point for the read-only org, profile, safety, and existing-user checks |
96
+ | `scripts/tests/test_user_create_security.py` | Run after changing the user-creation scripts to verify production refusal and password-handling contracts |