@salesforce/afv-skills 1.68.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -13,7 +13,7 @@ from .redact import redact
13
13
 
14
14
  DEFAULT_JUDGE_MODEL = "llmgateway__OpenAIGPT41"
15
15
 
16
- TEXT_PROMPT = """You compare two replies an AI assistant could send at the same point of a customer conversation.
16
+ TEXT_RUBRIC = """You compare two replies an AI assistant could send at the same point of a customer conversation.
17
17
  The REFERENCE reply is what production sent. The CANDIDATE reply was produced by another model for the identical request.
18
18
 
19
19
  The CANDIDATE is equivalent when, for the customer, it does the same thing:
@@ -21,35 +21,17 @@ The CANDIDATE is equivalent when, for the customer, it does the same thing:
21
21
  - no fact, number, product, price or commitment that conflicts with the REFERENCE or that the conversation does not support.
22
22
  Wording, order, tone and length may differ.
23
23
 
24
- Answer with JSON only: {{"equivalent": true or false, "reasoning": "<one sentence>"}}
24
+ The user message is a JSON object with keys "context", "reference_reply", and "candidate_reply".
25
+ Answer with JSON only: {"equivalent": true or false, "reasoning": "<one sentence>"}"""
25
26
 
26
- [recent conversation, oldest first]
27
- {context}
28
-
29
- [REFERENCE reply]
30
- {golden}
31
-
32
- [CANDIDATE reply]
33
- {candidate}
34
- """
35
-
36
- ARGS_PROMPT = """You compare the arguments two AI models passed to the same tool at the same point of a conversation.
27
+ ARGS_RUBRIC = """You compare the arguments two AI models passed to the same tool at the same point of a conversation.
37
28
  The REFERENCE arguments are what production sent. The CANDIDATE arguments were produced by another model for the identical request.
38
29
 
39
30
  The CANDIDATE is equivalent when the tool would do the same thing with it: the same search results, the same record, the same change.
40
31
  Differences in wording, case or word order that the tool would treat the same do not matter. A missing optional argument matters only if the REFERENCE value changes the result.
41
32
 
42
- Answer with JSON only: {{"equivalent": true or false, "reasoning": "<one sentence>"}}
43
-
44
- [tool] {tool}
45
- [parameter schema] {schema}
46
-
47
- [recent conversation, oldest first]
48
- {context}
49
-
50
- [REFERENCE arguments] {golden}
51
- [CANDIDATE arguments] {candidate}
52
- """
33
+ The user message is a JSON object with keys "tool", "parameter_schema", "context", "reference_arguments", and "candidate_arguments".
34
+ Answer with JSON only: {"equivalent": true or false, "reasoning": "<one sentence>"}"""
53
35
 
54
36
 
55
37
  class JudgeConfigError(ValueError):
@@ -125,9 +107,12 @@ class Judge:
125
107
  self.client = client
126
108
  self.model = model
127
109
 
128
- def _ask(self, prompt):
110
+ def _ask(self, system_prompt, data):
129
111
  payload = {"model": self.model,
130
- "messages": [{"role": "user", "content": redact(prompt)}], # a reply may echo a token
112
+ "messages": [
113
+ {"role": "system", "content": system_prompt},
114
+ {"role": "user", "content": redact(json.dumps(data, ensure_ascii=False))},
115
+ ],
131
116
  "generation_settings": {"num_generations": 1, "max_tokens": 400, "temperature": 0.0}}
132
117
  res = self.client.generate(payload)
133
118
  if res["status"] != "ok":
@@ -139,10 +124,17 @@ class Judge:
139
124
  return verdict, None
140
125
 
141
126
  def text(self, golden, candidate, messages):
142
- return self._ask(TEXT_PROMPT.format(context=render_context(messages),
143
- golden=golden, candidate=candidate))
127
+ return self._ask(TEXT_RUBRIC, {
128
+ "context": render_context(messages),
129
+ "reference_reply": golden,
130
+ "candidate_reply": candidate,
131
+ })
144
132
 
145
133
  def args(self, tool, schema, golden_args, candidate_args, messages):
146
- return self._ask(ARGS_PROMPT.format(
147
- tool=tool, schema=json.dumps(schema or {}), context=render_context(messages),
148
- golden=json.dumps(golden_args, sort_keys=True), candidate=json.dumps(candidate_args, sort_keys=True)))
134
+ return self._ask(ARGS_RUBRIC, {
135
+ "tool": tool,
136
+ "parameter_schema": schema or {},
137
+ "context": render_context(messages),
138
+ "reference_arguments": golden_args,
139
+ "candidate_arguments": candidate_args,
140
+ })
@@ -1,7 +1,8 @@
1
1
  """Rebuild an LLM step's request messages exactly as production sent them.
2
2
 
3
3
  STDM keeps every LLM_STEP's request in `gen_ai.input.messages`. Production sends those
4
- messages in that order, nothing merged or dropped:
4
+ messages in that order, nothing merged; its LLM client drops only assistant messages with no
5
+ text and no tool calls (btlib.sfap, with its other last-mile steps):
5
6
 
6
7
  system agent-level prompt
7
8
  user / assistant ... conversation so far
@@ -18,6 +18,19 @@ Production request fields (from captured gateway payloads) reproduced here:
18
18
  "parameters": {"seed": n}} — no max_tokens, no temperature
19
19
  system_prompt_strategy "use_model_parameter"; enable_pii_masking false
20
20
  Not reproduced: safety/bias scoring flags, trust settings, localization, turn ids, tags.
21
+
22
+ STDM records a step's request before production's LLM client changes it. These of its
23
+ last-mile transform steps are ported as written, so the model sees what production's model saw:
24
+ tools every top-level property gets title = its name; ":" in a property name becomes
25
+ "_" (in properties, required and that title), unless the new name is taken
26
+ messages an assistant message with no text and no tool calls is dropped; earlier calls to
27
+ a renamed tool get the same renaming of their argument keys
28
+ answer the renamed argument keys are mapped back (restore_param_names), as production
29
+ records them, so they score against the golden as production's did
30
+ Not ported, since no recorded request needs them: tool names cut to 64 characters (a longer
31
+ name fails loudly, HTTP 400), the repair of unpaired tool calls, URL placeholders. The seed is
32
+ --seed + repeat, not production's constant 75197747: it only picks the draw, and a constant
33
+ would make the k repeats one cached answer.
21
34
  """
