@salesforce/afv-skills 1.65.1 → 1.67.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 (71) hide show
  1. package/package.json +2 -4
  2. package/skills/agentforce-offline-experimentation-run/SKILL.md +29 -43
  3. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +3 -245
  4. package/skills/commerce-react-storefront-create/SKILL.md +350 -0
  5. package/skills/consumer-goods-promotion-bo-api-deploy/SKILL.md +2 -2
  6. package/skills/consumer-goods-promotion-bo-api-deploy/references/generate-and-wire.md +28 -16
  7. package/skills/consumer-goods-promotion-bo-api-deploy/references/smoke-and-verify.md +18 -1
  8. package/skills/dx-devops-work-item-manage/SKILL.md +34 -17
  9. package/skills/dx-devops-work-item-manage/examples/common-workflows.md +49 -0
  10. package/skills/dx-devops-work-item-manage/references/commit-api.md +116 -0
  11. package/skills/education-cloud-domain-configure/SKILL.md +21 -23
  12. package/skills/education-cloud-domain-configure/references/dependent-features.md +9 -0
  13. package/skills/education-cloud-domain-configure/references/domain-features.md +15 -0
  14. package/skills/education-cloud-domain-configure/references/gotchas-extended.md +8 -0
  15. package/skills/education-cloud-domain-configure/references/setup-widgets.md +123 -0
  16. package/skills/experience-lwc-widget-assess/SKILL.md +79 -0
  17. package/skills/experience-lwc-widget-migrate/SKILL.md +50 -0
  18. package/skills/experience-search-coordinate/SKILL.md +2 -2
  19. package/skills/experience-search-coordinate/references/media-route.md +30 -4
  20. package/skills/experience-ui-bundle-features-generate/SKILL.md +1 -1
  21. package/skills/experience-ui-bundle-mfa-configure/SKILL.md +1 -1
  22. package/skills/platform-metadata-deploy/README.md +1 -1
  23. package/skills/platform-metadata-deploy/SKILL.md +114 -15
  24. package/skills/platform-metadata-deploy/references/agent-deployment-guide.md +3 -4
  25. package/skills/platform-metadata-deploy/references/orchestration.md +2 -3
  26. package/skills/platform-role-hierarchy-apply/SKILL.md +177 -0
  27. package/skills/platform-value-set-generate/SKILL.md +19 -19
  28. package/skills/platform-widget-generate/SKILL.md +59 -68
  29. package/skills/platform-widget-generate/examples/formulas.json +19 -2
  30. package/skills/platform-widget-generate/examples/localized-labels.json +57 -0
  31. package/skills/platform-widget-generate/references/widget-actions.md +29 -0
  32. package/skills/platform-widget-generate/references/widget-bundle-validation.md +15 -0
  33. package/skills/platform-widget-generate/references/widget-formulas.md +24 -7
  34. package/skills/platform-widget-generate/references/widget-gotchas.md +10 -0
  35. package/skills/platform-widget-generate/references/widget-labels.md +78 -0
  36. package/skills/platform-widget-generate/references/widget-styling.md +12 -0
  37. package/skills/sales-call-scoring-configure/SKILL.md +17 -10
  38. package/skills/sales-call-scoring-configure/scripts/enable-call-scoring.sh +55 -33
  39. package/skills/service-agentforce-contact-center-coordinate/SKILL.md +1 -1
  40. package/skills/service-agentforce-contact-center-coordinate/references/number_management_api.md +11 -1
  41. package/skills/service-agentforce-contact-center-coordinate/scripts/fetch-numbers.sh +12 -6
  42. package/skills/service-agentforce-contact-center-coordinate/scripts/lib.sh +16 -0
  43. package/skills/service-agentforce-contact-center-coordinate/scripts/procure-number.sh +2 -1
  44. package/skills/service-concierge-portal-generate/references/portal-deploy-runbook.md +24 -11
  45. package/skills/service-digital-engagement-channel-configure/SKILL.md +29 -16
  46. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +13 -2
  47. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +143 -0
  48. package/skills/service-digital-engagement-deployment-configure/SKILL.md +65 -79
  49. package/skills/service-digital-engagement-deployment-configure/assets/esd_web_update_template.xml +83 -8
  50. package/skills/service-digital-engagement-deployment-configure/examples/esd_web_prechat_fields.xml +74 -0
  51. package/skills/service-digital-engagement-deployment-configure/references/connect_api_creation.md +26 -7
  52. package/skills/service-digital-engagement-deployment-configure/references/deployment_settings.md +13 -78
  53. package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +145 -0
  54. package/skills/service-digital-engagement-deployment-configure/references/prechat_forms.md +245 -0
  55. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +166 -112
  56. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +61 -37
  57. package/skills/service-itsm-agentic-setup-incident-management/references/audit-tracking.md +42 -0
  58. package/skills/service-itsm-agentic-setup-incident-management/references/broadcast-communications.md +23 -0
  59. package/skills/service-itsm-agentic-setup-incident-management/references/email-to-incident.md +23 -0
  60. package/skills/service-itsm-agentic-setup-incident-management/references/incident-dashboards.md +25 -0
  61. package/skills/service-itsm-agentic-setup-incident-management/references/incident-persona-psg.md +30 -145
  62. package/skills/service-itsm-agentic-setup-incident-management/references/incident-preferences.md +32 -137
  63. package/skills/service-itsm-agentic-setup-incident-management/references/major-incident-management.md +32 -155
  64. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +45 -0
  65. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +32 -0
  66. package/skills/service-itsm-agentic-setup-incident-management/references/service-mgmt-privilege.md +30 -140
  67. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +110 -0
  68. package/skills/service-itsm-agentic-setup-incident-sla-configure/SKILL.md +34 -25
  69. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/milestone-patterns.md +1 -1
  70. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/mcp-invocation.md +90 -86
  71. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/workflow.md +63 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/afv-skills",
