@pega/sdk 0.0.13 → 0.0.15

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 (139) hide show
  1. package/README.md +46 -6
  2. package/dist/index.js +50 -24
  3. package/package.json +42 -3
  4. package/templates/angular-sdk-reference/extra-webpack.config.cjs +23 -0
  5. package/templates/angular-sdk-reference/index.html +12 -0
  6. package/templates/angular-sdk-reference/src/app/pconnect-renderer.component.ts +153 -0
  7. package/templates/angular-sdk-reference/src/components/component-map.ts +90 -0
  8. package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +304 -0
  9. package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +89 -0
  10. package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +112 -0
  11. package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +101 -0
  12. package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +118 -0
  13. package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +104 -0
  14. package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +106 -0
  15. package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +104 -0
  16. package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +113 -0
  17. package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +111 -0
  18. package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +110 -0
  19. package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +113 -0
  20. package/templates/angular-sdk-reference/src/components/helpers/sdk-helpers.ts +93 -0
  21. package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts +206 -0
  22. package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +75 -0
  23. package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +126 -0
  24. package/templates/angular-sdk-reference/src/components/infra/flow-container/flow-container.component.ts +411 -0
  25. package/templates/angular-sdk-reference/src/components/infra/reference/reference.component.ts +158 -0
  26. package/templates/angular-sdk-reference/src/components/infra/region/region.component.ts +39 -0
  27. package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +199 -0
  28. package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +89 -0
  29. package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +144 -0
  30. package/templates/angular-sdk-reference/src/components/infra/view-container/view-container.component.ts +191 -0
  31. package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +105 -0
  32. package/templates/angular-sdk-reference/src/components/templates/narrow-wide/narrow-wide.component.ts +37 -0
  33. package/templates/angular-sdk-reference/src/components/templates/one-column/one-column.component.ts +37 -0
  34. package/templates/angular-sdk-reference/src/components/templates/two-column/two-column.component.ts +37 -0
  35. package/templates/angular-sdk-reference/src/components/templates/wide-narrow/wide-narrow.component.ts +37 -0
  36. package/templates/angular-sdk-reference/tsconfig.app.json +13 -0
  37. package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +75 -34
  38. package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +74 -38
  39. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +33 -1
  40. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +57 -22
  41. package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +25 -10
  42. package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +40 -19
  43. package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +62 -1
  44. package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +26 -4
  45. package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +84 -33
  46. package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +46 -26
  47. package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +28 -15
  48. package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +24 -6
  49. package/templates/react-sdk-reference/.ai-common/prompts/generate-infra-components.md +24 -6
  50. package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +24 -6
  51. package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +24 -6
  52. package/templates/react-sdk-reference/.ai-common/prompts/identify-components.md +2 -0
  53. package/templates/react-sdk-reference/.ai-common/prompts/replace-design-system.md +44 -17
  54. package/templates/react-sdk-reference/.ai-common/skills/connect-pega-server.md +14 -1
  55. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AssignmentHeader.md +79 -0
  56. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Toast.md +96 -0
  57. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +56 -35
  58. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +29 -3
  59. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +97 -37
  60. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +91 -60
  61. package/templates/react-sdk-reference/.ai-common/skills/field-components.md +88 -30
  62. package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +133 -101
  63. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedData.md +385 -0
  64. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedDataMulti.md +506 -0
  65. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +549 -86
  66. package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +181 -83
  67. package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +13 -1
  68. package/templates/react-sdk-reference/.ai-common/skills/portal-flow/run-and-verify-portal.md +290 -0
  69. package/templates/react-sdk-reference/.ai-common/skills/template-components.md +13 -1
  70. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +125 -153
  71. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +90 -81
  72. package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +13 -1
  73. package/templates/react-sdk-reference/assets/icons/trash.svg +3 -0
  74. package/templates/react-sdk-reference/index.html +0 -1
  75. package/templates/react-sdk-reference/package.json +2 -2
  76. package/templates/react-sdk-reference/package.minimal.json +2 -2
  77. package/templates/react-sdk-reference/sdk-config.json +3 -3
  78. package/templates/react-sdk-reference/src/FallbackComponent.tsx +1 -1
  79. package/templates/react-sdk-reference/src/MashupApp.tsx +33 -78
  80. package/templates/react-sdk-reference/src/PortalApp.tsx +23 -100
  81. package/templates/react-sdk-reference/src/components/component-map.ts +15 -1
  82. package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/AssignmentHeader.tsx +15 -0
  83. package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/index.tsx +1 -0
  84. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -1
  85. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -1
  86. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +16 -4
  87. package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/ModalDialog.tsx +26 -0
  88. package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/index.tsx +1 -0
  89. package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/Toast.tsx +35 -0
  90. package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/index.tsx +1 -0
  91. package/templates/react-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +362 -24
  92. package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.tsx +1 -1
  93. package/templates/react-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +3 -1
  94. package/templates/react-sdk-reference/src/components/field/Currency/Currency.tsx +6 -3
  95. package/templates/react-sdk-reference/src/components/field/Date/Date.tsx +2 -1
  96. package/templates/react-sdk-reference/src/components/field/DateTime/DateTime.tsx +2 -1
  97. package/templates/react-sdk-reference/src/components/field/Decimal/Decimal.tsx +4 -3
  98. package/templates/react-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +2 -0
  99. package/templates/react-sdk-reference/src/components/field/Email/Email.tsx +2 -1
  100. package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/EmbeddedDataMulti.tsx +121 -0
  101. package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/config-ext.json +7 -0
  102. package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/index.tsx +1 -0
  103. package/templates/react-sdk-reference/src/components/field/Integer/Integer.tsx +2 -1
  104. package/templates/react-sdk-reference/src/components/field/Location/Location.tsx +1 -1
  105. package/templates/react-sdk-reference/src/components/field/Multiselect/Multiselect.tsx +40 -20
  106. package/templates/react-sdk-reference/src/components/field/ObjectReference/ObjectReference.tsx +554 -49
  107. package/templates/react-sdk-reference/src/components/field/ObjectReference/utils.ts +111 -20
  108. package/templates/react-sdk-reference/src/components/field/Percentage/Percentage.tsx +4 -3
  109. package/templates/react-sdk-reference/src/components/field/Phone/Phone.tsx +2 -1
  110. package/templates/react-sdk-reference/src/components/field/SelectableCard/SelectableCard.tsx +2 -1
  111. package/templates/react-sdk-reference/src/components/field/TextArea/TextArea.tsx +2 -1
  112. package/templates/react-sdk-reference/src/components/field/TextInput/TextInput.tsx +2 -1
  113. package/templates/react-sdk-reference/src/components/field/Time/Time.tsx +2 -1
  114. package/templates/react-sdk-reference/src/components/field/URL/URL.tsx +2 -1
  115. package/templates/react-sdk-reference/src/components/field/UserReference/UserReference.tsx +1 -1
  116. package/templates/react-sdk-reference/src/components/helpers/field-utils.ts +44 -0
  117. package/templates/react-sdk-reference/src/components/helpers/simpleTableHelpers.ts +19 -7
  118. package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/DataViewActionButtons.tsx +97 -0
  119. package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/index.tsx +1 -0
  120. package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +53 -0
  121. package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  122. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +2 -2
  123. package/templates/react-sdk-reference/src/components/template/CaseSummary/CaseSummary.tsx +3 -1
  124. package/templates/react-sdk-reference/src/components/template/DataReference/SearchForm.tsx +4 -4
  125. package/templates/react-sdk-reference/src/components/template/HierarchicalForm/HierarchicalForm.tsx +2 -2
  126. package/templates/react-sdk-reference/src/components/template/InlineDashboard/InlineDashboard.tsx +1 -1
  127. package/templates/react-sdk-reference/src/components/template/ListView/ListView.tsx +7 -3
  128. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +173 -99
  129. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +63 -56
  130. package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.tsx +1 -1
  131. package/templates/react-sdk-reference/vite.config.ts +26 -4
  132. package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +0 -47
  133. package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +0 -50
  134. package/templates/react-sdk-reference/.ai-common/instructions/infra-component.md +0 -76
  135. package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +0 -43
  136. package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +0 -45
  137. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +0 -311
  138. package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
  139. package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