22
35
 
23
36
  import copy
@@ -26,6 +39,7 @@ import json
26
39
  import socket
27
40
  import time
28
41
  import urllib.error
42
+ import urllib.parse
29
43
  import urllib.request
30
44
 
31
45
  from .redact import redact, register_secret
@@ -50,13 +64,110 @@ def sanitize_tools_for_sfap(tools):
50
64
  return sanitized
51
65
 
52
66
 
67
+ def _param_renames(properties):
68
+ """[(name, name with ":" -> "_")], skipping a rename onto another property's name."""
69
+ return [(k, k.replace(":", "_")) for k in properties
70
+ if ":" in k and k.replace(":", "_") not in properties]
71
+
72
+
73
+ def param_name_lookup(tools):
74
+ """{tool name: {sent parameter name: recorded name}} for the tools whose names production renames."""
75
+ lookup = {}
76
+ for t in tools or []:
77
+ fn = t.get("function") or {}
78
+ props = (fn.get("parameters") or {}).get("properties")
79
+ renames = _param_renames(props) if isinstance(props, dict) else []
80
+ if renames:
81
+ lookup[fn.get("name")] = {new: old for old, new in renames}
82
+ return lookup
83
+
84
+
85
+ def _production_parameters(parameters):
86
+ """In place: titles added, ":" renamed, as production sends a tool's parameters."""
87
+ props = parameters.get("properties")
88
+ if not isinstance(props, dict):
89
+ return
90
+ for key, value in props.items():
91
+ if isinstance(value, dict):
92
+ value.setdefault("title", key)
93
+ renames = _param_renames(props)
94
+ for old, new in renames:
95
+ props[new] = props.pop(old)
96
+ if isinstance(props[new], dict) and props[new].get("title") == old:
97
+ props[new]["title"] = new
98
+ if isinstance(parameters.get("required"), list):
99
+ rename = dict(renames)
100
+ parameters["required"] = [rename.get(r, r) for r in parameters["required"]]
101
+
102
+
103
+ def _remap_arguments(arguments, mapping):
104
+ """Top-level keys of a JSON arguments string renamed; anything else returned as is."""
105
+ if not arguments or not mapping:
106
+ return arguments
107
+ try:
108
+ parsed = json.loads(arguments)
109
+ except (json.JSONDecodeError, TypeError):
110
+ return arguments
111
+ if not isinstance(parsed, dict):
112
+ return arguments
113
+ return json.dumps({mapping.get(k, k): v for k, v in parsed.items()})
114
+
115
+
116
+ def _empty_assistant(m):
117
+ content = m.get("content")
118
+ return (m.get("role") == "assistant" and not m.get("tool_invocations")
119
+ and not (content.strip() if isinstance(content, str) else content))
120
+
121
+
122
+ def production_messages(messages, lookup):
123
+ """The messages as production sends them: empty assistant messages dropped, and earlier
124
+ calls to a tool in `lookup` with their argument keys renamed as its parameters are. A new
125
+ list; a message that changes is copied, the others are shared."""
126
+ out = []
127
+ for m in messages:
128
+ if _empty_assistant(m):
129
+ continue
130
+ calls = m.get("tool_invocations") or []
131
+ if any((c.get("function") or {}).get("name") in lookup for c in calls):
132
+ renamed = []
133
+ for c in calls:
134
+ fn = c.get("function") or {}
135
+ if fn.get("name") in lookup:
136
+ forward = {old: new for new, old in lookup[fn["name"]].items()}
137
+ c = dict(c, function=dict(fn, arguments=_remap_arguments(fn.get("arguments"), forward)))
138
+ renamed.append(c)
139
+ m = dict(m, tool_invocations=renamed)
140
+ out.append(m)
141
+ return out
142
+
143
+
144
+ def restore_param_names(response, tools):
145
+ """A parsed answer with the renamed argument keys mapped back, as production records it."""
146
+ lookup = param_name_lookup(tools)
147
+ if not response or not any(c.get("name") in lookup for c in response.get("tool_calls") or []):
148
+ return response
149
+ calls = []
150
+ for c in response["tool_calls"]:
151
+ mapping = lookup.get(c.get("name"))
152
+ if mapping and "args_raw" not in c:
153
+ c = dict(c, args={mapping.get(k, k): v for k, v in c["args"].items()})
154
+ calls.append(c)
155
+ return dict(response, tool_calls=calls)
156
+
157
+
53
158
  def to_sfap_tools(tools):
54
159
  """Step tool definitions (gen_ai.request.tools) in the production request shape."""
55
- return [{"function": t.get("function") or {}} for t in sanitize_tools_for_sfap(tools)]
160
+ out = []
161
+ for t in sanitize_tools_for_sfap(tools):
162
+ fn = t.get("function") or {}
163
+ if isinstance(fn.get("parameters"), dict):
164
+ _production_parameters(fn["parameters"])
165
+ out.append({"function": fn})
166
+ return out
56
167
 