3
- "version": "1.65.1",
3
+ "version": "1.67.0",
4
4
  "description": "Salesforce's curated collection of agent skills for building applications. Optimized for Agentforce Vibes, compatible with all AI tools.",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -12,9 +12,7 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "@salesforce/ui-bundle-template-app-react-sample-b2e": "^12.4.4",
15
- "@salesforce/ui-bundle-template-app-react-sample-b2x": "^12.4.4",
16
- "@salesforce/webapp-template-app-react-sample-b2e-experimental": "^1.117.1",
17
- "@salesforce/webapp-template-app-react-sample-b2x-experimental": "^1.117.1"
15
+ "@salesforce/ui-bundle-template-app-react-sample-b2x": "^12.4.4"
18
16
  },
19
17
  "scripts": {
20
18
  "sync-react-b2e-sample": "node scripts/sync-react-b2e-sample.js",
@@ -4,20 +4,20 @@ description: "Use this skill when users want to execute this workflow when a use
4
4
  metadata:
5
5
  relatedSkills:
6
6
  - dx-apexguru-scan
7
- version: '1.0'
7
+ version: "1.0"
8
8
  cliTools:
9
9
  - tool:
10
- - curl
11
- semver: '>=7.0'
10
+ - "curl"
11
+ semver: ">=7.0"
12
12
  - tool:
13
- - jq
14
- semver: '>=1.6'
13
+ - "jq"
14
+ semver: ">=1.6"
15
15
  - tool:
16
- - python3
17
- semver: '>=3.8'
16
+ - "python3"
17
+ semver: ">=3.8"
18
18
  - tool:
19
- - sf
20
- semver: '>=2.0.0'
19
+ - "sf"
20
+ semver: ">=2.0.0"
21
21
  ---
22
22
 
23
23
  # Managing Agentforce Offline Experimentation
@@ -28,7 +28,7 @@ Execute this workflow when a user wants to test how a different LLM model would
28
28
 
29
29
  ## Workflow
30
30
 
31
- discover-data-space → verify-stdm-availability → discover-agents → resolve-agent-label → list-available-models (if user needs help choosing) → find-sessions → get-conversation-details → get-llm-step-details → obtain-sfap-token → replay-turn-prompts → [score-exact-matches, judge-function-args, judge-text-responses] → generate-csv-report → generate-html-report.
31
+ discover-data-space → verify-stdm-availability → discover-agents → list-available-models (if user needs help choosing) → find-sessions → get-conversation-details → get-llm-step-details → obtain-sfap-token → replay-turn-prompts → [score-exact-matches, judge-function-args, judge-text-responses] → generate-csv-report → generate-html-report.
32
32
  WORKFLOW GATE: Do not proceed past Phase 0 until org alias (auto-discover from authenticated orgs), agent API name (auto-discover from STDM), and target model ID (ask user) are all confirmed.
33
33
  SFAP JWT expires after ~2 hours. For 20+ session replays, refresh the token between batches. Each SFAP replay call takes ~1-3 seconds; keep under 20 sessions for reasonable wall-clock time (~10-30 minutes).
34
34
  The scoring and judging steps (Phase 3) can run in parallel once replay completes. Exact-match scoring is instant; LLM judge calls add ~1-2 seconds per turn.
@@ -38,7 +38,6 @@ The scoring and judging steps (Phase 3) can run in parallel once replay complete
38
38
  **Preconditions:**
39
39
 
40
40
  - Data Cloud is provisioned and enabled in the org (check: `DataCloudProvisioned`)
41
- - Agentforce Activity data streaming is active in Data Cloud (check: `AgentforceActivityStream`)
42
41
  - Einstein LLM / GenAI Gateway is configured in the org (check: `EinsteinLlmEnabled`)
43
42
  - User has an authenticated session to the target org (check: `OrgAuthenticated`)
44
43
 
@@ -53,18 +52,17 @@ Operations grouped by purpose. Use these as the building blocks for the workflow
53
52
  | `discover-data-space` | read | implemented | `getDataSpaces` | — |
54
53
  | `verify-stdm-availability` | validate | implemented | `queryCdpAnsiSqlV2` | `discover-data-space` |
55
54
  | `discover-agents` | read | implemented | `queryCdpAnsiSqlV2` | `verify-stdm-availability` |
56
- | `resolve-agent-label` | read | implemented | `queryGenAiPlannerDefinition` | `discover-agents` |
57
55
  | `list-available-models` | read | implemented | `queryAiModel` | — |
58
56
  | `find-sessions` | read | implemented | `queryCdpAnsiSqlV2` | `verify-stdm-availability`, `discover-agents` |
59
57
  | `get-conversation-details` | read | proposed | `queryCdpAnsiSqlV2` | `find-sessions` |
60
58
  | `get-llm-step-details` | read | proposed | `queryCdpAnsiSqlV2` | `get-conversation-details` |
61
- | `obtain-sfap-token` | validate | proposed | `obtainSfapJwt` | — |
62
- | `replay-turn-prompts` | read | proposed | `sfapChatGenerations` | `get-llm-step-details`, `obtain-sfap-token` |
63
- | `score-exact-matches` | read | proposed | `computeExactMatchScores` | `replay-turn-prompts` |
64
- | `judge-function-args` | read | proposed | `sfapChatGenerations` | `score-exact-matches`, `obtain-sfap-token` |
65
- | `judge-text-responses` | read | proposed | `sfapChatGenerations` | `replay-turn-prompts`, `obtain-sfap-token` |
66
- | `generate-csv-report` | write | proposed | `generateCsvReport` | `score-exact-matches`, `judge-function-args`, `judge-text-responses` |
67
- | `generate-html-report` | write | proposed | `generateHtmlReport` | `generate-csv-report` |
59
+ | `obtain-sfap-token` | validate | proposed | — | — |
60
+ | `replay-turn-prompts` | read | proposed | — | `get-llm-step-details`, `obtain-sfap-token` |
61
+ | `score-exact-matches` | read | proposed | — | `replay-turn-prompts` |
62
+ | `judge-function-args` | read | proposed | — | `score-exact-matches`, `obtain-sfap-token` |
63
+ | `judge-text-responses` | read | proposed | — | `replay-turn-prompts`, `obtain-sfap-token` |
64
+ | `generate-csv-report` | write | proposed | — | `score-exact-matches`, `judge-function-args`, `judge-text-responses` |
65
+ | `generate-html-report` | write | proposed | — | `generate-csv-report` |
68
66
 
69
67
  ### Dependency graph
70
68
 
@@ -73,7 +71,6 @@ graph TD
73
71
  discover_data_space["discover-data-space (read)"]
74
72
  verify_stdm_availability["verify-stdm-availability (validate)"]
75
73
  discover_agents["discover-agents (read)"]
76
- resolve_agent_label["resolve-agent-label (read)"]
77
74
  list_available_models["list-available-models (read)"]
78
75
  find_sessions["find-sessions (read)"]
79
76
  get_conversation_details["get-conversation-details (read)"]
@@ -87,7 +84,6 @@ graph TD
87
84
  generate_html_report["generate-html-report (write)"]
88
85
  discover_data_space --> verify_stdm_availability
89
86
  verify_stdm_availability --> discover_agents
90
- discover_agents --> resolve_agent_label
91
87
  verify_stdm_availability --> find_sessions
92
88
  discover_agents --> find_sessions
93
89
  find_sessions --> get_conversation_details
@@ -115,24 +111,12 @@ Discover active Data Cloud data spaces in the org
115
111
 
116
112
  #### `discover-agents`
117
113
 
118
- Query STDM for distinct Agentforce agent API names that have session traces
114
+ Query STDM for distinct agent + version combinations that have session traces
119
115
 
120
116
  **Call:** `queryCdpAnsiSqlV2` — status: `implemented`
121
117
 
122
118
  **Depends on:** `verify-stdm-availability`
123
119
 
124
- #### `resolve-agent-label`
125
-
126
- Enrich the selected agent API name with a human-readable MasterLabel
127
-
128
- **Call:** `queryGenAiPlannerDefinition` — status: `implemented`
129
-
130
- **Inputs:**
131
-
132
- - `agent_api_name` *(`String`)* — Agent API name selected in discover-agents
133
-
134
- **Depends on:** `discover-agents`
135
-
136
120
  #### `list-available-models`
137
121
 
138
122
  List Einstein LLM models configured in the org to help the user choose a target model
@@ -141,13 +125,14 @@ List Einstein LLM models configured in the org to help the user choose a target
141
125
 
142
126
  #### `find-sessions`
143
127
 
144
- Find recent Agentforce sessions in STDM filtered by agent API name and date range
128
+ Find recent Agentforce sessions in STDM filtered by agent API name, version, and date range
145
129
 
146
130
  **Call:** `queryCdpAnsiSqlV2` — status: `implemented`
147
131
 
148
132
  **Inputs:**
149
133
 
150
134
  - `agent_api_name` *(`String`)* — Agent API name selected in discover-agents
135
+ - `agent_version_api_name` *(`String`)* — Agent version API name selected in discover-agents
151
136
  - `start_date` *(`String`)*
152
137
  - `end_date` *(`String`)*
153
138
  - `max_sessions` *(`Integer`)*
@@ -172,9 +157,10 @@ Fetch interaction steps including LLM inputs and outputs for each interaction
172
157
 
173
158
  #### `replay-turn-prompts`
174
159
 
175
- Replay each turn's LLM prompt through the target model via SFAP REST API with structured tool calling
160
+ Extract structured messages (system/assistant/user) from STDM LLM step inputs, convert to OpenAI-format messages array preserving role positions, extract tool definitions dynamically from gen_ai.request.tools, classify each step as router (topic) or action based on tool signatures, and replay via SFAP REST API POST /ai/gpt/v1/chat/generations with tool_choice=required
161
+
176
162
 
177
- **Call:** `sfapChatGenerations` — status: `proposed`
163
+ **Status:** `proposed`
178
164
 
179
165
  **Inputs:**
180
166
 
@@ -186,7 +172,7 @@ Replay each turn's LLM prompt through the target model via SFAP REST API with st
186
172
 
187
173
  Compute exact-match scores for topic agreement and function name accuracy
188
174
 
189
- **Call:** `computeExactMatchScores` — status: `proposed`
175
+ **Status:** `proposed`
190
176
 
191
177
  **Depends on:** `replay-turn-prompts`
192
178
 
@@ -194,7 +180,7 @@ Compute exact-match scores for topic agreement and function name accuracy
194
180
 
195
181
  LLM-as-judge scoring of function arguments when function names match (exact or lenient)
196
182
 
197
- **Call:** `sfapChatGenerations` — status: `proposed`
183
+ **Status:** `proposed`
198
184
 
199
185
  **Depends on:** `score-exact-matches`, `obtain-sfap-token`
200
186
 
@@ -202,7 +188,7 @@ LLM-as-judge scoring of function arguments when function names match (exact or l
202
188
 
203
189
  LLM-as-judge scoring of text responses for turns that end with text output
204
190
 
205
- **Call:** `sfapChatGenerations` — status: `proposed`
191
+ **Status:** `proposed`
206
192
 
207
193
  **Depends on:** `replay-turn-prompts`, `obtain-sfap-token`
208
194
 
@@ -212,7 +198,7 @@ LLM-as-judge scoring of text responses for turns that end with text output
212
198
 
213
199
  Generate CSV report with per-turn replay results and aggregate summary scores
214
200
 
215
- **Call:** `generateCsvReport` — status: `proposed`
201
+ **Status:** `proposed`
216
202
 
217
203
  **Inputs:**
218
204
 
@@ -224,7 +210,7 @@ Generate CSV report with per-turn replay results and aggregate summary scores
224
210
 
225
211
  Build a self-contained HTML analysis report with verdict badges, scorecards, and failure breakdown
226
212
 
227
- **Call:** `generateHtmlReport` — status: `proposed`
213
+ **Status:** `proposed`
228
214
 
229
215
  **Inputs:**
230
216
 
@@ -246,7 +232,7 @@ Verify STDM (Session Trace Data Model) is queryable in Data Cloud
246
232
 
247
233
  Obtain an SFAP JWT token via org session authentication and the /ide/auth endpoint
248
234
 
249
- **Call:** `obtainSfapJwt` — status: `proposed`
235
+ **Status:** `proposed`
250
236
 
251
237
  **Inputs:**
252
238
 
@@ -22,206 +22,10 @@ STDM_DATA_FILE = os.environ.get("STDM_DATA_FILE", "/tmp/details_result.json")
22
22
  LLM_STEPS_FILES = os.environ.get("LLM_STEPS_FILES", "/tmp/llm_steps_1.json,/tmp/llm_steps_2.json").split(",")
23
23
 
24
24
  # ---------------------------------------------------------------------------
25
- # Dynamic tool extraction from STDM data
26
- # ---------------------------------------------------------------------------
27
- # Instead of hardcoded tools, we extract actual tool definitions from the
28
- # original LLM responses in the STDM data. This handles both routing tools
29
- # (go_to_*) and domain action tools (SearchProducts, AddToCart, etc.)
25
+ # Tool extraction is dynamic-only: definitions come from STDM step inputs
26
+ # (gen_ai.request.tools) at runtime. No hardcoded tool schemas.
30
27
  # ---------------------------------------------------------------------------
31
28
 
32
- # Well-known tool schemas observed from agent responses. Keyed by tool name.
33
- # These are built from observed argument patterns in STDM LLM responses.
34
- KNOWN_TOOL_SCHEMAS = {
35
- # --- Routing tools (topic router layer) ---
36
- "go_to_product_discovery": {
37
- "type": "function",
38
- "function": {
39
- "name": "go_to_product_discovery",
40
- "description": "Route to product discovery topic for searching, browsing, product questions, recommendations.",
41
- "parameters": {"type": "object", "properties": {}}
42
- }
43
- },
44
- "go_to_cart_and_checkout": {
45
- "type": "function",
46
- "function": {
47
- "name": "go_to_cart_and_checkout",
48
- "description": "Route to cart and checkout topic for adding items, viewing cart, checkout, payments.",
49
- "parameters": {"type": "object", "properties": {}}
50
- }
51
- },
52
- "go_to_store_help": {
53
- "type": "function",
54
- "function": {
55
- "name": "go_to_store_help",
56
- "description": "Route to store help topic for shipping, returns, store policies, greetings.",
57
- "parameters": {"type": "object", "properties": {}}
58
- }
59
- },
60
- "go_to_off_topic": {
61
- "type": "function",
62
- "function": {
63
- "name": "go_to_off_topic",
64
- "description": "Route to off-topic handler for queries unrelated to shopping.",
65
- "parameters": {"type": "object", "properties": {}}
66
- }
67
- },
68
- # --- Domain action tools (sub-topic agents) ---
69
- "SearchProducts": {
70
- "type": "function",
71
- "function": {
72
- "name": "SearchProducts",
73
- "description": "Search the product catalog with optional filters.",
74
- "parameters": {
75
- "type": "object",
76
- "properties": {
77
- "searchQuery": {"type": "string", "description": "Search terms or keywords"},
78
- "category": {"type": "string", "description": "Product category filter"},
79
- "color": {"type": "string", "description": "Color filter"},
80
- "department": {"type": "string", "description": "Department filter (e.g. Men, Women, Unisex)"},
81
- "maxPrice": {"type": "string", "description": "Maximum price filter"},
82
- "minPrice": {"type": "string", "description": "Minimum price filter"},
83
- "sortBy": {"type": "string", "description": "Sort order (e.g. relevance, price_asc, price_desc, rating)"}
84
- },
85
- "required": []
86
- }
87
- }
88
- },
89
- "GetProductDetails": {
90
- "type": "function",
91
- "function": {
92
- "name": "GetProductDetails",
93
- "description": "Get detailed information about a specific product.",
94
- "parameters": {
95
- "type": "object",
96
- "properties": {
97
- "productCode": {"type": "string", "description": "The product code (e.g. SHOE-M-088)"}
98
- },
99
- "required": ["productCode"]
100
- }
101
- }
102
- },
103
- "GetRecommendations": {
104
- "type": "function",
105
- "function": {
106
- "name": "GetRecommendations",
107
- "description": "Get product recommendations based on a product.",
108
- "parameters": {
109
- "type": "object",
110
- "properties": {
111
- "productCode": {"type": "string", "description": "Product code to base recommendations on"}
112
- },
113
- "required": ["productCode"]
114
- }
115
- }
116
- },
117
- "AddToCart": {
118
- "type": "function",
119
- "function": {
120
- "name": "AddToCart",
121
- "description": "Add a product to the shopping cart.",
122
- "parameters": {
123
- "type": "object",
124
- "properties": {
125
- "productCode": {"type": "string", "description": "Product code to add"},
126
- "quantity": {"type": "string", "description": "Quantity to add"},
127
- "size": {"type": "string", "description": "Size selection"},
128
- "color": {"type": "string", "description": "Color selection"}
129
- },
130
- "required": ["productCode", "quantity"]
131
- }
132
- }
133
- },
134
- "ViewCart": {
135
- "type": "function",
136
- "function": {
137
- "name": "ViewCart",
138
- "description": "View the current shopping cart contents.",
139
- "parameters": {"type": "object", "properties": {}}
140
- }
141
- },
142
- "UpdateCart": {
143
- "type": "function",
144
- "function": {
145
- "name": "UpdateCart",
146
- "description": "Update cart item quantity, size, or color. Set quantity to 0 to remove.",
147
- "parameters": {
148
- "type": "object",
149
- "properties": {
150
- "productCode": {"type": "string", "description": "Product code to update (or 'all' to clear cart)"},
151
- "quantity": {"type": "string", "description": "New quantity (0 to remove)"},
152
- "size": {"type": "string", "description": "New size"},
153
- "color": {"type": "string", "description": "New color"}
154
- },
155
- "required": ["productCode", "quantity"]
156
- }
157
- }
158
- },
159
- "Checkout": {
160
- "type": "function",
161
- "function": {
162
- "name": "Checkout",
163
- "description": "Place an order with the current cart.",
164
- "parameters": {
165
- "type": "object",
166
- "properties": {
167
- "shippingMethod": {"type": "string", "description": "Shipping method (Standard or Express)"},
168
- "shopperName": {"type": "string", "description": "Name for the order"}
169
- },
170
- "required": ["shippingMethod"]
171
- }
172
- }
173
- },
174
- # --- Generic CRM tools (fallback for non-shopper agents) ---
175
- "QueryRecords": {
176
- "type": "function",
177
- "function": {
178
- "name": "QueryRecords",
179
- "description": "Query records using natural language.",
180
- "parameters": {
181
- "type": "object",
182
- "properties": {
183
- "query": {"type": "string", "description": "Natural language query"}
184
- },
185
- "required": ["query"]
186
- }
187
- }
188
- },
189
- "IdentifyRecordByName": {
190
- "type": "function",
191
- "function": {
192
- "name": "IdentifyRecordByName",
193
- "description": "Identify a record by its name to get the record ID.",
194
- "parameters": {
195
- "type": "object",
196
- "properties": {
197
- "name": {"type": "string", "description": "The name of the record"},
198
- "objectType": {"type": "string", "description": "The Salesforce object type"}
199
- },
200
- "required": ["name"]
201
- }
202
- }
203
- },
204
- "GetRecordDetails": {
205
- "type": "function",
206
- "function": {
207
- "name": "GetRecordDetails",
208
- "description": "Get detailed information about a specific record by its ID.",
209
- "parameters": {
210
- "type": "object",
211
- "properties": {
212
- "recordId": {"type": "string", "description": "The Salesforce record ID"}
213
- },
214
- "required": ["recordId"]
215
- }
216
- }
217
- },
218
- }
219
-
220
- ROUTING_TOOLS = ['go_to_product_discovery', 'go_to_cart_and_checkout', 'go_to_store_help', 'go_to_off_topic']
221
- ACTION_TOOLS_SHOPPER = ['SearchProducts', 'GetProductDetails', 'GetRecommendations',
222
- 'AddToCart', 'ViewCart', 'UpdateCart', 'Checkout']
223
- GENERIC_CRM_TOOLS = ['QueryRecords', 'IdentifyRecordByName', 'GetRecordDetails']
224
-
225
29
 
226
30
  def _is_routing_tools(tools):
227
31
  """True when ALL tools in the list are routing functions (go_to_* / __end_session_action__).
@@ -270,27 +74,6 @@ def sanitize_tools_for_sfap(tools):
270
74
  return sanitized
271
75
 
272
76
 
273
- def build_tools_for_step(original_tool_name, prompt_text):
274
- """Select the right tool set based on the original tool call and prompt content."""
275
- # If original called a routing tool, offer routing tools
276
- if original_tool_name and original_tool_name.startswith('go_to_'):
277
- return [KNOWN_TOOL_SCHEMAS[t] for t in ROUTING_TOOLS if t in KNOWN_TOOL_SCHEMAS]
278
-
279
- # If original called a shopper action tool, offer shopper tools
280
- if original_tool_name and original_tool_name in ACTION_TOOLS_SHOPPER:
281
- return [KNOWN_TOOL_SCHEMAS[t] for t in ACTION_TOOLS_SHOPPER if t in KNOWN_TOOL_SCHEMAS]
282
-
283
- # Detect from prompt content
284
- if prompt_text:
285
- if 'go_to_product_discovery' in prompt_text or 'go_to_cart' in prompt_text:
286
- return [KNOWN_TOOL_SCHEMAS[t] for t in ROUTING_TOOLS if t in KNOWN_TOOL_SCHEMAS]
287
- if 'SearchProducts' in prompt_text or 'AddToCart' in prompt_text:
288
- return [KNOWN_TOOL_SCHEMAS[t] for t in ACTION_TOOLS_SHOPPER if t in KNOWN_TOOL_SCHEMAS]
289
-
290
- # Fallback to generic CRM tools
291
- return [KNOWN_TOOL_SCHEMAS[t] for t in GENERIC_CRM_TOOLS if t in KNOWN_TOOL_SCHEMAS]
292
-
293
-
294
77
  def extract_tools_from_llm_responses(llm_step_map):
295
78
  """Scan all LLM responses to discover the actual tool names used by the agent."""
296
79
  seen = set()
@@ -309,10 +92,6 @@ def extract_tools_from_llm_responses(llm_step_map):
309
92
  return seen
310
93
 
311
94
 
312
- # Legacy alias for backward compatibility
313
- AGENT_TOOLS = [KNOWN_TOOL_SCHEMAS[t] for t in GENERIC_CRM_TOOLS if t in KNOWN_TOOL_SCHEMAS]
314
-
315
-
316
95
  def read_token():
317
96
  if SFAP_TOKEN_FILE and os.path.exists(SFAP_TOKEN_FILE):
318
97
  with open(SFAP_TOKEN_FILE) as f:
@@ -415,24 +194,6 @@ def convert_stdm_messages_for_sfap(stdm_messages):
415
194
  return out
416
195
 
417
196
 
418
- def prompt_has_tools(prompt_text):
419
- """Check if this prompt includes tool/function calling instructions."""
420
- indicators = [
421
- 'data retrieval functions',
422
- 'QueryRecords',
423
- 'IdentifyRecordByName',
424
- 'GetRecordDetails',
425
- 'TOOL USAGE PROTOCOL',
426
- 'go_to_product_discovery',
427
- 'go_to_cart_and_checkout',
428
- 'go_to_store_help',
429
- 'SearchProducts',
430
- 'AddToCart',
431
- 'Checkout',
432
- ]
433
- return any(ind in prompt_text for ind in indicators)
434
-
435
-
436
197
  def call_sfap(messages, model, tools=None, max_tokens=2048):
437
198
  """Call SFAP chat generations endpoint."""
438
199
  token = read_token()
@@ -880,13 +641,10 @@ def main():
880
641
  print(f" SKIP: Could not parse prompt into messages")
881
642
  continue
882
643
 
883
- # Use tool definitions from STDM step input if available, else fall back
644
+ # Use tool definitions from STDM step input (dynamic-only, no hardcoded fallback)
884
645
  tools = target.get('step_tools')
885
646
  if tools:
886
647
  tools = sanitize_tools_for_sfap(tools)
887
- else:
888
- has_tools = prompt_has_tools(target['prompt'])
889
- tools = build_tools_for_step(target.get('original_tool_name'), target['prompt']) if has_tools else None
890
648
 
891
649
  print(f" Messages: {len(messages)}, Tools: {'yes' if tools else 'no'}")
892
650