@@ -1,311 +0,0 @@
1
- # Skill: Authenticate to Pega
2
-
3
- Establish an authenticated OAuth 2.0 session against the customer's Pega server, persist the resulting token locally, and use it to make DX API calls.
4
-
5
- > **This skill is not part of the embedded flow.** The embedded flow resolves case types, their starting fields, and their components through the Pega MCP server, and the wired application authenticates itself in the browser at runtime — so no design-time token is needed and no workflow invokes this skill. Do not run it as a prerequisite to embedding, and do not let it write configuration that the embedded flow depends on. It remains available for making DX API calls directly.
6
-
7
- ---
8
-
9
- ## Purpose
10
-
11
- The embedded flow needs to know which case type to embed, which components that case requires, and how the customer's Pega environment is configured. All of that lives on the Pega server behind an OAuth-protected DX API.
12
-
13
- This skill collects connection details, writes them to `.pega-auth.json`, and invokes `npx pega-auth` — the headless CLI shipped inside the `@pega/auth` package — to exchange them for an access token, enrich the token with Constellation bootstrap data, and store it for reuse.
14
-
15
- Once complete, the agent can call:
16
-
17
- - `/api/application/v2/casetypes` — to list case types and present a pick-list
18
- - `/api/application/v2/data_views/{D_page}` — to read any data page
19
- - `D_pxBootstrapConfig` — to read Constellation runtime configuration
20
-
21
- ---
22
-
23
- ## Prerequisites
24
-
25
- - A reachable Pega Infinity or Launchpad server
26
- - An **OAuth 2.0 Client Registration** record on that server, configured for the grant type being used
27
- - For the authorization-code grant: a redirect URI registered on that client record, and a browser available on the machine running the flow
28
- - For the client-credentials grant: the client registration must be enabled for client credentials and mapped to an operator with DX API access
29
-
30
- ---
31
-
32
- ## Storage Contract
33
-
34
- Two files at the project root. **Both must be gitignored.**
35
-
36
- | File | Contents | Committed? |
37
- | ------------------ | ------------------------------------------------------------------- | ---------- |
38
- | `.pega-auth.json` | Collected connection details, including `clientSecret` / `password` | ❌ Never |
39
- | `.pega-token.json` | The raw token response, plus `C11NB2S` and `appStaticContentServer` | ❌ Never |
40
- | `sdk-config.json` | Non-secret runtime values only | ✅ Yes |
41
-
42
- ⚠️ **`sdk-config.json` is served publicly at the application's web root.** Anything written into it is retrievable by any visitor. Client secrets and passwords must never be written there.
43
-
44
- `.pega-auth.json` shape:
45
-
46
- ```json
47
- {
48
- "serverType": "infinity",
49
- "server": "https://example.pega.com/prweb",
50
- "grantType": "clientCreds",
51
- "authService": "pega",
52
- "redirectUri": "https://localhost:4010/",
53
- "clientId": "...",
54
- "clientSecret": "...",
55
- "user": "",
56
- "password": "",
57
- "isolationId": "",
58
- "appAlias": "MediaCo"
59
- }
60
- ```
61
-
62
- `.pega-token.json` shape (the token endpoint response, plus two enrichment fields):
63
-
64
- ```json
65
- {
66
- "token_type": "Bearer",
67
- "access_token": "...",
68
- "refresh_token": "...",
69
- "expires_in": 3600,
70
- "obtained_at": 1753833600000,
71
- "C11NB2S": "...",
72
- "appStaticContentServer": "https://..."
73
- }
74
- ```
75
-
76
- ---
77
-
78
- ## Steps
79
-
80
- ### Step 1 — Detect an existing session
81
-
82
- Read `.pega-token.json` if it exists.
83
-
84
- - If it contains an `access_token` and `obtained_at + expires_in * 1000` is still in the future, tell the user which server the session belongs to and ask whether to reuse it. On reuse, **skip to Step 6**.
85
- - If the token is expired and a `refresh_token` is present, attempt a refresh (Step 4c) before falling back to a full re-authentication.
86
- - If no token file exists, continue to Step 2.
87
-
88
- Never print the token value itself — refer to it only by its presence and expiry.
89
-
90
- ### Step 2 — Collect connection details
91
-
92
- Ask for each value below **in this order**. Only ask a question when its condition is met.
93
-
94
- | # | Prompt | Key | Default | Ask when |
95
- | --- | ------------------------------------------------------------------------ | -------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- |
96
- | 1 | Enter Pega server type | `serverType` | `infinity` | Always |
97
- | 2 | Enter Pega server url | `server` | `https://localhost:1080/prweb` | Always |
98
- | 3 | Enter OAuth 2.0 grant type | `grantType` | `authCode` | Always |
99
- | 4 | Enter authentication service alias | `authService` | `pega` | `serverType` is `infinity` **and** `grantType` is `authCode` |
100
- | 5 | Enter valid redirect URI within the OAuth 2.0 client registration record | `redirectUri` | `https://localhost:4010/` | `serverType` is `infinity` **and** `grantType` is `authCode` |
101
- | 6 | Enter user id | `user` | — | `serverType` is `infinity` **and** `grantType` is `passwordCreds` |
102
- | 7 | Enter password | `password` | — | `user` was answered **and** `serverType` is `infinity` **and** `grantType` is `passwordCreds` |
103
- | 8 | Enter clientId | `clientId` | — | Always |
104
- | 9 | Enter clientSecret | `clientSecret` | — | (`serverType` is `infinity` **and** `grantType` is not `authCode`) **or** `serverType` is `launchpad` |
105
-
106
- **Allowed values:**
107
-
108
- | Key | Values |
109
- | ------------ | ----------------------------------------------------------------------------------------------------------- |
110
- | `serverType` | `infinity`, `launchpad` |
111
- | `grantType` | `authCode` (Authorization code), `passwordCreds` (Password credentials), `clientCreds` (Client credentials) |
112
-
113
- `passwordCreds` is **not supported on Launchpad** — omit it from the choices when `serverType` is `launchpad`.
114
-
115
- **Launchpad only:** additionally ask for `isolationId` if the customer's Launchpad tenant requires one.
116
-
117
- **Pre-filling (do not re-ask what is already known):**
118
-
119
- Resolve each value from the first source that has a non-empty entry:
120
-
121
- 1. `.pega-auth.json`
122
- 2. `sdk-config.json` — `serverConfig.infinityRestServerUrl` → `server`, `serverConfig.appAlias` → `appAlias`, `authConfig.authService` → `authService`, `authConfig.mashupClientId` → `clientId`, `authConfig.mashupUserIdentifier` → `user`
123
- 3. The defaults in the table above
124
-
125
- Present the resolved values as a summary and ask the user to **confirm or amend** them, rather than prompting for each one individually. Only fall back to asking question-by-question for values that could not be resolved.
126
-
127
- **Secret handling:** never ask the user to paste a `clientSecret` or `password` into chat if it can be avoided. Prefer reading them from an environment variable (`PEGA_CLIENT_SECRET`, `PEGA_PASSWORD`) or from an existing `.pega-auth.json`. If the user must supply one, tell them to place it in `.pega-auth.json` directly and confirm when done.
128
-
129
- **Normalization:** ensure `server` and `redirectUri` end with a trailing `/` before building any URL from them, then join path segments without duplicating slashes.
130
-
131
- ### Step 3 — Persist the collected configuration
132
-
133
- Write the confirmed values to `.pega-auth.json`. Confirm the file is gitignored (see Step 7) **before** writing any secret into it.
134
-
135
- ### Step 4 — Obtain an access token
136
-
137
- Run the `@pega/auth` headless CLI from the project root:
138
-
139
- ```
140
- npx pega-auth
141
- ```
142
-
143
- The CLI reads `.pega-auth.json`, performs the OAuth token exchange, and writes `.pega-token.json`. It handles all grant types, token refresh, enrichment, and `sdk-config.json` synchronization in a single invocation.
144
-
145
- **What the CLI does internally (for reference — the agent does not need to replicate this):**
146
-
147
- 1. Checks `.pega-token.json` for an unexpired token — reuses if fresh
148
- 2. Attempts `refresh_token` exchange if the token is expired but a refresh token exists
149
- 3. Falls back to full authentication using the `grantType` in `.pega-auth.json`
150
- 4. For `authCode`: opens the system browser for OAuth consent (requires a human to complete)
151
- 5. For `clientCreds` / `passwordCreds`: completes headlessly with no interaction
152
- 6. On success: writes token to `.pega-token.json`, fetches `D_pxBootstrapConfig` (Infinity only), and mirrors non-secret values into `sdk-config.json`
153
-
154
- **Exit codes:**
155
-
156
- | Code | Meaning |
157
- | ---- | -------------------------------------------------------------- |
158
- | `0` | Success — token is fresh and `.pega-token.json` is ready |
159
- | `1` | Invalid config or missing `.pega-auth.json` |
160
- | `2` | Authentication failed (bad credentials, disabled client, etc.) |
161
-
162
- **CLI options (all optional):**
163
-
164
- | Flag | Default | Purpose |
165
- | --------------------- | ------------------ | ------------------------- |
166
- | `--config <path>` | `.pega-auth.json` | Path to auth config file |
167
- | `--token <path>` | `.pega-token.json` | Path to token output file |
168
- | `--sdk-config <path>` | `sdk-config.json` | Path to SDK config file |
169
-
170
- **Environment variable overrides:**
171
-
172
- Secrets can be supplied via environment variables instead of writing them into `.pega-auth.json`:
173
-
174
- | Variable | Overrides |
175
- | -------------------- | -------------- |
176
- | `PEGA_CLIENT_SECRET` | `clientSecret` |
177
- | `PEGA_PASSWORD` | `password` |
178
-
179
- **Interpreting output:**
180
-
181
- All CLI output goes to stderr. On exit code `0`, read `.pega-token.json` to confirm `access_token` is present and proceed to Step 5.
182
-
183
- On a non-zero exit code, read stderr for the specific error and consult the Troubleshooting section.
184
-
185
- **Notes:**
186
-
187
- - The CLI reads secrets from `.pega-auth.json` or env vars — they never appear on the command line or in the process list.
188
- - Local/lab servers with self-signed certificates are handled via `"ignoreInvalidCerts": true` in `.pega-auth.json`.
189
- - The `authCode` grant opens a browser and a local HTTPS listener on the configured `redirectUri`. A human must complete consent in the browser.
190
- - Prefer `clientCreds` for agent-driven workflows — it requires no human interaction.
191
-
192
- ### Step 5 — Verify enrichment
193
-
194
- **Infinity only.** Launchpad has no equivalent step — skip it.
195
-
196
- The CLI (Step 4) automatically fetches `D_pxBootstrapConfig` and writes the enrichment values into `.pega-token.json`. Verify they are present:
197
-
198
- | Field in `.pega-token.json` | Source (fetched by the CLI) | Purpose |
199
- | --------------------------- | --------------------------------------------------- | ------------------------------------- |
200
- | `C11NB2S` | `pyConfigJSON.tokens.C11NB2S` | Constellation browser-to-server token |
201
- | `appStaticContentServer` | `pyConfigJSON.serviceConfig.appStaticContentServer` | Static content CDN URL |
202
-
203
- If these fields are missing (the CLI prints a warning when enrichment fails), the token is still valid for DX API calls but the runtime won't have CDN configuration. The most common cause is a `403` on `D_pxBootstrapConfig` — the operator's access group lacks the Constellation runtime privilege.
204
-
205
- **Verification criterion:** `.pega-token.json` contains both `access_token` and `C11NB2S`.
206
-
207
- ### Step 6 — Verify the session and make DX API calls
208
-
209
- All DX API v2 calls use the same authorization header:
210
-
211
- ```
212
- Authorization: Bearer {access_token}
213
- ```
214
-
215
- When an `appAlias` is configured, address the application-scoped base instead of the default one:
216
-
217
- | Scope | Base URL |
218
- | ------------------- | -------------------------------------------- |
219
- | Default application | `{server}/api/application/v2` |
220
- | Aliased application | `{server}/app/{appAlias}/api/application/v2` |
221
-
222
- Because `server` already includes the context root, the aliased base resolves to e.g. `https://example.pega.com/prweb/app/MediaCo/api/application/v2`. Do not add a second context-root segment.
223
-
224
- These operations belong to the **Constellation DX APIs** service package. To confirm exact paths, parameters, and response schemas for a given Infinity version, open the API explorer on the target server and select that service package.
225
-
226
- **List case types** — this is what allows the case type to be chosen from a list rather than typed:
227
-
228
- ```
229
- GET {base}/casetypes
230
- ```
231
-
232
- This operation takes **no parameters**. The response has the shape:
233
-
234
- | Field | Meaning |
235
- | -------------------------------------- | --------------------------------------------------------------------------------------------------- |
236
- | `applicationIsConstellationCompatible` | Whether the application can run Constellation at all |
237
- | `caseTypes[].ID` | The **fully qualified class name** (e.g. `DIXL-MediaCo-Work-NewService`) — this is the value needed |
238
- | `caseTypes[].name` | Display label to show the user |
239
- | `caseTypes[].links` | Creation affordance — `href`, `rel`, `type`, and a `request_body` describing the create payload |
240
-
241
- ⛔ **Check `applicationIsConstellationCompatible` first.** If it is `false`, stop and tell the user that the target application is not Constellation-compatible and the embedded flow cannot work against it. Do not proceed to analysis, generation, or wiring — the failure would otherwise only surface much later as an unexplained runtime error.
242
-
243
- Present `caseTypes` to the user as a numbered pick-list of `name — ID` pairs and have them choose one. The chosen `ID` is the fully qualified class name. The endpoint already returns only the case types the authenticated operator is permitted to create, so no additional filtering is required.
244
-
245
- `links.request_body` describes the payload accepted when creating a case of that type — use it to determine which starting field values the mashup API call can supply (see Step 4 of the wire-integration skill).
246
-
247
- **Read any data page:**
248
-
249
- | Method | Usage |
250
- | --------------------------------- | ---------------------------------------------------------------------- |
251
- | `GET {base}/data_views/{D_page}` | Parameters passed as query-string values |
252
- | `POST {base}/data_views/{D_page}` | Parameters passed in a `dataViewParameters` object in the request body |
253
-
254
- Use `GET` for parameterless or simply-parameterized pages; use `POST` when the page takes structured parameters or when paging/filtering options are needed.
255
-
256
- **Verification criterion:** the case types request returns HTTP 200 with a parsable JSON body containing at least one entry. A `401` means the token is invalid or expired; a `403` means the token is valid but the operator's access group lacks the required privilege.
257
-
258
- ### Step 7 — Mirror non-secret values into `sdk-config.json`
259
-
260
- The CLI (Step 4) automatically syncs non-secret values into `sdk-config.json`. After the CLI completes, the following fields are set:
261
-
262
- | `sdk-config.json` field | Source |
263
- | ------------------------------------ | ------------- |
264
- | `serverConfig.infinityRestServerUrl` | `server` |
265
- | `serverConfig.appAlias` | `appAlias` |
266
- | `authConfig.authService` | `authService` |
267
- | `authConfig.mashupClientId` | `clientId` |
268
- | `authConfig.portalClientId` | `clientId` |
269
-
270
- The **one field the CLI does not set** is `serverConfig.appMashupCaseType` — that requires the case type chosen in Step 6. After the user picks a case type, write its `ID` into this field.
271
-
272
- ⚠️ **`portalClientId` must be non-empty.** If it is missing, the SDK's authentication initializer classifies the session as custom-auth and returns without ever resolving its readiness promise — producing a silent, permanent hang with no network activity and no error. See Step 2 of the wire-integration skill. The CLI ensures this is always populated.
273
-
274
- The CLI leaves `authConfig.portalClientSecret`, `authConfig.portalGrantType`, and `authConfig.mashupPassword` present but empty. Secrets are never written to this file.
275
-
276
- ---
277
-
278
- ## Security Notes
279
-
280
- - `.pega-auth.json` and `.pega-token.json` hold live credentials. Confirm both are gitignored before writing to them, and re-confirm with `git status --ignored` afterwards.
281
- - Never echo an access token, refresh token, client secret, or password back to the user, into a log, or into a commit message. Refer to them by name only.
282
- - Prefer `clientCreds` over `passwordCreds` — it avoids handling an end-user password entirely.
283
- - Treat relaxed TLS verification as a local-development affordance only. Never suggest it for a production or shared environment.
284
- - If a secret is ever pasted into chat or committed by accident, tell the user to rotate the OAuth client registration record — the value must be considered compromised.
285
-
286
- ---
287
-
288
- ## Troubleshooting
289
-
290
- | Symptom | Cause | Resolution |
291
- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
292
- | `401` with `invalid_client` from the token endpoint | `clientId` / `clientSecret` do not match an OAuth client registration record, or the record is disabled | Verify the values against the client registration record in Dev Studio. Confirm the record is enabled. |
293
- | `401` with `invalid_grant` | The grant type requested is not enabled on the client registration record, or the user credentials are wrong | Enable the grant on the record, or correct `user` / `password`. |
294
- | `unsupported_grant_type` on Launchpad with `passwordCreds` | Launchpad does not support the password grant | Use `authCode` or `clientCreds`. |
295
- | TLS handshake fails / self-signed certificate error | Local or lab server presents an untrusted certificate | Add `"ignoreInvalidCerts": true` to `.pega-auth.json` and re-run `npx pega-auth`. Only use against local/lab servers. |
296
- | `404` on the token endpoint | `server` is missing the `/prweb` context root, or path segments were joined with a doubled or missing slash | Normalize `server` to end with `/` and re-derive the endpoint (see Step 2). |
297
- | Authorization-code flow hangs with no browser activity | `npx pega-auth` opened a browser but consent was not completed, or the redirect URI is not registered | Complete the consent in the browser. Confirm the redirect URI on the client registration record matches `redirectUri` exactly, including its trailing slash. |
298
- | Redirect returns "redirect_uri mismatch" | `redirectUri` differs from the registered value — most often by a missing trailing slash | Make both values byte-identical. |
299
- | `403` on `D_pxBootstrapConfig` | The authenticated operator's access group lacks the privilege to read the bootstrap data page | Authenticate as an operator with an access group that includes the Constellation runtime privileges. |
300
- | `pyConfigJSON` is present but `tokens.C11NB2S` is missing | The response was only parsed once — `pyConfigJSON` is a JSON **string** | Parse `pyConfigJSON` a second time before reading `tokens` (see Step 5). |
301
- | `/casetypes` returns an empty array | The operator has no creatable case types in that application, or `appAlias` targets the wrong application | Confirm `appAlias` matches the target application and that the operator can create cases in it. |
302
- | `applicationIsConstellationCompatible` is `false` | The target application is not enabled for Constellation | Stop. Confirm `appAlias` points at the intended application; if it does, the application must be made Constellation-compatible before an embedded flow is possible. |
303
- | Calls succeed, then start returning `401` | The access token expired | Re-run `npx pega-auth` — it will attempt a refresh automatically, or perform a fresh login. |
304
-
305
- ---
306
-
307
- ## Notes
308
-
309
- - This skill is a prerequisite for case-type resolution. Do not ask the user for a fully qualified case type class before it has completed — the class name should come from `/casetypes`, not from memory.
310
- - The token obtained here is used by the **agent**, for design-time DX API calls. It is unrelated to the token the browser obtains at runtime, which the SDK's auth client negotiates from `sdk-config.json`.
311
- - Re-running this skill is safe. It detects an existing valid session and reuses it rather than forcing a fresh authentication.