57
168
 
58
169
  def build_payload(model, messages, tools=None, seed=None, parameters=None):
59
- payload = {"model": model, "messages": messages}
170
+ payload = {"model": model, "messages": production_messages(messages, param_name_lookup(tools))}
60
171
  if tools:
61
172
  payload["tools"] = to_sfap_tools(tools)
62
173
  payload["tool_config"] = {
@@ -122,6 +233,11 @@ class SfapClient:
122
233
  if missing:
123
234
  raise ValueError("SFAP config missing: " + ", ".join(missing)
124
235
  + " (run scripts/resolve-token.sh and pass --token-info)")
236
+ parsed = urllib.parse.urlparse(base_url)
237
+ if parsed.scheme != "https":
238
+ raise ValueError(f"base_url must use https (got {parsed.scheme!r})")
239
+ if not parsed.hostname or not parsed.hostname.endswith(".salesforce.com"):
240
+ raise ValueError(f"base_url hostname must be *.salesforce.com (got {parsed.hostname!r})")
125
241
  self.url = base_url.rstrip("/") + "/chat/generations"
126
242
  self.token_file = token_file
127
243
  self.core_tenant_id = core_tenant_id
@@ -191,12 +191,12 @@ def _card(rec, unit, idx, transcript=True):
191
191
  return f'''
192
192
  <details class="card">
193
193
  <summary class="card-header">
194
- <span class="card-idx">#{idx}</span>
194
+ <span class="card-idx">#{_esc(str(idx))}</span>
195
195
  <span class="{badge}">{badge_txt}</span>
196
196
  <span class="card-bucket">{_esc(BUCKET_LABELS.get(category, category))}</span>
197
197
  <span class="card-bucket">{_esc(rec["node"])}</span>
198
198
  <span class="card-utterance">{_esc((rec.get("user_utterance") or "")[:100])}</span>
199
- <span class="card-session">r{rec["repeat"]} · {_esc(rec["unit_id"][-24:])}</span>
199
+ <span class="card-session">r{_esc(str(rec["repeat"]))} · {_esc(rec["unit_id"][-24:])}</span>
200
200
  </summary>
201
201
  <div class="card-body">
202
202
  <div class="flags">{" ".join(flags)}</div>
@@ -51,7 +51,7 @@ if command -v sf >/dev/null 2>&1 && command -v jq >/dev/null 2>&1 && command -v
51
51
  SID="$(awk -F'\t' 'tolower($6)=="sid"{print $7}' "$COOKIE_JAR" 2>/dev/null | head -1)"
52
52
 
53
53
  if [ -n "$SID" ]; then
54
- AUTH_JSON="$(curl -sS "${INSTANCE_URL%/}/ide/auth" -H "Authorization: Bearer $SID" 2>/dev/null || true)"
54
+ AUTH_JSON="$(printf 'Authorization: Bearer %s' "$SID" | curl -sS "${INSTANCE_URL%/}/ide/auth" -H @- 2>/dev/null || true)"
55
55
  CANDIDATE="$(printf '%s' "$AUTH_JSON" | jq -r '.jwt // empty' 2>/dev/null || true)"
56
56
  if [ -n "$CANDIDATE" ] && [ "$CANDIDATE" != "null" ]; then
57
57
  TOKEN="$CANDIDATE"
@@ -77,13 +77,20 @@ ISS=$(printf '%s' "$DECODED" | jq -r '.iss // empty' 2>/dev/null || true)
77
77
  SFAP_RH=$(printf '%s' "$DECODED" | jq -r '.sfap_rh // empty' 2>/dev/null || true)
78
78
 
79
79
  # Determine environment and base URL
80
- DETECTED_ENV="prod"
80
+ DETECTED_ENV=""
81
81
  if echo "$ISS$SFAP_RH" | grep -qi 'test1\|test\b'; then
82
82
  DETECTED_ENV="test"
83
83
  elif echo "$ISS$SFAP_RH" | grep -qi 'stage'; then
84
84
  DETECTED_ENV="stage"
85
85
  elif echo "$ISS$SFAP_RH" | grep -qi 'dev\b'; then
86
86
  DETECTED_ENV="dev"
87
+ elif [ -n "$ISS$SFAP_RH" ]; then
88
+ DETECTED_ENV="prod"
89
+ fi
90
+
91
+ if [ -z "$DETECTED_ENV" ]; then
92
+ printf '{"error":"cannot detect SFAP environment from JWT claims (issuer and sfap_rh are both empty)","hint":"set SFAP_BASE_URL or check the org authentication"}\n'
93
+ exit 1
87
94
  fi
88
95
 
89
96
  case "$DETECTED_ENV" in
@@ -47,9 +47,10 @@ from btlib import tokens as tokenlib # noqa: E402
47
47
  from btlib import units as unitlib # noqa: E402
48
48
  from btlib import versions as versionlib # noqa: E402
49
49
  from btlib.redact import redact # noqa: E402
50
- from btlib.sfap import DEFAULT_TIMEOUT, SfapClient, build_payload, request_sha # noqa: E402
50
+ from btlib.sfap import DEFAULT_TIMEOUT, SfapClient, build_payload, request_sha, restore_param_names # noqa: E402
51
51
 
52
52
  AGENT_CONFIG_KEYS = {"router_nodes", "equivalent_tools", "arg_defaults", "description"}
53
+ MAX_REPLAY_TARGETS = 5000
53
54
 
54
55
 
55
56
  def parse_args(argv=None):
@@ -108,6 +109,10 @@ def parse_args(argv=None):
108
109
  p.add_argument("--patch", metavar="FILE",
109
110
  help="edit ops (bt.patch/1) applied to the requests before the replay; "
110
111
  "writes patch_coverage.json and stops if an op matches nothing")
112
+ p.add_argument("--max-replay-targets", type=int,
113
+ default=int(os.environ.get("MAX_REPLAY_TARGETS", str(MAX_REPLAY_TARGETS))),
114
+ help=f"upper bound on replay jobs (units x k); env MAX_REPLAY_TARGETS "
115
+ f"(default {MAX_REPLAY_TARGETS})")
111
116
  p.add_argument("--dry-run", action="store_true",
112
117
  help="build units.jsonl (and patch_coverage.json) only; no SFAP calls")
113
118
  p.add_argument("--overwrite", action="store_true", help="replace an existing run in --out-dir")
@@ -318,6 +323,7 @@ def replay(units, requests, args, client, judge, equivalence, out_dir, arg_defau
318
323
  def work(job):
319
324
  u, messages, tools, patch, rep, model, seed, sha = job
320
325
  call = client.generate(build_payload(model, messages, tools, seed=seed))
326
+ call["response"] = restore_param_names(call.get("response"), tools)
321
327
  # scored against the unit as captured: a patch edits texts, never tool names or schemas
322
328
  scores = (scoring.score_unit(u, call["response"], judge, equivalence, arg_defaults)
323
329
  if call["status"] == "ok" else None)
@@ -421,6 +427,11 @@ def main(argv=None):
421
427
  if not units:
422
428
  raise SystemExit("no units to replay (the skipped steps above say why)")
423
429
  requests, patch_info = apply_patch(units, args.patch, args.out_dir)
430
+ total_jobs = len(units) * args.k
431
+ if total_jobs > args.max_replay_targets:
432
+ raise SystemExit(f"run would dispatch {total_jobs} replay calls ({len(units)} units x {args.k}), "
433
+ f"exceeding --max-replay-targets {args.max_replay_targets}; "
434
+ f"reduce --limit or --k, or raise --max-replay-targets")
424
435
  if args.dry_run:
425
436
  print(f"dry run: wrote {args.out_dir}/units.jsonl" + (" and patch_coverage.json" if args.patch else ""))
426
437
  return 0
@@ -48,7 +48,7 @@ Apex edits, and permission-set assignment are real, side-effecting writes.
48
48
 
49
49
  | Thing | Value |
50
50
  |---|---|
51
- | Repo clone URL | `https://github.com/trailheadapps/commerce-b2b-headless.git` (ask for an existing clone first; a new clone goes to a user-confirmed path under the cwd — Step 3) |
51
+ | Repo clone URL | `https://github.com/trailheadapps/commerce-b2b-headless.git` (Step 3) |
52
52
  | UI Bundle dir (`$BUNDLE`) | `force-app/main/default/uiBundles/commerceb2bheadless` |
53
53
  | WebStore config file | `$BUNDLE/src/config/commerce.ts` |
54
54
  | Registration Apex | `UIBundleRegistration.cls` (in the repo's Apex classes folder) |
@@ -61,14 +61,9 @@ Apex edits, and permission-set assignment are real, side-effecting writes.
61
61
  ## The four values you must set
62
62
 
63
63
  Everything else in the repo is portable. These four are environment-specific — resolve each against
64
- the target org, then write it into the file. Steps 4a–4d below do this.
65
-
66
- | # | Value | File / symbol | Prefix |
67
- |---|---|---|---|
68
- | 1 | WebStore Id | `commerce.ts` → `WEBSTORE_ID` | `0ZE` |
69
- | 2 | Default BuyerGroup Id | `UIBundleRegistration.cls` → `DEFAULT_BUYER_GROUP_ID` | `0ZI` |
70
- | 3 | Buyer permission set group | `UIBundleRegistration.cls` → `BUYER_PERMISSION_SET_GROUP` (DeveloperName) | — |
71
- | 4 | Vite org alias (optional) | `vite.config.ts` → `salesforce({ orgAlias: '…' })` | — |
64
+ the target org, then write it into the file (Steps 4a–4d): the **WebStore Id** (`0ZE…`), the default
65
+ **BuyerGroup Id** (`0ZI…`), the buyer **permission set group** DeveloperName, and the optional Vite
66
+ **org alias**.
72
67
 
73
68
  ---
74
69
 
@@ -87,7 +82,14 @@ If the user gave an org alias, use it. Otherwise list what's connected and ask w
87
82
  sf org list --json | jq -r '.result.nonScratchOrgs[]?.alias, .result.scratchOrgs[]?.alias'
88
83
  ```
89
84
 
90
- Confirm it's reachable: `sf org display --target-org <alias>`. If not connected, log in:
85
+ Confirm it's reachable. Do **not** run bare `sf org display` — it prints the org's access token into
86
+ the conversation. Project only the non-secret fields:
87
+
88
+ ```bash
89
+ sf org display --target-org <alias> --json | jq -r '.result | "\(.connectedStatus) \(.instanceUrl) API \(.apiVersion)"'
90
+ ```
91
+
92
+ Expect `Connected`. If it prints anything else, log in:
91
93
  `sf org login web --alias <alias> --instance-url https://<my-domain>.my.salesforce.com`.
92
94
 
93
95
  ### Step 2 — Discover the org's WebStores, let the user pick
@@ -142,6 +144,14 @@ If the clone fails with "Repository not found" or an auth prompt, the user's Git
142
144
  see the repo — don't stop; ask for a URL they can reach (e.g. their fork) or an existing local
143
145
  clone, and continue from there. Set `$REPO` to the confirmed path.
144
146
 
147
+ Either way, show the user the code Step 5 will build and run on this machine, and get their OK unless
148
+ the origin is `trailheadapps/commerce-b2b-headless` on github.com (any URL form).
149
+
150
+ ```bash
151
+ git -C "$REPO" remote get-url origin | sed -E 's#(://)[^/@]*@#\1#' # credentials stripped
152
+ git -C "$REPO" log -1 --date=short --format='%h %cd'
153
+ ```
154
+
145
155
  Either way, the repo is a **reference implementation you adapt**, not a drop-in — the placeholder
146
156
  edits below are mandatory. Skim `$REPO/README.md` to
147
157
  confirm you're on a compatible version if anything looks different from the Fixed-facts table.
@@ -187,14 +197,36 @@ falls back to `65.0`, which mismatches newer orgs and 401s every authenticated r
187
197
 
188
198
  ### Step 5 — Build the UI Bundle, then hand off the deploy
189
199
 
190
- The `dist/` is what gets shipped, and the WebStore Id (Step 4a) is baked into it at build time. Build from
191
- inside the bundle, deleting any existing `dist/` first — if the build fails partway, a leftover
192
- `dist/` from an earlier build (old or placeholder values baked in) would otherwise deploy silently.
193
- Confirm the chosen WebStore Id made it into the bundle before deploying:
200
+ The `dist/` is what gets shipped, with the WebStore Id (Step 4a) baked in at build time. Build inside
201
+ the bundle and delete any existing `dist/` first — if the build fails partway, an earlier build's
202
+ `dist/` (old or placeholder values) would otherwise deploy silently. Confirm the chosen WebStore Id
203
+ made it into the bundle before deploying.
204
+
205
+ **First, check the clone holds nothing but your Step 4 edits** — the install and build run the repo's
206
+ scripts and `vite.config.ts` on this machine. With `REPO` set to the repo's absolute path:
207
+
208
+ ```bash
209
+ ( set -eu -o pipefail
210
+ cd "${REPO:?}"
211
+ D=force-app/main/default; U=$D/uiBundles/commerceb2bheadless
212
+ ok="( M|M |MM) ($U/src/config/commerce\.ts|$U/vite\.config\.ts|$D/classes/UIBundleRegistration\.cls)"
213
+ ok="$ok|!! ($U/(node_modules|dist)(/.*)?|\.sf(dx)?/|.*\.tsbuildinfo)"
214
+ left=$( { git status --porcelain --ignored -unormal --ignore-submodules=none
215
+ git ls-files -v | sed -n 's/^[^H] /hidden-by-index-flag: /p'; } | { grep -vE "^($ok)\$" || [ $? = 1 ]; } )
216
+ [ -z "$left" ] || { printf 'GATE FAIL:\n%s\n' "$left"; exit 1; }
217
+ echo "GATE PASS" )
218
+ ```
219
+
220
+ Only `GATE PASS` lets you continue; `GATE FAIL`, an error, or no output is a **STOP** — show the user
221
+ the output and go on only if they confirm each item (say, the Chatter change from an earlier run).
222
+ Then skim `git diff HEAD`: only the Step 4 values should differ. This doesn't vet the repo's code,
223
+ `.git` hooks, or install scripts.
224
+
225
+ Install with `npm ci`, not `npm install`: it installs exactly what the committed `package-lock.json`
226
+ pins and fails rather than resolve anything new. If it fails, stop and tell the user.
194
227
 
195
228
  ```bash
196
- cd $REPO && npm install
197
- cd $BUNDLE && npm install && rm -rf dist && npm run build # tsc -b && vite build → fresh dist/
229
+ cd "$REPO/force-app/main/default/uiBundles/commerceb2bheadless" && rm -rf dist && npm ci && npm run build # tsc -b && vite build → fresh dist/
198
230
  grep -l '<0ZE…>' dist/assets/*.js >/dev/null && echo "WebStore Id baked"
199
231
  ```
200
232
 
@@ -286,7 +318,7 @@ Report the `siteUrl` as **"here is your hosted React Storefront"**. If `status`
286
318
  site needs publishing — direct the user to **Setup → Digital Experiences → All Sites →
287
319
  commerceb2bheadless → Publish** (Experience Builder), then re-fetch the URL. If the endpoint returns
288
320
  nothing, construct the fallback `https://<my-domain>.my.site.com/commerceb2bheadless` — the path is
289
- the site name, not the `vforcesite` prefix. Get `<my-domain>` from `sf org display`'s instance URL;
321
+ the site name, not the `vforcesite` prefix. Get `<my-domain>` from the `instanceUrl` Step 1 printed;
290
322
  non-production instances use a different site-domain suffix, so tell the user to verify the URL in
291
323
  All Sites.
292
324
 
@@ -298,14 +330,15 @@ If the four values are already set (Step 4 done), the repo's own orchestrator do
298
330
  permset in one go:
299
331
 
300
332
  ```bash
301
- cd $REPO && npm run setup -- --target-org <alias> --skip-dev --skip-data
333
+ cd "$REPO" && npm run setup -- --target-org <alias> --skip-dev --skip-data
302
334
  ```
303
335
 
304
336
  Caveats — it does **not** replace the placeholders and it assigns `UIBundleApexAccess` to the
305
337
  **current user**, not the guest user, so you **still** run Step 4 before it and Step 6 (the guest
306
- assignment) after it. Drop `--skip-dev` only if the user wants the local Vite dev server
307
- (`localhost:5173`) instead of / in addition to the hosted site. If the bundle has no GraphQL
308
- codegen wired, add `--skip-graphql`.
338
+ assignment) after it. Run Step 3's origin print and Step 5's check before it too: it runs the repo's
339
+ code and installs with `npm install`, not `npm ci`. Drop `--skip-dev` only if the user wants the
340
+ local Vite dev server (`localhost:5173`) instead of / in addition to the hosted site. If the bundle
341
+ has no GraphQL codegen wired, add `--skip-graphql`.
309
342
 
310
343
  ## Troubleshooting (from the repo README)
311
344
 
@@ -1,10 +1,13 @@
1
1
  ---
2
2
  name: dx-lifecycle-center
3
- description: "Lifecycle Center for DX Inspector and Builder Central. Use this skill first for four jobs: (A) list the orgs connected to DX Inspector; (B) connect a new org (sandbox or scratch, production, OrgFarm) as a deploy target; (C) connect or check the Lifecycle Center org, also written LifecycleCenter org, lifecycle-center, ALMDevOpsCenterHub, DevOps Center hub, or Hub org; (D) deploy, validate, or quick-deploy components that already exist in the user's org to a connected org, and poll a simple-deploy requestId. TRIGGER on: show, list, or pick connected orgs or environments; connect, add, log in to, or repair an org; connect the Lifecycle Center org; deploy, validate, or push components to another org, URL, org id, alias, or environment name. Short asks like \"connect a new org\", \"which orgs can I deploy to\", or \"deploy to my sandbox\" match. These deploys move components from the connected source org to another org, not local project files."
3
+ description: "Lifecycle Center for DX Inspector and Builder Central. Four jobs: (A) list the orgs connected to DX Inspector; (B) connect a new org (sandbox or scratch, production, OrgFarm) as a deploy target; (C) connect or check the Lifecycle Center org, also written LifecycleCenter, lifecycle-center, ALMDevOpsCenterHub, or Hub org; (D) deploy, validate, or quick-deploy components that already exist in the user's org to a connected org, and poll a simple-deploy requestId. TRIGGER on: show, list, or pick connected orgs or environments; connect, add, log in to, or repair an org; connect the Lifecycle Center org; deploy, validate, push, or publish components (metadata) to another org, URL, org id, alias, or environment name. Short asks like \"connect a new org\" or \"deploy to my sandbox\" match. NOT for promoting work items (dx-devops-promote), local source deploys (platform-metadata-deploy), or publishing sites or packages. Deploys move components between orgs, not local files."
4
4
  metadata:
5
5
  version: "1.0"
6
6
  domains: ["Developer Experience"]
7
7
  minApiVersion: "67.0"
8
+ relatedSkills:
9
+ - "dx-devops-promote"
10
+ - "platform-metadata-deploy"
8
11
  cliTools:
9
12
  - tool: ["jq"]
10
13
  semver: ">=1.6"
@@ -20,7 +23,7 @@ This skill manages which orgs a user can deploy to, and deploys to them. Everyth
20
23
 
21
24
  | Op | Name | What it does | Details |
22
25
  |---|---|---|---|
23
- | **A** | List orgs | Shows the orgs connected to DX Inspector (the deploy targets), or the current org's details. Also resolves a target the user names. | `references/list-orgs.md` |
26
+ | **A** | List orgs | Shows the orgs connected to DX Inspector (the deploy targets) and whether each is ready in this workspace, or the current org's details. Also resolves a target the user names. | `references/list-orgs.md` |
24
27
  | **B** | Connect an org | Connects a new sandbox or scratch, production, or OrgFarm org as a deploy target, or repairs a half-finished connection. The user signs in through a link. | `references/connect-org.md` |
25
28
  | **C** | Lifecycle Center org | Connects, repairs, or checks the Lifecycle Center org (credential `ALMDevOpsCenterHub`). | `references/hub-org.md` |
26
29
  | **D** | Deploy | Deploys, validates, or quick-deploys components from the source org to a connected target, then polls to the end. | `references/deploy.md` |
@@ -34,18 +37,18 @@ Connect (B) and deploy or quick deploy (D) change an org, so they wait for the u
34
37
  | Source org | The org the user built in. Use the alias they name, else the default org from `sf org display --json`. Components must already exist in it. |
35
38
  | DX Inspector environment | A `DevopsEnvironment` record in the source org with a Named Credential. The deploy targets are exactly these records. |
36
39
  | Deploy target | An environment in state `selectable`. An `expired` or `unauthenticated` environment is not a target. |
37
- | Lifecycle Center org | The Lifecycle Center hub. A separate connection that is never a deploy target. |
40
+ | Lifecycle Center org | The Lifecycle Center hub. A separate connection that is never a deploy target; it is shown in a list only when connected, labelled Lifecycle Center (Production Org). |
38
41
 
39
42
  ## Routing (deterministic)
40
43
 
41
- Scripts, references, and assets are paths inside this skill's folder, `<skill_dir>`: the location given for this skill when it was listed or loaded, without the trailing `/SKILL.md`. Run every script as `bash <skill_dir>/scripts/<script>` from the current folder. Do not `cd` first (the current folder sets the default org for `sf`), and never guess another folder or search the filesystem for the skill. This skill owns every request below. Pick the operation by these rules **in order; the first match wins**. Do not hand these requests to another skill, and do not answer them from general knowledge.
44
+ Scripts and references are paths inside this skill's folder (the folder that holds this file). This skill owns every request below. Pick the operation by these rules **in order; the first match wins**. Do not hand these requests to another skill, and do not answer them from general knowledge.
42
45
 
43
46
  | # | The request | Operation |
44
47
  |---|---|---|
45
48
  | 1 | Names the Lifecycle Center org, in any request, however it is spelled: "Lifecycle Center", "lifecyclecenter", "lifecycle-center", "lifecycle_center" (matching rules in `references/hub-org.md`) | **C** |
46
- | 2 | Deploy, validate, quick deploy, or push components to an org, URL, org id, alias, or environment name; or gives a `requestId` or validation id | **D** |
49
+ | 2 | Deploy, validate, quick deploy, push, or publish components (metadata) to an org, URL, org id, alias, or environment name; or gives a `requestId` or validation id | **D** |
47
50
  | 3 | Show, list, or pick connected orgs or environments; "which orgs can I deploy to"; the current org's details | **A** |
48
- | 4 | Connect, add, log in to, reconnect, or repair an org or its credential | **B** |
51
+ | 4 | Connect, add, log in to, reconnect, or repair an org or its credential; **sync**, **refresh**, or **re-sync** an org's workspace access; or a `sf` command on a connected org failed with `Session expired or invalid` / `INVALID_SESSION_ID` | **B** (the sync procedure, `references/connect-org.md`) |
49
52
  | 5 | Anything else about connected orgs or DX Inspector environments | **A** |
50
53
 
51
54
  The Lifecycle Center org rule (1) has two exclusions: "Dev Hub" is never the Lifecycle Center org, and plural phrases such as "DevOps Center orgs", "DX Inspector orgs", "environments", or "orgs connected to DX Inspector" are not the Lifecycle Center org; route them by rules 2 to 5. Details: `references/hub-org.md`.
@@ -54,7 +57,7 @@ The Lifecycle Center org rule (1) has two exclusions: "Dev Hub" is never the Lif
54
57
 
55
58
  | Operation | Action words (any form: "deploy", "deploying", "deployment") | Object words |
56
59
  |---|---|---|
57
- | **D** | deploy, deployment, validate, validation, check only, dry run, quick deploy, quickdeploy, push, send, ship, move, copy, release, add or install (when the object is a component) | components, metadata, classes, flows, objects, or a named org as the destination ("to", "into", "onto") |
60
+ | **D** | deploy, deployment, validate, validation, check only, dry run, quick deploy, quickdeploy, push, send, ship, move, copy, release, publish, add or install (when the object is a component, never a site, article or package version) | components, metadata, classes, flows, objects, or a named org as the destination ("to", "into", "onto") |
58
61
  | **B** | connect, connection, add, link, hook up, hookup, authorize, authenticate, log in, login, sign in, set up, setup, register, onboard, reconnect, repair, fix, refresh | org, environment, env, sandbox, scratch, production, prod, orgfarm, org farm |
59
62
  | **A** | show, list, see, view, display, which, what, pick, choose, available | orgs, environments, envs, targets, connections, "where can I deploy" |
60
63
 
@@ -62,28 +65,30 @@ A request with a **D** action word and a destination, or that names a component
62
65
 
63
66
  A request that mixes jobs (for example "connect my sandbox and deploy AccountService to it") takes the lowest-numbered match, here **D**, which runs **B** itself when the target is not connected.
64
67
 
65
- **Vague prompts.** If the message is only "deploy", "push my changes", "connect an org", or similar, do not guess and do not call any API. Ask exactly one question that fixes the first missing input:
68
+ **Vague prompts.** If the message is only "deploy", "push my changes", "publish my changes", "connect an org", or similar, do not guess and do not call any API. Ask exactly one question that fixes the first missing input:
66
69
 
67
70
  | Intent | Ask, in this order |
68
71
  |---|---|
69
72
  | Deploy | 1. Which components? (`references/deploy.md`, Step 1) 2. Which target org? |
70
- | Connect | 1. "Is it a sandbox or scratch org, a production org, or an OrgFarm org?" 2. What short name (letters only) should the environment have? |
73
+ | Connect | 1. "Is it a sandbox or scratch org, a production org, or an OrgFarm org?" 2. What short name should the environment have? |
71
74
  | Not clear which | "Do you want to connect an org or deploy components?" |
72
75
 
73
76
  A bare "deploy" with no DX Inspector context is a question, not a deploy.
74
77
 
75
78
  ## Rules that always apply
76
79
 
77
- - Targets come from the DX Inspector environments in the source org, never from `sf org list` or local aliases.
80
+ - Targets come from the DX Inspector environments in the source org, never from `sf org list` or local aliases. (A connect also registers the environment name as a workspace alias for the user's convenience; that does not make aliases a source of targets.)
78
81
  - Never deploy to a target that is not `selectable`, never to the source org, and never to the Lifecycle Center org.
79
- - The Lifecycle Center org never appears in a list and is not mentioned while listing. It is discussed only when the user asks about it.
80
- - Confirm before every call that changes an org: connect (`connect-org.md`, Step 1) and deploy (`deploy.md`, Step 4). `validate` is the only mode that needs no confirmation.
82
+ - The Lifecycle Center org appears in a list only when it is connected, as one labelled row, Lifecycle Center (Production Org), with no button, never a deploy target and never in Sync all. When it is not connected the list does not mention it.
83
+ - Confirm before every call that changes an org: connect (`connect-org.md`, Step 1) and deploy (`deploy.md`, Step 4). `validate` is the only mode that needs no confirmation. A click on a Sync / Refresh button, or an explicit ask to sync, is the confirmation for a workspace sync; listing never syncs by itself.
84
+ - A timeout (`TARGET_ORG_AUTHENTICATION_TIMEOUT`) is transient: retry once after about 10 seconds yourself, then stop. Only a 401 or 403 means the sign-in is stale.
81
85
  - When a connect started from a deploy and finishes, tell the user the org is connected and that you are continuing the deploy, then ask for the deploy confirmation. Connecting never deploys by itself.
82
86
  - A sandbox and a scratch org are the same type (`SANDBOX`). Treat their URLs alike.
87
+ - **Always double-quote an org alias in a shell command.** Environment names may contain spaces (`Dev 12 Org`), so write `--target-org "Dev 12 Org"`, never `--target-org Dev 12 Org`. Quote every alias, name or id taken from user input or from the resolver output, in every `sf` command and script argument.
88
+ - **Fix what can be fixed yourself.** An error a retry or a sync can clear (expired session, timeout, a missing workspace alias on an org the task needs) is handled in place: sync or retry, then carry on with the task and say what you did in one line. Do not hand the user a button or a question for it. Ask only when the fix needs them: a browser sign-in, a name clash, or an org-changing action they have not asked for.
83
89
  - Make one attempt per API call. Never retry in a loop, resubmit after a timeout, or invent an id, credential name, or status.
84
90
  - Never ask for, print, or pass an access token. Never show row ids or credential names.
85
91
  - Never say a browser was opened. Give the login link and wait for the user to reply **done**.
86
- - Pass `render_widget` only a `CARD_JSON` line that `scripts/widget.sh` printed, exactly as printed. Never write, invent, or edit a card.
87
92
  - Do not guess a missing input. Ask one question for the first missing input.
88
93
  - Ask the user to confirm an org type that the URL host does not decide. Never infer it from an environment name.
89
94
 
@@ -91,10 +96,11 @@ A bare "deploy" with no DX Inspector context is a question, not a deploy.
91
96
 
92
97
  | After | Reply with |
93
98
  |---|---|
94
- | **A** list | Only the table and the closing sentence (`list-orgs.md`, section 4). No raw JSON, no extra offers. |
99
+ | **A** list | The table of usable orgs, the action buttons (Sync / Re-sync / Refresh, plus Sync all N when two or more need it), the one left-out line when needed, and the closing sentence (`list-orgs.md`, section 4). No raw JSON, no status column, no other offers. |
100
+ | **B** sync (button click or failed `sf` command) | One line per org (synced, timed out, sign-in needed, name clash, or not available), then the list again. No sign-in link for a timeout (`connect-org.md`, *Sync workspace access*). |
95
101
  | **A** not enabled | The one-sentence message in `list-orgs.md`, section 2. Nothing else. |
96
102
  | **B** connect | The sign-in layout with a button-style link (`connect-org.md`, Step 2), then after **done** the connected layout: environment name, org host, type, and status (`connect-org.md`, Step 5). |
97
- | **C** | The exact sentences in `hub-org.md`. When connecting, the same sign-in and connected layouts as B, in hub form, or the sign-in and connected cards when the `render_widget` tool is available (`connect-org.md`, Steps 2 and 5). |
103
+ | **C** | The exact sentences in `hub-org.md`. When connecting, the same sign-in and connected layouts as B, in hub form. |
98
104
  | **D** | A plain-language report: what was deployed, from where, to where, and the outcome (`deploy.md`, Step 7). No raw JSON. If the deploy is still running after about 2 minutes: the `requestId`, a note that it is in progress, and a request to send the id back to get the status (`deploy.md`, Step 6). |
99
105
 
100
106
  ## If something fails
@@ -104,7 +110,8 @@ A bare "deploy" with no DX Inspector context is a question, not a deploy.
104
110
  | The list or target lookup fails | `references/list-orgs.md`, section 2 |
105
111
  | A connect step fails | `references/troubleshooting.md` |
106
112
  | A deploy or validate fails | `references/error-handling.md` |
107
- | The target login is stale | Reconnect that environment (`references/connect-org.md`, repair path), then ask before retrying |
113
+ | The target login is stale | Sync it first (`references/connect-org.md`, *Sync workspace access*) and retry the step yourself. Only a 401/403 that a sync cannot fix needs the user's sign-in (repair path), and after it you retry without asking |
114
+ | A `sf` command on a connected org says the session expired | Sync that org's workspace access (`references/connect-org.md`, *Sync workspace access*), then retry the command once |
108
115
 
109
116
  ## References
110
117
 
@@ -118,6 +125,5 @@ A bare "deploy" with no DX Inspector context is a question, not a deploy.
118
125
  - `references/error-handling.md`: deploy error codes.
119
126
  - `examples/workflows.md`: worked prompts for each operation.
120
127
  - `scripts/resolve-environment.sh`: read-only list and identifier resolver.
128
+ - `scripts/hub-get.sh`: read-only GET against the Lifecycle Center org through its credential (`references/hub-org.md`).
121
129
  - `scripts/poll-deploy-status.sh`: read-only status poller. Reads the Simple Deploy endpoint and `DevopsRequestInfo`, and reports component errors on failure.
122
- - `scripts/widget.sh`: Operation C, Steps 2 and 5, only when the `render_widget` tool is available. Fills a card from `assets/widgets/` with `scripts/fill-widget.jq`, checks it with `scripts/card-policy.jq`, and prints `CARD_JSON <json>` or `CARD_UNAVAILABLE <reason>`. Makes no API call.
123
- - `assets/widgets/<name>/`: the HXL chat cards (`connect-sign-in`, `connect-connected`), each a tile tree `<name>.json` and the `schema.json` of its values.