@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental 1.107.2 → 1.107.4

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 (39) hide show
  1. package/README.md +12 -85
  2. package/dist/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +30 -6
  3. package/dist/.a4drules/skills/creating-webapp/SKILL.md +20 -0
  4. package/dist/.a4drules/skills/deploying-to-salesforce/SKILL.md +229 -0
  5. package/dist/.a4drules/skills/exploring-graphql-schema/SKILL.md +7 -18
  6. package/dist/.a4drules/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
  7. package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
  8. package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
  9. package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
  10. package/{skills/integrating-agentforce-conversation-client/docs → dist/.a4drules/skills/managing-agentforce-conversation-client/references}/troubleshooting.md +9 -12
  11. package/dist/.a4drules/skills/using-graphql/SKILL.md +2 -1
  12. package/dist/.a4drules/webapp-code-quality.md +5 -2
  13. package/dist/.a4drules/webapp-data-access.md +25 -0
  14. package/dist/.a4drules/webapp-deployment.md +32 -0
  15. package/dist/.a4drules/webapp-react-typescript.md +4 -12
  16. package/dist/.a4drules/webapp-react.md +7 -13
  17. package/dist/AGENT.md +3 -0
  18. package/dist/CHANGELOG.md +19 -0
  19. package/dist/eslint.config.js +7 -0
  20. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/eslint.config.js +2 -0
  21. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/package.json +4 -9
  22. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/src/app.tsx +4 -1
  23. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/src/components/alerts/status-alert.tsx +1 -1
  24. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/tsconfig.json +7 -1
  25. package/dist/package-lock.json +9995 -0
  26. package/dist/package.json +7 -7
  27. package/package.json +2 -2
  28. package/rules/embedded-agent-rule.md +30 -6
  29. package/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
  30. package/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
  31. package/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
  32. package/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
  33. package/{dist/.a4drules/skills/integrating-agentforce-conversation-client/docs → skills/managing-agentforce-conversation-client/references}/troubleshooting.md +9 -12
  34. package/dist/.a4drules/skills/generating-micro-frontend-lwc/SKILL.md +0 -137
  35. package/dist/.a4drules/skills/integrating-agentforce-conversation-client/SKILL.md +0 -92
  36. package/dist/.a4drules/skills/integrating-agentforce-conversation-client/docs/embed-examples.md +0 -116
  37. package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/tsconfig.tsbuildinfo +0 -1
  38. package/skills/integrating-agentforce-conversation-client/SKILL.md +0 -92
  39. package/skills/integrating-agentforce-conversation-client/docs/embed-examples.md +0 -116
