@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.
- package/package.json +1 -1
- package/skills/afcc-setup-coordinate/SKILL.md +348 -0
- package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
- package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
- package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
- package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
- package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
- package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
- package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
- package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
- package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
- package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
- package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
- package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
- package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
- package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
- package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
- package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
- package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
- package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
- package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
- package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
- package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
- package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
- package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
- package/skills/commerce-react-storefront-create/SKILL.md +54 -21
- package/skills/dx-lifecycle-center/SKILL.md +24 -18
- package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
- package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
- package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
- package/skills/dx-lifecycle-center/references/deploy.md +3 -3
- package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
- package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
- package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
- package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
- package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
- package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
- package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
- package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
- package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
- package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
- package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
- package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
- package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
- package/skills/experience-afv-analytics-query/SKILL.md +239 -0
- package/skills/experience-afv-analytics-query/references/references.md +176 -0
- package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
- package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
- package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
- package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
- package/skills/experience-app-mcp-generate/SKILL.md +174 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
- package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
- package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
- package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
- package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
- package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
- package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
- package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
- package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
- package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
- package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
- package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
- package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
- package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
- package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
- package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
- package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
- package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
- package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
- package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
- package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
- package/skills/platform-custom-field-generate/SKILL.md +24 -16
- package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
- package/skills/platform-custom-setting-generate/SKILL.md +1 -0
- package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
- package/skills/platform-flexipage-generate/SKILL.md +7 -10
- package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
- package/skills/platform-policy-rule-generate/SKILL.md +9 -7
- package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
- package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
- package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
- package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
- package/skills/platform-report-generate/SKILL.md +20 -1
- package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
- package/skills/platform-report-generate/references/verification-checklist.md +12 -0
- package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
- package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
- package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
- package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
- package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
- package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
- package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
- package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
- package/skills/service-e911-configure/SKILL.md +242 -0
- package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
- package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
- package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
- package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
- package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
- package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
- package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
- package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
- package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
- package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
- package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
- package/skills/experience-content-media-image-generate/SKILL.md +0 -83
- package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
- package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# MCP Tool Widget Resources
|
|
2
|
+
|
|
3
|
+
Read this only for Phase 6, after the MCP stack and its backing actions have deployed successfully. Use `<skill-dir>` and `<default-package>` from `../SKILL.md`. Do not run it for an explicit preview/activate-only request on an existing named server; that bypass leaves metadata unchanged.
|
|
4
|
+
|
|
5
|
+
## 1. Eligible deployed tools
|
|
6
|
+
|
|
7
|
+
Build the eligible list from the final deployed `<tools>` bindings. Include only an `apiIdentifier` starting with `aa:apex-`. Report `fa:flow-` and `pr:` tools as skipped; `<prompts>` bindings are unaffected. Never route these through the agent-action coordinator.
|
|
8
|
+
|
|
9
|
+
Use the selected tool's real `apiDefinition` / `operation` as the invocable action API name, including its namespace. Do not substitute `toolName`, a label, a folder name, or an action guessed from the identifier. Confirm this deployed action is available through a read-only Actions REST describe; never execute the MCP tool or backing action to discover its shape. If a deployed operation cannot be resolved, stop rather than falling back to stale local source. If no tools are eligible, report that explicitly and proceed to Phase 7 without changing resources.
|
|
10
|
+
|
|
11
|
+
## 2. Generate artifacts and check the response bundle
|
|
12
|
+
|
|
13
|
+
For each eligible tool, load and invoke `platform-mcp-tool-widget-coordinate` with the target org alias, server DeveloperName, actual deployed action API name (`operation`), current SFDX project, and default package metadata directory. The coordinator owns payload discovery, exactly two object-based CLTs, leaf-skill generation of the response CLT, envelope CLT and HXL widget, the envelope's default renderer, and validation. Do not duplicate its leaf generation or author those artifacts from memory.
|
|
14
|
+
|
|
15
|
+
Capture all generated filenames and named gate results. Resolve the response CLT, envelope CLT, and widget names from their actual bundle directories, and verify the reported files exist in the current project's default package. Require widget self-validation and every coordinator hard gate to pass; invented-field failures also block. Record advisory omissions. Missing or ambiguous artifacts, a failed gate, or not-run validation blocks deployment; report partial files and stop. Existing renderer conflicts must be read and resolved with the user's consent before replacement, never overwritten automatically.
|
|
16
|
+
|
|
17
|
+
The coordinator generates artifacts and reports its existing validation results; this caller owns the additional response-bundle check and deployment checklist below. Do not require the coordinator to emit a `DEPLOYMENT HANDOFF` or run the caller's extra check. Generation order is not deployment order.
|
|
18
|
+
|
|
19
|
+
**Caller-owned check: `response-bundle-schema-only`.** Run this after the coordinator's gates pass and before any artifact deployment:
|
|
20
|
+
|
|
21
|
+
1. Resolve `<default-package>/main/default/lightningTypes/<RESPONSE_CLT_NAME>/` from the verified response artifact. Inspect the entire directory recursively, including pre-existing files, hidden entries, and surface subdirectories; print its relative file inventory. Do not limit the inspection to the coordinator's generated-file list.
|
|
22
|
+
2. Require the bundle's only file to be its valid `schema.json`, matching the response CLT that passed the coordinator's gates. Any renderer, editor, surface-specific configuration, or other custom artifact makes it unsuitable for this response-first deployment plan. Report `response-bundle-schema-only: fail` with the conflicting paths and stop before deployment. Obtain approval for a new response name or reconciliation, then regenerate and rerun the affected gates and this check. Never delete unknown files to make the check pass.
|
|
23
|
+
3. Report `response-bundle-schema-only: pass` with the inspected bundle path and complete inventory only after executing the check. Missing source, an unreadable directory, an uninspected entry, or a not-run check blocks deployment. Reuse an existing response bundle only when it passes both this check and the coordinator's compatibility gates.
|
|
24
|
+
|
|
25
|
+
## 3. Prepare and execute the deployment checklist
|
|
26
|
+
|
|
27
|
+
After all generation gates and the caller's response-bundle check pass, prepare the checklist using the exact source metadata member names from the verified bundle directories. Keep these member names separate from runtime CLT FQNs, which are confirmed independently for resource attachment in step 5. Confirm that the deployed backing action from Phase 5 remains the action described for generation.
|
|
28
|
+
|
|
29
|
+
For each eligible tool, use this dependency order:
|
|
30
|
+
|
|
31
|
+
1. Deploy the schema-only response CLT. The envelope's `outputValues` references this type.
|
|
32
|
+
2. Deploy the widget bundle. The envelope's default renderer references this widget.
|
|
33
|
+
3. Deploy the envelope CLT, including its default renderer, after both dependencies are deployed.
|
|
34
|
+
|
|
35
|
+
Prepare the following narrow commands with the verified component names and confirmed target org alias, show the complete checklist, and ask for deployment confirmation:
|
|
36
|
+
```bash
|
|
37
|
+
sf project deploy start --metadata LightningTypeBundle:<RESPONSE_CLT_NAME> --target-org <target-org-alias>
|
|
38
|
+
sf project deploy start --metadata UiWidgetBundle:<WIDGET_NAME> --target-org <target-org-alias>
|
|
39
|
+
sf project deploy start --metadata LightningTypeBundle:<ENVELOPE_CLT_NAME> --target-org <target-org-alias>
|
|
40
|
+
```
|
|
41
|
+
The coordinator does not deploy; this caller executes the approved checklist. Never deploy a whole `lightningTypes/`, `uiWidgets/`, package, or metadata-type directory. Require `Succeeded` and read-only confirmation that the named component exists before advancing. Stop on the first failure; do not retrieve or modify the MCP server. For multiple tools, repeat this dependency order for each tool. An existing component can satisfy a step only after read-only verification that its deployed content matches the validated artifact; local presence alone is insufficient. Attach resources and deploy the named MCP server only after all artifact dependencies are ready, as specified in steps 4–6.
|
|
42
|
+
|
|
43
|
+
## 4. Retrieve authoritative server
|
|
44
|
+
|
|
45
|
+
After all generated artifact groups deploy successfully, retrieve the authoritative server before attaching anything. Inspect the destination file first. When local edits exist, show the diff and ask for overwrite consent **before retrieval**; without consent stop, preserving those edits. Never retrieve first and ask afterward. Preserve the approved binding snapshot for comparison; it is not a stale file to redeploy.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
sf project retrieve start --metadata McpServerDefinition:<SERVER_DEV_NAME> --target-org <target-org-alias>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Confirm the destination is `<default-package>/main/default/mcpServerDefinitions/<SERVER_DEV_NAME>.mcpServerDefinition-meta.xml`. Verify every approved tool and prompt and their field values are intact. If a binding differs, stop and reconcile with the user; do not overwrite concurrent server changes using the old local copy.
|
|
52
|
+
|
|
53
|
+
## 5. Attach widget relationships
|
|
54
|
+
|
|
55
|
+
**Phase 6 widget linkage exception:** direct XML editing is permitted only for top-level `<resources>` and the selected existing tool's `<uiResource>` in this freshly retrieved component. Phase 4 API/tool/prompt bindings must still use `merge_tools.mjs`; its JSON keys do not accept widget links. Do not add a general XML parser or reconstruct the whole server.
|
|
56
|
+
|
|
57
|
+
1. Match the target tool using its existing `apiIdentifier`, `operation`, and `toolName`. If the match is ambiguous, ask before editing.
|
|
58
|
+
2. Use the generated envelope CLT FQN independently confirmed from project/package context and deployed metadata: `c__` for a local namespace-less bundle, or `<namespace>__` only when that generated bundle's runtime identity is confirmed. Never derive it from the action namespace or folder name. The generated local source references stay `c__` and `@widget/c/`, even in a namespace-bearing org; backing Apex references have their own namespace. An installed `pkg` action in a namespace-less project can use `@apexClassType/pkg__Outer$Inner` while the runtime resource URI remains `ui://widget/lightningType/c__Envelope`. Never point the resource at the response CLT.
|
|
59
|
+
3. Select a stable MCP-local resource name and human-readable title and description. Read existing resources and the tool's link first. Use idempotent reuse when the resource URI/title/description and selected tool link already match; leave them unchanged and do not duplicate them. If a name is taken by a different resource, the tool already links another resource, or existing metadata would need replacement, show the conflict and ask for explicit reuse, rename, or replacement approval. Do not delete a resource used by other tools or rename its consumers implicitly.
|
|
60
|
+
4. Add one top-level `<resources>` block, a sibling of `<tools>`, never nested in it. Its URI is precisely `ui://widget/lightningType/<EnvelopeCLT-FQN>`. Add exactly one `<uiResource>` in the selected tool whose value matches `resourceName` byte-for-byte, including case. XML-escape user-supplied values.
|
|
61
|
+
5. Preserve the root element, namespace, existing tools, prompts, resources, all field values, indentation, and surrounding field order. Only approved widget-linkage values may change; do not reorder or rebuild unrelated metadata.
|
|
62
|
+
|
|
63
|
+
PR-compatible structural example (preserve all existing tool fields):
|
|
64
|
+
```xml
|
|
65
|
+
<McpServerDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
66
|
+
<tools>
|
|
67
|
+
<!-- Existing apiDefinition, behavior, name and title stay intact. -->
|
|
68
|
+
<uiResource>hotelDetails</uiResource>
|
|
69
|
+
</tools>
|
|
70
|
+
<resources>
|
|
71
|
+
<resourceName>hotelDetails</resourceName>
|
|
72
|
+
<resourceUri>ui://widget/lightningType/c__hotelInfoResult</resourceUri>
|
|
73
|
+
<resourceTitle>Hotel details</resourceTitle>
|
|
74
|
+
<description>Displays the selected hotel's details.</description>
|
|
75
|
+
</resources>
|
|
76
|
+
</McpServerDefinition>
|
|
77
|
+
```
|
|
78
|
+
This is a linkage fragment, not a replacement server or a complete tool spec. Use the independently confirmed deployed envelope FQN in the URI; do not infer it from a namespaced action or blanket-substitute that runtime prefix into generated local source references.
|
|
79
|
+
|
|
80
|
+
## 6. Validate and deploy the server
|
|
81
|
+
|
|
82
|
+
Validate before writing to the org:
|
|
83
|
+
|
|
84
|
+
- XML is well-formed; the root `McpServerDefinition` element and namespace are unchanged.
|
|
85
|
+
- Resources are top-level siblings of tools; `resourceName`, `resourceUri`, `resourceTitle`, and `description` are non-empty; resource names are unique.
|
|
86
|
+
- Each intended URI exactly equals `ui://widget/lightningType/<EnvelopeCLT-FQN>` and resolves to the successfully deployed envelope CLT with its renderer.
|
|
87
|
+
- Each selected tool has exactly one intended `<uiResource>` matching an existing `resourceName` including capitalization; no link is outside its selected tool.
|
|
88
|
+
- Every approved binding and all unrelated tools, prompts, resources, and field values remain intact. Review the diff against the freshly retrieved authoritative file.
|
|
89
|
+
|
|
90
|
+
Name mismatches, unresolved FQNs, missing `lightningType` URI segments, nested resources, misplaced or duplicate links, and unapproved changes are blocking. Report the tool, resource name, final URI, generated files/FQNs, and individual validation results. Ask for MCP deployment confirmation, then deploy only the named server:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
sf project deploy start --metadata McpServerDefinition:<SERVER_DEV_NAME> --target-org <target-org-alias>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Stop on failure. Re-retrieve the same named component (apply the same prior overwrite-consent rule for any new local edits), and verify that every approved resource URI and tool relationship persisted and approved bindings remain intact **before activation**. A successful deploy alone is not relationship verification. For unchanged idempotent reuse, no redundant deploy is needed, but verify deployed relationships before Phase 7. Client-side widget rendering remains pending integration verification, not a claim this metadata read-back proves.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Activate a deployed MCP server by setting Tooling McpServerAccess.Active=true.
|
|
3
|
+
// Output the re-queried state so active=true signals successful activation.
|
|
4
|
+
//
|
|
5
|
+
// Usage: node activate_server.mjs <TARGET_ORG_ALIAS> <SERVER_DEVELOPER_NAME> [--confirm]
|
|
6
|
+
//
|
|
7
|
+
// default : resolve, query, and print the proposed action without writing.
|
|
8
|
+
// --confirm : perform that Tooling write.
|
|
9
|
+
//
|
|
10
|
+
// Output: a JSON object on stdout with the server state and plannedRequest.
|
|
11
|
+
// plannedRequest is the write preview when --confirm is omitted, and null after a write.
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import { execFileSync } from "node:child_process";
|
|
14
|
+
import { isValidDeveloperName } from "./utils/developer_name.mjs";
|
|
15
|
+
|
|
16
|
+
function fail(msg, code = 1) {
|
|
17
|
+
process.stderr.write(msg + "\n");
|
|
18
|
+
process.exit(code);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const positional = [];
|
|
22
|
+
let confirm = false;
|
|
23
|
+
for (const arg of process.argv.slice(2)) {
|
|
24
|
+
if (arg === "--confirm") {
|
|
25
|
+
confirm = true;
|
|
26
|
+
} else if (arg.startsWith("--")) {
|
|
27
|
+
fail(`ABORT: unknown option '${arg}' — the only option is --confirm, which performs the write. The default previews it.`);
|
|
28
|
+
} else {
|
|
29
|
+
positional.push(arg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const [targetOrg, serverName, extra] = positional;
|
|
33
|
+
if (!targetOrg) fail("ABORT: target org alias required");
|
|
34
|
+
if (!serverName) fail("ABORT: McpServerDefinition DeveloperName required");
|
|
35
|
+
if (extra !== undefined) {
|
|
36
|
+
fail("ABORT: too many arguments — usage: activate_server.mjs <org> <ServerDevName> [--confirm]");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// SERVER_NAME is embedded in SOQL.
|
|
40
|
+
if (!isValidDeveloperName(serverName)) {
|
|
41
|
+
fail(
|
|
42
|
+
`ABORT: invalid DeveloperName '${serverName}' — letters/digits/single underscores, optional namespace__ prefix, start with a letter, <= 80 chars.`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const V = JSON.parse(fs.readFileSync("sfdx-project.json", "utf-8")).sourceApiVersion;
|
|
47
|
+
|
|
48
|
+
function sf(argv) {
|
|
49
|
+
return execFileSync("sf", argv, { encoding: "utf-8" });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let disp;
|
|
53
|
+
try {
|
|
54
|
+
disp = JSON.parse(sf(["org", "display", "--target-org", targetOrg, "--json"]));
|
|
55
|
+
} catch {
|
|
56
|
+
disp = null;
|
|
57
|
+
}
|
|
58
|
+
const instanceUrl = disp?.result?.instanceUrl ?? "";
|
|
59
|
+
if (!instanceUrl) fail(`ABORT: could not read org connection for ${targetOrg}`);
|
|
60
|
+
|
|
61
|
+
const toolingPath = `/services/data/v${V}/tooling`;
|
|
62
|
+
const toolingUrl = `${instanceUrl}${toolingPath}`;
|
|
63
|
+
|
|
64
|
+
function toolingQuery(soql) {
|
|
65
|
+
const encoded = encodeURIComponent(soql);
|
|
66
|
+
try {
|
|
67
|
+
return sf(["api", "request", "rest", `${toolingPath}/query?q=${encoded}`, "--target-org", targetOrg, "--method", "GET"]);
|
|
68
|
+
} catch {
|
|
69
|
+
fail("ABORT: authenticated Tooling query failed.");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// A malformed successful response must not fall through to a write.
|
|
74
|
+
function requireRecords(jsonText, label) {
|
|
75
|
+
let parsed;
|
|
76
|
+
try {
|
|
77
|
+
parsed = JSON.parse(jsonText);
|
|
78
|
+
} catch {
|
|
79
|
+
parsed = null;
|
|
80
|
+
}
|
|
81
|
+
if (!parsed || !Array.isArray(parsed.records)) {
|
|
82
|
+
fail(`ABORT: malformed ${label} query response (no .records array) — failing closed before any write.`);
|
|
83
|
+
}
|
|
84
|
+
return parsed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let mcpId, accessId, active;
|
|
88
|
+
|
|
89
|
+
// Propagate query failures out before any write.
|
|
90
|
+
function readAccess() {
|
|
91
|
+
const json = toolingQuery(`SELECT Id,Active FROM McpServerAccess WHERE McpServerId='${mcpId}'`);
|
|
92
|
+
const parsed = requireRecords(json, "McpServerAccess");
|
|
93
|
+
accessId = parsed.records[0]?.Id ?? "";
|
|
94
|
+
active = String(parsed.records[0]?.Active ?? "");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const mcpJson = requireRecords(
|
|
98
|
+
toolingQuery(`SELECT Id FROM McpServerDefinition WHERE DeveloperName='${serverName}'`),
|
|
99
|
+
"McpServerDefinition",
|
|
100
|
+
);
|
|
101
|
+
mcpId = mcpJson.records[0]?.Id ?? "";
|
|
102
|
+
if (!mcpId) {
|
|
103
|
+
fail(`ABORT: no McpServerDefinition named '${serverName}' — deploy the prepared metadata before activating.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
readAccess();
|
|
107
|
+
|
|
108
|
+
function emit(action, activeVal, method = "", url = "", body = null) {
|
|
109
|
+
return JSON.stringify({
|
|
110
|
+
mcpServerId: mcpId,
|
|
111
|
+
accessId: accessId ?? "",
|
|
112
|
+
action,
|
|
113
|
+
active: activeVal === "true",
|
|
114
|
+
plannedRequest: method === "" ? null : { method, url, body },
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (accessId && active === "true") {
|
|
119
|
+
console.log(emit("already_active", "true"));
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!confirm) {
|
|
124
|
+
if (!accessId) {
|
|
125
|
+
const payload = { DeveloperName: serverName, MasterLabel: serverName, Active: true, McpServerId: mcpId };
|
|
126
|
+
console.log(emit("would_create", "false", "POST", `${toolingUrl}/sobjects/McpServerAccess`, payload));
|
|
127
|
+
} else {
|
|
128
|
+
console.log(
|
|
129
|
+
emit("would_activate", "false", "PATCH", `${toolingUrl}/sobjects/McpServerAccess/${accessId}`, { Active: true }),
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function toolingWrite(method, urlPath, data) {
|
|
136
|
+
try {
|
|
137
|
+
sf(["api", "request", "rest", urlPath, "--target-org", targetOrg, "--method", method, "--body", JSON.stringify(data)]);
|
|
138
|
+
} catch {
|
|
139
|
+
fail(`ABORT: authenticated Tooling ${method} failed.`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let did = "";
|
|
144
|
+
if (!accessId) {
|
|
145
|
+
const payload = { DeveloperName: serverName, MasterLabel: serverName, Active: true, McpServerId: mcpId };
|
|
146
|
+
toolingWrite("POST", `${toolingPath}/sobjects/McpServerAccess`, payload);
|
|
147
|
+
readAccess();
|
|
148
|
+
did = "created";
|
|
149
|
+
if (!accessId) {
|
|
150
|
+
fail(`ABORT: no McpServerAccess row exists after the create attempt for '${serverName}'.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (active !== "true") {
|
|
155
|
+
toolingWrite("PATCH", `${toolingPath}/sobjects/McpServerAccess/${accessId}`, { Active: true });
|
|
156
|
+
did = "activated";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
readAccess();
|
|
160
|
+
if (active !== "true") {
|
|
161
|
+
process.stderr.write(`ABORT: wrote access row but Active is still '${active}' — activation failed.\n`);
|
|
162
|
+
process.stderr.write(emit(did, active) + "\n");
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
console.log(emit(did, "true"));
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Read-only progress observations after preflight and target selection.
|
|
3
|
+
// Usage: node check_setup_progress.mjs <org> <server> <eca> [--site <bundle>]
|
|
4
|
+
// Exit 0: audit returned, not setup completion; 2: some reads failed; 1: invalid input.
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { isValidDeveloperName } from "./utils/developer_name.mjs";
|
|
10
|
+
|
|
11
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const checks = [];
|
|
13
|
+
let readFailed = false;
|
|
14
|
+
|
|
15
|
+
function check(area, status, evidence, nextAction) {
|
|
16
|
+
checks.push({ area, status, evidence, nextAction });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function unknown(area, nextAction) {
|
|
20
|
+
readFailed = true;
|
|
21
|
+
check(area, "unknown", "Read failed or returned ambiguous/malformed data.", nextAction);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function sfJson(args) {
|
|
25
|
+
return JSON.parse(execFileSync("sf", args, {
|
|
26
|
+
encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function localFiles(roots, folder, file) {
|
|
31
|
+
return roots.map((root) => path.join(root, folder, file))
|
|
32
|
+
.filter((candidate) => fs.lstatSync(candidate, { throwIfNoEntry: false }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function localPresence(area, files, expectedCount, nextAction, ambiguous = false) {
|
|
36
|
+
try {
|
|
37
|
+
if (files.some((file) => {
|
|
38
|
+
const entry = fs.lstatSync(file);
|
|
39
|
+
return !entry.isFile() || entry.size === 0;
|
|
40
|
+
})) {
|
|
41
|
+
throw new Error("Not a non-empty file");
|
|
42
|
+
}
|
|
43
|
+
const status = ambiguous || files.length > expectedCount ? "unknown" : files.length === expectedCount ? "complete" : "incomplete";
|
|
44
|
+
if (status === "unknown") readFailed = true;
|
|
45
|
+
check(area, status, { files, scope: "File presence only; contents and intent are unverified." }, nextAction);
|
|
46
|
+
} catch {
|
|
47
|
+
unknown(area, nextAction);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function toolingQuery(apiVersion, org, query) {
|
|
52
|
+
const result = sfJson(["api", "request", "rest",
|
|
53
|
+
`/services/data/v${apiVersion}/tooling/query?q=${encodeURIComponent(query)}`,
|
|
54
|
+
"--target-org", org, "--method", "GET"]);
|
|
55
|
+
if (!Array.isArray(result?.records) || result.done !== true ||
|
|
56
|
+
!Number.isInteger(result.totalSize) || result.totalSize !== result.records.length) {
|
|
57
|
+
throw new Error("Incomplete query response");
|
|
58
|
+
}
|
|
59
|
+
return result.records;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function sitePresence(siteBundle) {
|
|
63
|
+
const nextAction = "Phase 1: confirm the selected site's bundle and source readiness; a site is not required for org-level server checks.";
|
|
64
|
+
if (!siteBundle) {
|
|
65
|
+
check("site.local", "unknown", "No site bundle supplied.", nextAction);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const result = JSON.parse(execFileSync(process.execPath, [path.join(scriptDir, "list_sites.mjs")], {
|
|
70
|
+
encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
|
|
71
|
+
}));
|
|
72
|
+
if (!Array.isArray(result?.sites)) throw new Error("Invalid inventory");
|
|
73
|
+
const sites = result.sites.filter((site) => site.bundle === siteBundle);
|
|
74
|
+
if (sites.length > 1) throw new Error("Ambiguous site");
|
|
75
|
+
check("site.local", sites[0]?.status === "ready" ? "complete" : "incomplete",
|
|
76
|
+
{ bundle: siteBundle, status: sites[0]?.status ?? "not-found", scope: "Local source readiness only." }, nextAction);
|
|
77
|
+
} catch {
|
|
78
|
+
unknown("site.local", nextAction);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function ecaProgress(roots, apiVersion, org, ecaName) {
|
|
83
|
+
const components = [
|
|
84
|
+
["ExternalClientApplication", "externalClientApps", ".eca-meta.xml", ""],
|
|
85
|
+
["ExtlClntAppGlobalOauthSettings", "extlClntAppGlobalOauthSets", ".ecaGlblOauth-meta.xml", ""],
|
|
86
|
+
["ExtlClntAppOauthSettings", "extlClntAppOauthSettings", ".ecaOauth-meta.xml", ""],
|
|
87
|
+
["ExtlClntAppOauthConfigurablePolicies", "extlClntAppOauthPolicies", ".ecaOauthPlcy-meta.xml", ""],
|
|
88
|
+
["ExtlClntAppConfigurablePolicies", "extlClntAppPolicies", ".ecaPlcy-meta.xml", "_defaultPolicy"],
|
|
89
|
+
];
|
|
90
|
+
const localAction = "Phase 2: review and reuse compatible files, verifying differently named child ownership before creating components. Complete confirmed partial sets from templates; render only when no destinations exist.";
|
|
91
|
+
try {
|
|
92
|
+
const groups = components.map(([, folder, suffix, nameSuffix]) => localFiles(roots, folder, `${ecaName}${nameSuffix}${suffix}`));
|
|
93
|
+
localPresence("eca.local", groups.flat(), components.length, localAction, groups.some((files) => files.length > 1));
|
|
94
|
+
} catch {
|
|
95
|
+
unknown("eca.local", localAction);
|
|
96
|
+
}
|
|
97
|
+
for (const [type, , , nameSuffix] of components) {
|
|
98
|
+
const name = `${ecaName}${nameSuffix}`;
|
|
99
|
+
const nextAction = type === "ExternalClientApplication"
|
|
100
|
+
? "Phase 5: reuse the verified parent or deploy the approved parent file before its children."
|
|
101
|
+
: "Phases 2/5: verify child ownership and settings before reuse or deployment; preserve the verified parent and deploy only approved tracked child files. Reused apps can have differently named children.";
|
|
102
|
+
try {
|
|
103
|
+
const response = sfJson(["org", "list", "metadata", "--metadata-type", type,
|
|
104
|
+
"--target-org", org, "--api-version", apiVersion, "--json"]);
|
|
105
|
+
if (response.status !== 0 || !Array.isArray(response.result) ||
|
|
106
|
+
!response.result.every((record) => typeof record?.fullName === "string")) {
|
|
107
|
+
throw new Error("Invalid metadata listing");
|
|
108
|
+
}
|
|
109
|
+
const matches = response.result.filter((record) => record.fullName === name);
|
|
110
|
+
if (matches.length > 1) throw new Error("Ambiguous metadata");
|
|
111
|
+
if (!matches.length && (response.result.length >= 1000 ||
|
|
112
|
+
(type !== "ExternalClientApplication" && response.result.length > 0))) {
|
|
113
|
+
readFailed = true;
|
|
114
|
+
check(`eca.deployed.${type}`, "unknown",
|
|
115
|
+
{ fullName: name, listed: false, scope: "Other component names or listing limits prevent inferring absence; association requires verification." }, nextAction);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
check(`eca.deployed.${type}`, matches.length ? "complete" : "incomplete",
|
|
119
|
+
{ fullName: name, present: matches.length === 1, scope: "Bundled component name presence only; ownership and settings are unverified." }, nextAction);
|
|
120
|
+
} catch {
|
|
121
|
+
unknown(`eca.deployed.${type}`, nextAction);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function serverProgress(roots, apiVersion, org, serverName) {
|
|
127
|
+
const localAction = "Phases 3–4: reconcile and reuse existing local metadata, preserving bindings and resources; retrieve an existing deployed server with prior overwrite consent, and render only when no local or deployed definition exists.";
|
|
128
|
+
try {
|
|
129
|
+
localPresence("server.local", localFiles(roots, "mcpServerDefinitions", `${serverName}.mcpServerDefinition-meta.xml`), 1, localAction);
|
|
130
|
+
} catch {
|
|
131
|
+
unknown("server.local", localAction);
|
|
132
|
+
}
|
|
133
|
+
let server;
|
|
134
|
+
try {
|
|
135
|
+
const records = toolingQuery(apiVersion, org,
|
|
136
|
+
`SELECT Id,DeveloperName FROM McpServerDefinition WHERE DeveloperName='${serverName}'`);
|
|
137
|
+
if (records.length > 1 || records.some((record) => record?.DeveloperName !== serverName ||
|
|
138
|
+
!/^[a-zA-Z0-9]{15}(?:[a-zA-Z0-9]{3})?$/.test(record.Id))) throw new Error("Ambiguous server");
|
|
139
|
+
server = records[0];
|
|
140
|
+
check("server.deployed", server ? "complete" : "incomplete", { developerName: serverName, present: !!server },
|
|
141
|
+
"Phases 3–5: reuse compatible local work and deployed bindings; deploy only approved changes if needed.");
|
|
142
|
+
} catch {
|
|
143
|
+
unknown("server.deployed", "Resolve the named server lookup before dependent deployment or activation.");
|
|
144
|
+
}
|
|
145
|
+
if (!server) {
|
|
146
|
+
check("activation", "unknown", "No verified server ID; activation was not queried.", "Resolve server deployment before checking activation.");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const tools = toolingQuery(apiVersion, org,
|
|
151
|
+
`SELECT ToolName,ToolTitle FROM McpServerToolDefinition WHERE McpServerId='${server.Id}'`);
|
|
152
|
+
if (!tools.every((tool) => typeof tool?.ToolName === "string" && tool.ToolName.trim())) throw new Error("Invalid tools");
|
|
153
|
+
check("tools.inventory", "complete", { names: tools.map((tool) => tool.ToolName), scope: "Observed tools only; expected bindings, prompts and resources are unverified." },
|
|
154
|
+
"Phase 4: compare the authoritative definition with prior approved selections, including prompts and field values; an empty tool list can be valid for a prompt-only server.");
|
|
155
|
+
} catch {
|
|
156
|
+
unknown("tools.inventory", "Resolve tool inventory reads before comparing intended bindings.");
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const access = toolingQuery(apiVersion, org, `SELECT Active FROM McpServerAccess WHERE McpServerId='${server.Id}'`);
|
|
160
|
+
if (access.length > 1 || access.some((record) => typeof record?.Active !== "boolean")) throw new Error("Invalid activation");
|
|
161
|
+
const active = access[0]?.Active === true;
|
|
162
|
+
check("activation", active ? "complete" : "incomplete", { active },
|
|
163
|
+
"Phase 7: preview and perform only authorized activation after all backing actions and widget dependencies are verified.");
|
|
164
|
+
} catch {
|
|
165
|
+
unknown("activation", "Resolve the activation read; do not infer active state or retry a write from an error.");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function main() {
|
|
170
|
+
const args = process.argv.slice(2);
|
|
171
|
+
if (args.length !== 3 && !(args.length === 5 && args[3] === "--site")) throw new Error("Invalid arguments.");
|
|
172
|
+
const [org, serverName, ecaName, , siteBundle] = args;
|
|
173
|
+
if (!org.trim() || org.startsWith("-") || !isValidDeveloperName(serverName) || serverName.length > 60 || serverName.length < 2 ||
|
|
174
|
+
!isValidDeveloperName(ecaName) || (siteBundle !== undefined && !siteBundle.trim())) {
|
|
175
|
+
throw new Error("Invalid target org or metadata name.");
|
|
176
|
+
}
|
|
177
|
+
const project = JSON.parse(fs.readFileSync("sfdx-project.json", "utf8"));
|
|
178
|
+
const roots = project.packageDirectories?.map((pkg) => {
|
|
179
|
+
if (typeof pkg.path !== "string" || !pkg.path.trim()) throw new Error("Invalid package path.");
|
|
180
|
+
return path.resolve(pkg.path, "main/default");
|
|
181
|
+
});
|
|
182
|
+
if (!roots?.length || typeof project.sourceApiVersion !== "string") throw new Error("Run preflight from the SFDX project root first.");
|
|
183
|
+
sitePresence(siteBundle);
|
|
184
|
+
ecaProgress(roots, project.sourceApiVersion, org, ecaName);
|
|
185
|
+
serverProgress(roots, project.sourceApiVersion, org, serverName);
|
|
186
|
+
console.log(JSON.stringify({
|
|
187
|
+
scope: { org, serverName, ecaName, siteBundle: siteBundle ?? null },
|
|
188
|
+
auditStatus: readFailed ? "partial" : "completed", setupStatus: "unverified",
|
|
189
|
+
statusMeaning: "Complete applies only to the stated observation, not the whole phase or setup. Exit 0 means the audit ran; preflight remains a prerequisite.",
|
|
190
|
+
checks,
|
|
191
|
+
pendingVerification: [
|
|
192
|
+
{ area: "intent", phase: 1, nextAction: "Recover the confirmed site, ECA/client callbacks, intended tools/prompts/widgets and prior approvals from conversation; ask only for unrecoverable decisions. Metadata does not prove user intent or authorization." },
|
|
193
|
+
{ area: "eca.settings", phase: 2, nextAction: "Run render_eca.mjs <metadata-dir> <eca-name> --check locally; rerun with confirmed Phase 2 inputs plus --check for unverifiedFields. Verify deployed settings and policy review separately; component presence does not prove compatibility." },
|
|
194
|
+
{ area: "bindings", phase: 4, nextAction: "Use references/mcp-objects.md and references/tool-bindings.md to verify all approved bindings and backing actions/templates in the authoritative server; never infer completeness from tool count or local files." },
|
|
195
|
+
{ area: "widgets", phase: 6, nextAction: "Use references/widget-resources.md to verify applicable response/widget/envelope dependencies and deployed links; rerun missing or stale gates. Report no eligible Apex tools explicitly when applicable." },
|
|
196
|
+
{ area: "clientAccess", phase: 7, nextAction: "Remind the admin to check end-user API, Apex/Flow, object, field, record and tool-specific permissions; do not audit or configure them. Verify OAuth protected-resource scopes, client discovery and widget rendering separately; keep client testing pending until confirmed." },
|
|
197
|
+
],
|
|
198
|
+
resumeRules: [
|
|
199
|
+
"Continue from the earliest unmet dependency, reusing verified local and deployed work. Failed reads mean unknown, never absence.",
|
|
200
|
+
"Inspect and preserve local edits before retrieval or writes. Never bypass renderer overwrite protection or replace live bindings with an empty template.",
|
|
201
|
+
"Retain prior explicit approvals only for the same target, files and actions. Use existing phase confirmation rules for uncovered writes.",
|
|
202
|
+
"The explicit Phase 7 preview/activate-only bypass still applies to requests limited to that operation.",
|
|
203
|
+
],
|
|
204
|
+
}, null, 2));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
main();
|
|
209
|
+
} catch {
|
|
210
|
+
console.error("ERROR: invalid arguments or unreadable project configuration. Run preflight first. Usage: check_setup_progress.mjs <org> <server> <eca> [--site <bundle>]");
|
|
211
|
+
process.exitCode = 1;
|
|
212
|
+
}
|