package/README.md CHANGED
@@ -106,90 +106,17 @@ Use `headerEnabled` to explicitly show or hide the chat header. It defaults to `
106
106
 
107
107
  #### Available Style Tokens
108
108
 
109
- ##### Agentforce Header
110
-
111
- | Token name | UI area themed |
112
- | ----------------------------- | ------------------------ |
113
- | `headerBlockBackground` | Header background |
114
- | `headerBlockBorderColor` | Header border |
115
- | `headerBlockFontFamily` | Header font family |
116
- | `headerBlockTextColor` | Header text color |
117
- | `headerBlockHoverBackground` | Header hover background |
118
- | `headerBlockActiveBackground` | Header active background |
119
- | `headerBlockFocusBorder` | Header focus border |
120
-
121
- ##### Agentforce Messages
122
-
123
- | Token name | UI area themed |
124
- | -------------------------------- | ---------------------------------- |
125
- | `messageBlockBodyPaddingBottom` | Message block body bottom padding |
126
- | `messageBlockTextPadding` | Message block text padding |
127
- | `messageBlockPaddingContainer` | Message block container padding |
128
- | `messageBlockContainerMarginTop` | Message block container top margin |
129
- | `messageBlockPadding` | Message block padding |
130
- | `messageBlockBorderRadius` | Message block border radius |
131
- | `messageBlockFontSize` | Message block font size |
132
- | `messageBlockLineHeight` | Message block line height |
133
- | `messageBlockBackgroundColor` | Message block background (base) |
134
- | `messageBlockBodyWidth` | Message block body width |
135
-
136
- ##### Inbound message (customer to agent)
137
-
138
- | Token name | UI area themed |
139
- | ----------------------------------------- | -------------------------------- |
140
- | `messageBlockInboundHoverBackgroundColor` | Inbound message hover background |
141
- | `messageBlockInboundBackgroundColor` | Inbound message background |
142
- | `messageBlockInboundTextColor` | Inbound message text color |
143
- | `messageBlockInboundWidth` | Inbound message width |
144
- | `messageBlockInboundTextAlign` | Inbound message text alignment |
145
-
146
- ##### Outbound message (agent to customer)
147
-
148
- | Token name | UI area themed |
149
- | ------------------------------------- | ------------------------------- |
150
- | `messageBlockOutboundBackgroundColor` | Outbound message background |
151
- | `messageBlockOutboundTextColor` | Outbound message text color |
152
- | `messageBlockOutboundWidth` | Outbound message width |
153
- | `messageBlockOutboundMarginLeft` | Outbound message left margin |
154
- | `messageBlockOutboundTextAlign` | Outbound message text alignment |
155
-
156
- ##### Agentforce Input
157
-
158
- | Token name | UI area themed |
159
- | ---------------------------------------- | ---------------------------------------------- |
160
- | `messageInputPadding` | Message input container padding |
161
- | `messageInputBorderRadius` | Message input border radius |
162
- | `messageInputFooterBorderColor` | Message input footer border color |
163
- | `messageInputFooterBorderFocusColor` | Message input footer focus border color |
164
- | `messageInputBorderTransitionDuration` | Message input border transition duration |
165
- | `messageInputBorderTransitionEasing` | Message input border transition easing |
166
- | `messageInputTextColor` | Message input text color |
167
- | `messageInputTextBackgroundColor` | Message input text background color |
168
- | `messageInputFooterPlaceholderText` | Message input placeholder text color |
169
- | `messageInputErrorTextColor` | Message input error text color |
170
- | `messageInputFontSize` | Message input font size |
171
- | `messageInputFontWeight` | Message input font weight |
172
- | `messageInputPlaceholderFontWeight` | Placeholder font weight |
173
- | `messageInputLineHeight` | Message input line height |
174
- | `messageInputMaxHeight` | Message input max height |
175
- | `messageInputTextPadding` | Message input text padding |
176
- | `messageInputActionsWidth` | Message input actions width |
177
- | `messageInputActionsPaddingRight` | Message input actions right padding |
178
- | `messageInputActionsGap` | Message input actions gap |
179
- | `messageInputActionsPadding` | Message input actions padding |
180
- | `messageInputOverflowY` | Message input overflow Y |
181
- | `messageInputScrollbarWidth` | Message input scrollbar width |
182
- | `messageInputScrollbarColor` | Message input scrollbar color |
183
- | `messageInputTextareaMaxHeight` | Message input textarea max height |
184
- | `messageInputTextareaWithImageMaxHeight` | Message input textarea max height (with image) |
185
- | `messageInputFilePreviewPadding` | Message input file preview padding |
186
- | `messageInputActionButtonSize` | Message input action button size |
187
- | `messageInputActionButtonRadius` | Message input action button radius |
188
- | `messageInputActionButtonFocusBorder` | Message input action button focus border |
189
- | `messageInputActionButtonHoverShadow` | Message input action button hover shadow |
190
- | `messageInputFooterSendButton` | Message input send button color |
191
- | `messageInputFooterSendButtonHoverColor` | Message input send button hover color |
192
- | `messageInputSendButtonDisabledColor` | Message input send button disabled color |
109
+ For the complete and always up-to-date list of all 60+ style tokens, see the underlying SDK documentation:
110
+
111
+ **[@salesforce/agentforce-conversation-client README](https://www.npmjs.com/package/@salesforce/agentforce-conversation-client)** or `node_modules/@salesforce/agentforce-conversation-client/README.md` (lines 94-177)
112
+
113
+ Style tokens are organized by UI area:
114
+
115
+ - **Header** (7 tokens): background, text color, hover, active, focus, border, font family
116
+ - **Messages** (10 tokens): colors, padding, margins, border radius, fonts, body width
117
+ - **Inbound messages** (5 tokens): background, text color, width, alignment, hover
118
+ - **Outbound messages** (5 tokens): background, text color, width, alignment, margin
119
+ - **Input** (33 tokens): colors, borders, fonts, padding, buttons, scrollbar, textarea, actions
193
120
 
194
121
  ### Prerequisites
195
122
 
@@ -209,7 +136,7 @@ This component wraps `@salesforce/agentforce-conversation-client`. For lower-lev
209
136
  This package includes coding-agent rules and skills for automated workflows:
210
137
 
211
138
  - **Rule** (`rules/embedded-agent-rule.md`): Conventions for which component to use, authentication, rendering modes, and placement. Copy into `.cursor/rules/` (Cursor) or `.clinerules/` (Cline).
212
- - **Skill** (`skills/integrating-agentforce-conversation-client/`): Step-by-step workflow for embedding the agent — install, add component, configure inline/theming/agent. Copy into `.cursor/skills/` (Cursor) or `.cline/skills/` (Cline).
139
+ - **Skill** (`skills/managing-agentforce-conversation-client/`): Step-by-step workflow for adding, updating, and configuring the agent — install (or detect existing via patches), add component, update existing instances, configure inline/theming/agent. Copy into `.cursor/skills/` (Cursor) or `.cline/skills/` (Cline).
213
140
 
214
141
  ---
215
142
 
@@ -8,11 +8,35 @@ paths:
8
8
 
9
9
  ## DO NOT build a chat UI from scratch
10
10
 
11
- When the user asks for a chat UI, chat widget, chatbot, agent, or conversational interface — **always use the existing `AgentforceConversationClient` component** from `@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental`. Never generate a custom chat implementation, third-party chat library, WebSocket/REST chat, or direct calls to `embedAgentforceClient`.
11
+ When the user asks for a chat UI, chat widget, chatbot, agent, or conversational interface — **always use the existing `AgentforceConversationClient` component**. Never generate custom chat implementations, third-party chat libraries, WebSocket/REST chat, or direct calls to `embedAgentforceClient`.
12
12
 
13
- ## Hard constraints
13
+ ## NEVER edit implementation files
14
14
 
15
- - **`agentId` is required.** The component will not work without it. Always ask the user for their agent ID before generating code. Do not proceed without one.
16
- - **Use the React wrapper only.** Import `AgentforceConversationClient` from the package. Never call `embedAgentforceClient` directly.
17
- - **One instance per window.** Render in the app layout alongside `<Outlet />`, not on individual pages. The component is a singleton.
18
- - **No auth hard-coding.** The component resolves `salesforceOrigin` and `frontdoorUrl` automatically.
15
+ **CRITICAL: Only edit files where AgentforceConversationClient is USED, never the component implementation itself.**
16
+
17
+ **DO NOT edit**: `AgentforceConversationClient.tsx`, `index.tsx`, or any files in:
18
+
19
+ - `node_modules/@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental/`
20
+ - `packages/template/feature/feature-react-agentforce-conversation-client/src/`
21
+ - `src/components/AgentforceConversationClient.tsx` (patched templates)
22
+
23
+ If you're reading a file named `AgentforceConversationClient.tsx`, stop and search for the USAGE instead.
24
+
25
+ ## Invalid Props
26
+
27
+ AgentforceConversationClient does NOT accept:
28
+
29
+ - ❌ `containerStyle` - Use `width`/`height` props directly instead
30
+ - ❌ `style` - Use `styleTokens` prop for theming
31
+ - ❌ `className` - Not supported
32
+
33
+ ## Styling
34
+
35
+ **For ANY styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**
36
+
37
+ NEVER use: CSS files, `<style>` tags, `className`, inline styles, CSS modules, or CSS-in-JS libraries.
38
+
39
+ ## Hard Constraints
40
+
41
+ - **`agentId` is required** - Always ask the user for their agent ID before proceeding
42
+ - **Use the React wrapper only** - Never call `embedAgentforceClient` directly
@@ -5,10 +5,30 @@ paths:
5
5
  - "**/webapplications/**/*"
6
6
  ---
7
7
 
8
+ # First Steps (MUST FOLLOW)
9
+
10
+ **Always run `npm install` before doing anything else** when working in a web app directory (e.g. `force-app/main/default/webapplications/<appName>/` or a dist app path). Dependencies must be installed before running `npm run dev`, `npm run build`, `npm run lint`, or any other script. If `node_modules` is missing or stale, commands will fail.
11
+
8
12
  # Skills-First (MUST FOLLOW)
9
13
 
10
14
  **Before writing any code or running any command**, search for relevant skills (`SKILL.md` files) that cover your task. Read the full skill and follow its instructions. Skills live in `.a4drules/skills/` and `feature/*/skills/`. See **webapp-skills-first.md** for the full protocol and a task-to-skill lookup table.
11
15
 
16
+ # Deployment Order (MUST FOLLOW)
17
+
18
+ **Metadata deployments must complete before fetching GraphQL schema or running codegen.** The schema reflects the current org state; custom objects and fields appear only after metadata is deployed. Running schema fetch or codegen too early produces incomplete or incorrect types.
19
+
20
+ **Invoke the `deploying-to-salesforce` skill** (`.a4drules/skills/deploying-to-salesforce/`) whenever the task involves:
21
+ - Deploying metadata (objects, permission sets, layouts)
22
+ - Fetching GraphQL schema (`npm run graphql:schema`)
23
+ - Running GraphQL codegen (`npm run graphql:codegen`)
24
+ - Generating deploy/setup commands or syncing with the org
25
+
26
+ The skill enforces the correct sequence: **deploy metadata → assign permset → schema fetch → codegen**.
27
+
28
+ **Critical rules:**
29
+ - Do **not** run `npm run graphql:schema` before metadata (objects, permission sets) is deployed — the schema will not include custom objects/fields.
30
+ - Do **not** skip schema refetch after any metadata deployment — re-run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir.
31
+
12
32
  # Web App Generation
13
33
 
14
34
  ## Before `sf webapp generate`
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: deploying-to-salesforce
3
+ description: Enforces the correct order for deploying metadata, assigning permission sets, and fetching GraphQL schema. Use for ANY deployment to a Salesforce org — webapps, LWC, Aura, Apex, metadata, schema fetch, or org sync. Codifies setup-cli.mjs.
4
+ paths:
5
+ - "**/*"
6
+ ---
7
+
8
+ # Deploying to Salesforce
9
+
10
+ Guidance for AI agents deploying metadata to a Salesforce org or syncing with the org. **The order of operations is critical.** This skill codifies the exact sequence from `scripts/setup-cli.mjs` and documents **every Salesforce interaction**.
11
+
12
+ ## When to Use
13
+
14
+ Invoke this skill whenever the task involves:
15
+
16
+ - Deploying metadata (objects, permission sets, layouts, Apex, web applications)
17
+ - Generating deploy commands or setup instructions
18
+ - Fetching the GraphQL schema (`npm run graphql:schema`)
19
+ - Running GraphQL codegen (`npm run graphql:codegen`)
20
+ - Full org setup (login, deploy, permset, data, schema, build)
21
+ - Any manual step that touches the Salesforce org
22
+
23
+ ## Canonical Sequence (from setup-cli.mjs)
24
+
25
+ Execute steps in this **exact order**. Steps marked **(SF)** perform a Salesforce API or CLI interaction.
26
+
27
+ ### Step 1: Login — org authentication
28
+
29
+ | Action | Salesforce interaction? | Command |
30
+ |--------|-------------------------|---------|
31
+ | Check if org is connected | **(SF)** | `sf org display --target-org <alias> --json` |
32
+ | If not connected: authenticate | **(SF)** | `sf org login web --alias <alias>` |
33
+
34
+ - **Run when:** Org is not connected. **Omit when:** Org is already authenticated (check via `sf org display`).
35
+ - All subsequent steps require an authenticated org.
36
+
37
+ ### Step 2: Webapp build — pre-deploy (required for entity deployment)
38
+
39
+ | Action | Salesforce interaction? | Command |
40
+ |--------|-------------------------|---------|
41
+ | Install dependencies | No | `npm install` (in each webapp dir) |
42
+ | Build web app | No | `npm run build` (in each webapp dir) |
43
+
44
+ - Produces `dist/` so `sf project deploy start` can deploy web application entities. Run **before** deploy when deploying web apps.
45
+ - **Run when:** Deploying web apps AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** Not deploying, or `dist/` is current and no source changes.
46
+
47
+ ### Step 3: Deploy metadata
48
+
49
+ | Action | Salesforce interaction? | Command |
50
+ |--------|-------------------------|---------|
51
+ | Deploy metadata | **(SF)** | See below |
52
+
53
+ **Check for a manifest (package.xml) first.** Only use it if present:
54
+
55
+ - **If `manifest/package.xml` (or `package.xml`) exists:** Deploy using the manifest:
56
+ ```bash
57
+ sf project deploy start --manifest manifest/package.xml --target-org <alias>
58
+ ```
59
+ - **If no manifest exists:** Deploy all metadata from the project (packageDirectories in sfdx-project.json):
60
+ ```bash
61
+ sf project deploy start --target-org <alias>
62
+ ```
63
+
64
+ Do not assume a manifest exists. Check the project root and common locations (e.g., `manifest/`, `config/`) before choosing the deploy command.
65
+
66
+ - Deploys objects, layouts, permission sets, Apex classes, web applications, and all other metadata.
67
+ - **Must complete successfully before schema fetch** — the schema reflects org state; custom objects/fields appear only after deployment.
68
+ - **Run when:** Metadata has changed since last deploy, or never deployed. **Omit when:** No metadata changes and deploy has already run successfully.
69
+
70
+ ### Step 4: Post-deployment configuration — assign permissions and configure
71
+
72
+ | Action | Salesforce interaction? | Command |
73
+ |--------|-------------------------|---------|
74
+ | Assign permission set or group | **(SF)** | `sf org assign permset --name <name> --target-org <alias>` (works for both permsets and permset groups) |
75
+ | Assign profile to user | **(SF)** | `sf data update record` or at user creation |
76
+ | Other post-deploy config | **(SF)** | Varies (e.g., named credentials, connected apps, custom settings) |
77
+
78
+ **Example commands:**
79
+
80
+ ```bash
81
+ # Permission set (assigns to default user of target org)
82
+ sf org assign permset --name Property_Management_Access --target-org myorg
83
+
84
+ # Permission set group (same command; pass the group name)
85
+ sf org assign permset --name My_Permset_Group --target-org myorg
86
+
87
+ # Assign to a specific user
88
+ sf org assign permset --name Property_Management_Access --target-org myorg --on-behalf-of user@example.com
89
+
90
+ # Profile — update existing user's profile (requires ProfileId and User Id)
91
+ sf data update record --sobject User --record-id <userId> --values "ProfileId=<profileId>" --target-org myorg
92
+
93
+ # Profile — get ProfileId first
94
+ sf data query --query "SELECT Id, Name FROM Profile WHERE Name='Standard User'" --target-org myorg
95
+ ```
96
+
97
+ - **Deploying does not mean assigning.** Even after permission sets, permission set groups, and profiles are deployed to the org, they must be explicitly assigned or configured for users. Deployment makes them available; assignment/configuration grants access.
98
+ - **Permission sets** — Assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
99
+ - **Permission set groups** — Assign to users when using grouped permission sets.
100
+ - **Profiles** — Ensure users have the correct profile; profile assignment may be done at user creation or via Setup.
101
+ - **Other post-deploy configuration** — Named credentials, connected apps, custom settings, flow activation, and any metadata that requires manual configuration after deploy.
102
+ - All of the above must exist in the org (deployed in Step 3).
103
+ - **Run when:** Any permission set, permission set group, profile, or other post-deploy config was deployed or changed and not yet assigned/configured. **Omit when:** All required assignments and configuration are already in place.
104
+
105
+ **Proactive behavior:** After a successful deploy, discover permission sets in the project (e.g., `force-app/main/default/permissionsets/*.permissionset-meta.xml`) and assign each one. Extract the API name from the filename (e.g., `Property_Management_Access.permissionset-meta.xml` → `Property_Management_Access`). If the user has not explicitly requested a full setup, you may ask: "Do you want me to assign the permission sets to your org?" — but do not skip this step silently; either run it or ask.
106
+
107
+ ### Step 5: Data — prepare and import (optional)
108
+
109
+ | Action | Salesforce interaction? | Command |
110
+ |--------|-------------------------|---------|
111
+ | Prepare unique fields | No | `node scripts/prepare-import-unique-fields.js --data-dir <dataDir>` |
112
+ | Clean existing records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per sobject, reverse plan order) |
113
+ | Import records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per batch) |
114
+
115
+ - Only runs if `data/data-plan.json` and `data/` exist.
116
+ - Delete runs in reverse plan order (children before parents).
117
+ - Import uses Anonymous Apex with `Database.DMLOptions.duplicateRuleHeader.allowSave = true`.
118
+ - **Run when:** Data plan exists AND (never imported OR data files or plan changed). **Omit when:** No data plan, or data already imported and unchanged.
119
+
120
+ **Proactive behavior:** If `data/data-plan.json` and `data/` exist, you MUST ask the user: "Do you want me to import the sample data now? This will prepare unique fields, optionally clean existing records, and import data. Reply yes to proceed." Do not skip this step silently; either run it (after confirmation) or ask. Never import or clean without explicit user confirmation.
121
+
122
+ ### Step 6: GraphQL schema and codegen
123
+
124
+ | Action | Salesforce interaction? | Command |
125
+ |--------|-------------------------|---------|
126
+ | Install webapp deps | No | `npm install` (in webapp dir) |
127
+ | Set default org | **(SF)** | `sf config set target-org <alias> --global` |
128
+ | Fetch schema (introspection) | **(SF)** | `npm run graphql:schema` (from webapp dir) |
129
+ | Generate types | No | `npm run graphql:codegen` (from webapp dir) |
130
+
131
+ - `graphql:schema` performs GraphQL introspection against the org — a **Salesforce API call**.
132
+ - Schema is written to `schema.graphql` at the SFDX project root.
133
+ - Codegen reads the schema file locally; no Salesforce interaction.
134
+ - **Run when:** Schema does not exist, OR metadata was deployed/changed since last schema fetch, OR permissions or post-deploy config was assigned since last schema fetch. **Omit when:** Schema exists and is current relative to org state.
135
+
136
+ ### Step 7: Webapp build (if not done in Step 2)
137
+
138
+ | Action | Salesforce interaction? | Command |
139
+ |--------|-------------------------|---------|
140
+ | Build web app | No | `npm run build` (in webapp dir) |
141
+
142
+ - **Run when:** Build is needed (e.g., for dev server or deploy) AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** `dist/` is current and no build needed.
143
+
144
+ ### Step 8: Dev server (optional)
145
+
146
+ | Action | Salesforce interaction? | Command |
147
+ |--------|-------------------------|---------|
148
+ | Launch dev server | No | `npm run dev` (in webapp dir) |
149
+
150
+ - **Run when:** User requests to launch the dev server. **Omit when:** Not requested.
151
+
152
+ ## Summary: All Salesforce Interactions (in order)
153
+
154
+ 1. `sf org display` — check org connection
155
+ 2. `sf org login web` — authenticate (if needed)
156
+ 3. `sf project deploy start` — deploy metadata
157
+ 4. `sf org assign permset` (permsets and permset groups) / profile assignment / other post-deploy config — assign permissions and configure
158
+ 5. `sf apex run` — delete existing data (if data plan)
159
+ 6. `sf apex run` — import data (if data plan)
160
+ 7. `sf config set target-org` — set default org for schema
161
+ 8. `npm run graphql:schema` — GraphQL introspection (Salesforce API)
162
+
163
+ ## Post-Deploy Checklist (MUST NOT SKIP)
164
+
165
+ After **every successful metadata deploy**, the agent MUST address these before considering the task complete:
166
+
167
+ 1. **Permission sets** — Discover `force-app/main/default/permissionsets/*.permissionset-meta.xml`, extract API names, and assign each via `sf org assign permset --name <name> --target-org <alias>`. If unsure, ask: "Do you want me to assign the permission sets (e.g., Property_Management_Access, Tenant_Maintenance_Access) to your org?"
168
+ 2. **Data import** — If `data/data-plan.json` exists, ask: "Do you want me to import the sample data now? Reply yes to proceed." Do not import without confirmation.
169
+ 3. **Schema refetch** — Run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir (required after deploy).
170
+
171
+ Do not silently skip permission set assignment or data import. Either run them or ask the user.
172
+
173
+ ## Agent Decision Criteria
174
+
175
+ Evaluate each step before running it. Ask:
176
+
177
+ - **Has this step ever run before?** If not, it is likely needed.
178
+ - **Have changes been made that require this step?** (e.g., metadata edits → deploy; deploy → schema refetch)
179
+ - **Is the current state sufficient?** (e.g., org connected, schema exists and is current, permissions and post-deploy config assigned)
180
+
181
+ Do not rely on CLI flags. Decide based on project state and what has changed.
182
+
183
+ ## Evaluation: When Each Step Touches Salesforce
184
+
185
+ | Step | Salesforce interaction | Run when |
186
+ |------|------------------------|----------|
187
+ | 1. Login | Yes | Org not connected |
188
+ | 2. Webapp build | No | Deploying web apps AND dist missing or source changed |
189
+ | 3. Deploy | Yes | Metadata changed or never deployed |
190
+ | 4. Post-deploy config | Yes | Permission sets, permset groups, profiles, or other config deployed/changed and not assigned |
191
+ | 5. Data | Yes | Data plan exists AND (never imported OR data changed) |
192
+ | 6. GraphQL | Yes (schema only) | Schema missing or metadata/permissions changed since last fetch |
193
+ | 7. Webapp build | No | Build needed AND dist missing or source changed |
194
+ | 8. Dev | No | User requests dev server |
195
+
196
+ **Critical rule:** Steps 3 (deploy) and 4 (post-deploy config) must complete **before** step 6 (graphql:schema). The schema reflects the org state; running introspection too early yields an incomplete schema.
197
+
198
+ ## Schema Refetch Rule (CRITICAL)
199
+
200
+ **After any metadata deployment**, you MUST re-run schema fetch and codegen:
201
+
202
+ - New custom objects
203
+ - New custom fields
204
+ - New or updated permission sets
205
+ - Any change to metadata that affects the GraphQL schema
206
+
207
+ ```bash
208
+ # From webapp dir (force-app/main/default/webapplications/<appName>/)
209
+ npm run graphql:schema
210
+ npm run graphql:codegen
211
+ ```
212
+
213
+ Do **not** assume the existing `schema.graphql` is current after metadata changes.
214
+
215
+ ## One-Command Setup (Reference)
216
+
217
+ The project includes `scripts/setup-cli.mjs` which runs this sequence in batch. Use it when the user wants a full setup; otherwise, follow this skill and run only the steps that are needed based on current state.
218
+
219
+ ## Prohibited Actions
220
+
221
+ - **Do not** run `npm run graphql:schema` before metadata is deployed — the schema will not include custom objects/fields
222
+ - **Do not** skip schema refetch after deploying new metadata — types and queries will be out of sync
223
+ - **Do not** assign permissions or configure before deploying — permission sets, permset groups, and profiles must exist in the org first
224
+ - **Do not** run GraphQL introspection before assigning permissions — the user may lack FLS for custom fields
225
+
226
+ ## Related Skills
227
+
228
+ - **exploring-graphql-schema** — Schema exploration (grep-only) after schema exists
229
+ - **using-graphql** — Full GraphQL workflow (explore, query, codegen, lint)
@@ -11,6 +11,13 @@ paths:
11
11
 
12
12
  Guidance for AI agents working with the Salesforce GraphQL API schema. **GREP ONLY** — the schema file is very large (~265,000+ lines). All lookups MUST use grep; do NOT open, read, stream, or parse the file.
13
13
 
14
+ ## Deployment Prerequisites
15
+
16
+ The schema reflects the **current org state**. Custom objects and fields appear only after metadata is deployed.
17
+
18
+ - **Before** running `npm run graphql:schema`: Deploy all metadata (objects, permission sets, layouts) and assign the permission set to the target user. Invoke the `deploying-to-salesforce` skill for the full sequence.
19
+ - **After** any metadata deployment: Re-run `npm run graphql:schema` and `npm run graphql:codegen` so types and queries stay in sync.
20
+
14
21
  ## Schema File Location
15
22
 
16
23
  **Location:** `schema.graphql` at the **SFDX project root** (NOT inside the webapp dir). All grep commands **must be run from the project root** where `schema.graphql` lives.
@@ -93,24 +100,6 @@ Search for `input <ObjectName>CreateInput` or `input <ObjectName>UpdateInput`:
93
100
  grep -nE '^input[[:space:]]+AccountCreateInput\b' ./schema.graphql -A 30
94
101
  ```
95
102
 
96
- ## Common Operator Types
97
-
98
- - **StringOperators**: `eq`, `ne`, `like`, `lt`, `gt`, `lte`, `gte`, `in`, `nin`
99
- - **OrderByClause**: `order: ResultOrder` (ASC/DESC), `nulls: NullOrder` (FIRST/LAST)
100
-
101
- ## Field Value Wrappers
102
-
103
- Salesforce GraphQL returns field values wrapped in typed objects:
104
-
105
- | Wrapper Type | Access Pattern |
106
- | --------------- | ---------------------------------- |
107
- | `StringValue` | `FieldName { value }` |
108
- | `IntValue` | `FieldName { value }` |
109
- | `BooleanValue` | `FieldName { value }` |
110
- | `DateTimeValue` | `FieldName { value displayValue }` |
111
- | `PicklistValue` | `FieldName { value displayValue }` |
112
- | `CurrencyValue` | `FieldName { value displayValue }` |
113
-
114
103
  ## Agent Workflow for Building Queries (grep-only)
115
104
 
116
105
  **Pre-requisites (MANDATORY):**
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: managing-agentforce-conversation-client
3
+ description: Adds or modifies AgentforceConversationClient in React apps (.tsx or .jsx files). Use when user says "add chat widget", "embed agentforce", "add agent", "add chatbot", "integrate conversational AI", or asks to change colors, dimensions, styling, or configure agentId, width, height, inline mode, or styleTokens for travel agent, HR agent, employee agent, or any Salesforce agent chat.
4
+ metadata:
5
+ author: ACC Components
6
+ version: 1.0.0
7
+ package: "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental"
8
+ sdk-package: "@salesforce/agentforce-conversation-client"
9
+ last-updated: 2025-03-18
10
+ ---
11
+
12
+ # Managing Agentforce Conversation Client
13
+
14
+ ## Instructions
15
+
16
+ ### Step 1: Check if component already exists
17
+
18
+ Search for existing usage across all app files (not implementation files):
19
+
20
+ ```bash
21
+ grep -r "AgentforceConversationClient" --include="*.tsx" --include="*.jsx" --exclude-dir=node_modules
22
+ ```
23
+
24
+ **Important:** Look for React files that import and USE the component (for example, shared shells, route components, or feature pages). Do NOT open files named `AgentforceConversationClient.tsx` or `AgentforceConversationClient.jsx` - those are the component implementation.
25
+
26
+ **If found:** Read the file and check the current `agentId` value.
27
+
28
+ **Agent ID validation rule (deterministic):**
29
+
30
+ - Valid only if it matches: `^0Xx[a-zA-Z0-9]{15}$`
31
+ - Meaning: starts with `0Xx` and total length is 18 characters
32
+
33
+ **Decision:**
34
+
35
+ - If `agentId` matches `^0Xx[a-zA-Z0-9]{15}$` and user wants to update other props → Go to Step 4 (update props)
36
+ - If `agentId` is missing, empty, or does NOT match `^0Xx[a-zA-Z0-9]{15}$` → Continue to Step 2 (need real ID)
37
+ - If not found → Continue to Step 2 (add new)
38
+
39
+ ### Step 2: Get agent ID
40
+
41
+ If component doesn't exist or has an invalid placeholder value, ask user for their Salesforce agent ID.
42
+
43
+ Treat these as placeholder/invalid values:
44
+
45
+ - `"0Xx..."`
46
+ - `"Placeholder"`
47
+ - `"YOUR_AGENT_ID"`
48
+ - `"<USER_AGENT_ID_18_CHAR_0Xx...>"`
49
+ - Any value that does not match `^0Xx[a-zA-Z0-9]{15}$`
50
+
51
+ Skip this step if:
52
+
53
+ - Component exists with a real agent ID
54
+ - User only wants to update styling or dimensions
55
+
56
+ ### Step 3: Canonical import strategy
57
+
58
+ Use this import path by default in app code:
59
+
60
+ ```tsx
61
+ import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
62
+ ```
63
+
64
+ If the package is not installed, install it:
65
+
66
+ ```bash
67
+ npm install @salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental
68
+ ```
69
+
70
+ Only use a local relative import (for example, `./components/AgentforceConversationClient`) when the user explicitly asks to use a patched/local component in that app.
71
+
72
+ Do not infer import path from file discovery alone. Prefer one consistent package import across the codebase.
73
+
74
+ ### Step 4: Add or update component
75
+
76
+ **For new installations:**
77
+
78
+ Add to the target React component file using the canonical package import:
79
+
80
+ ```tsx
81
+ import { Outlet } from "react-router";
82
+ import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
83
+
84
+ export default function AgentChatHost() {
85
+ return (
86
+ <>
87
+ <Outlet />
88
+ <AgentforceConversationClient agentId="0Xx..." />
89
+ </>
90
+ );
91
+ }
92
+ ```
93
+
94
+ **Fallback note:** Use a local relative import only when the user explicitly requests patched/local component usage in that app.
95
+
96
+ **For updates:**
97
+
98
+ Read the file where component is used and modify only the props that need to change. Preserve all other props. Never delete and recreate.
99
+
100
+ **Replacing placeholder values:**
101
+
102
+ If the component has a placeholder agentId (e.g., `agentId="Placeholder"` or `agentId="0Xx..."`), replace it with the real agent ID:
103
+
104
+ ```tsx
105
+ // Before (template with placeholder)
106
+ <AgentforceConversationClient agentId="Placeholder" />
107
+
108
+ // After (with real agent ID)
109
+ <AgentforceConversationClient agentId="0Xx8X00000001AbCDE" />
110
+ ```
111
+
112
+ ### Step 5: Configure props
113
+
114
+ **Available props (use directly on component):**
115
+
116
+ - `agentId` (string, required) - Salesforce agent ID
117
+ - `inline` (boolean) - `true` for inline mode, omit for floating
118
+ - `width` (number | string) - e.g., `420` or `"100%"`
119
+ - `height` (number | string) - e.g., `600` or `"80vh"`
120
+ - `headerEnabled` (boolean) - Show/hide header
121
+ - `styleTokens` (object) - For all styling (colors, fonts, spacing)
122
+ - `salesforceOrigin` (string) - Auto-resolved
123
+ - `frontdoorUrl` (string) - Auto-resolved
124
+
125
+ **Examples:**
126
+
127
+ Floating mode (default):
128
+
129
+ ```tsx
130
+ <AgentforceConversationClient agentId="0Xx..." />
131
+ ```
132
+
133
+ Inline mode with dimensions:
134
+
135
+ ```tsx
136
+ <AgentforceConversationClient agentId="0Xx..." inline width="420px" height="600px" />
137
+ ```
138
+
139
+ Styling with styleTokens:
140
+
141
+ ```tsx
142
+ <AgentforceConversationClient
143
+ agentId="0Xx..."
144
+ styleTokens={{
145
+ headerBlockBackground: "#0176d3",
146
+ headerBlockTextColor: "#ffffff",
147
+ messageBlockInboundBackgroundColor: "#4CAF50",
148
+ }}
149
+ />
150
+ ```
151
+
152
+ **For complex patterns,** consult `references/examples.md` for:
153
+
154
+ - Sidebar containers and responsive sizing
155
+ - Dark theme and advanced theming combinations
156
+ - Inline without header, calculated dimensions
157
+ - Complete host component examples
158
+
159
+ **For styling:** For ANY color, font, or spacing changes, use `styleTokens` prop only. See `references/style-tokens.md` for complete token list and examples.
160
+
161
+ **Common mistakes to avoid:** Consult `references/constraints.md` for:
162
+
163
+ - Invalid props (containerStyle, style, className)
164
+ - Invalid styling approaches (CSS files, style tags)
165
+ - What files NOT to edit (implementation files)
166
+
167
+ ## Common Issues
168
+
169
+ If component doesn't appear or authentication fails, see `references/troubleshooting.md` for:
170
+
171
+ - Agent activation and deployment
172
+ - Localhost trusted domains
173
+ - Cookie restriction settings
174
+
175
+ ## Prerequisites
176
+
177
+ Before the component will work, the following Salesforce settings must be configured by the user:
178
+
179
+ **Cookie settings:**
180
+
181
+ - Setup → My Domain → Disable "Require first party use of Salesforce cookies"
182
+
183
+ **Trusted domains (required only for local development):**
184
+
185
+ - Setup → Session Settings → Trusted Domains for Inline Frames → Add your domain
186
+ - Local development: `localhost:<PORT>` (e.g., `localhost:3000`)