@nexalink/carecompass-sdk 0.1.0-beta.2 → 0.1.0-beta.3

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 (2) hide show
  1. package/README.md +275 -2
  2. package/package.json +27 -2
package/README.md CHANGED
@@ -1,3 +1,276 @@
1
- # CareCompass SDK
1
+ # CareCompass Payer Embed SDK
2
2
 
3
- See the repository documentation at `docs/carecompass-sdk.md`.
3
+ `@nexalink/carecompass-sdk` helps payer teams embed a branded CareCompass chat experience in their own websites and applications. It includes a React component, a vanilla JavaScript mount helper, shared configuration validation, and a CLI for setup, validation, snippet generation, and local diagnostics.
4
+
5
+ CareCompass lets a payer offer member-facing navigation support while keeping LLM inference behind Nexalink-hosted APIs. The payer controls the placement, branding, theme, labels, support links, allowed origins, and approved prompt configuration. Nexalink controls account validation, API-key enforcement, embed-key authorization, usage tracking, and the hosted model path.
6
+
7
+ This package is publicly installable for developer convenience, but meaningful use requires a Nexalink payer account and a Nexalink-issued API key.
8
+
9
+ ## Who This Is For
10
+
11
+ This SDK is for enterprise healthcare teams that want to add CareCompass to a payer-owned frontend without building their own model gateway, prompt validation layer, key-management flow, or token-metering pipeline.
12
+
13
+ Typical users include:
14
+
15
+ - payer portal developers embedding CareCompass in a member site
16
+ - implementation engineers configuring staging and production deployments
17
+ - technical operators validating origins, branding, and prompt policy
18
+ - non-technical payer admins issuing SDK keys from the payer portal
19
+
20
+ ## Account Required
21
+
22
+ You need a Nexalink payer account before using the SDK beyond package installation.
23
+
24
+ The account is required because Nexalink validates:
25
+
26
+ - the payer ID
27
+ - the secret SDK API key
28
+ - the public browser embed key
29
+ - the deployment environment
30
+ - the allowed website origins
31
+ - the approved prompt configuration
32
+ - API usage and token counts for future metered billing
33
+
34
+ API keys are issued in the Nexalink payer portal under the CareCompass SDK section. The secret API key is shown once and should be stored locally by the developer. It should never be committed to source control or placed in browser code.
35
+
36
+ If you do not have an API key, run:
37
+
38
+ ```bash
39
+ npx @nexalink/carecompass-sdk login
40
+ ```
41
+
42
+ The CLI will direct you to the payer signup path.
43
+
44
+ ## Install And Run
45
+
46
+ Use any common JavaScript package manager.
47
+
48
+ ```bash
49
+ npx @nexalink/carecompass-sdk login --api-key <nexalink-api-key>
50
+ npm exec @nexalink/carecompass-sdk -- init
51
+ pnpm dlx @nexalink/carecompass-sdk init
52
+ yarn dlx @nexalink/carecompass-sdk init
53
+ bunx @nexalink/carecompass-sdk init
54
+ ```
55
+
56
+ You can also install it in a project:
57
+
58
+ ```bash
59
+ npm install @nexalink/carecompass-sdk
60
+ pnpm add @nexalink/carecompass-sdk
61
+ yarn add @nexalink/carecompass-sdk
62
+ bun add @nexalink/carecompass-sdk
63
+ ```
64
+
65
+ ## CLI Commands
66
+
67
+ ### `carecompass login`
68
+
69
+ Stores your secret Nexalink API key locally so the other SDK commands can validate your payer configuration.
70
+
71
+ ```bash
72
+ carecompass login --api-key <nexalink-api-key>
73
+ ```
74
+
75
+ Credentials are stored at `~/.nexalink/carecompass/credentials.json` by default. You can also set `CARECOMPASS_API_KEY` in your shell or CI environment.
76
+
77
+ ### `carecompass init`
78
+
79
+ Creates a starter `carecompass.config.json` file. This file contains payer-facing configuration only. It does not contain the secret API key.
80
+
81
+ ```bash
82
+ carecompass init --payer-id acme-health --origin https://members.acme-health.com
83
+ ```
84
+
85
+ ### `carecompass validate`
86
+
87
+ Checks that the config shape is valid and that credentials are available.
88
+
89
+ ```bash
90
+ carecompass validate --config carecompass.config.json
91
+ ```
92
+
93
+ ### `carecompass snippet`
94
+
95
+ Generates an HTML embed snippet that can be pasted into a payer-owned page or reviewed by non-technical stakeholders.
96
+
97
+ ```bash
98
+ carecompass snippet --config carecompass.config.json --output carecompass-embed.html
99
+ ```
100
+
101
+ ### `carecompass doctor`
102
+
103
+ Prints a deployment readiness summary for the selected config.
104
+
105
+ ```bash
106
+ carecompass doctor --config carecompass.config.json
107
+ ```
108
+
109
+ ## Configuration
110
+
111
+ `carecompass.config.json` is safe to commit when it only contains public embed configuration. Do not add the secret API key to this file.
112
+
113
+ ```json
114
+ {
115
+ "payerId": "acme-health",
116
+ "environment": "staging",
117
+ "apiBaseUrl": "https://api.nexalink.care",
118
+ "embedKey": "embed_public_key_from_nexalink",
119
+ "allowedOrigins": ["https://members.acme-health.com"],
120
+ "branding": {
121
+ "displayName": "Acme Health",
122
+ "logoUrl": "https://members.acme-health.com/logo.svg",
123
+ "supportUrl": "https://members.acme-health.com/support"
124
+ },
125
+ "theme": {
126
+ "primaryColor": "#2563eb",
127
+ "backgroundColor": "#ffffff",
128
+ "textColor": "#111827",
129
+ "borderRadius": "8px",
130
+ "fontFamily": "system-ui, sans-serif"
131
+ },
132
+ "labels": {
133
+ "title": "Acme Care Guide",
134
+ "placeholder": "Ask about benefits, care options, or next steps...",
135
+ "sendButton": "Send",
136
+ "disclaimer": "CareCompass provides navigation support, not medical advice.",
137
+ "errorMessage": "CareCompass is unavailable right now."
138
+ },
139
+ "prompt": {
140
+ "systemInstruction": "Help members navigate benefits and care options within approved Acme Health support policies.",
141
+ "welcomeMessage": "How can I help you navigate your care today?",
142
+ "allowUserContext": false
143
+ },
144
+ "placement": {
145
+ "mode": "inline"
146
+ },
147
+ "deploymentTarget": "web"
148
+ }
149
+ ```
150
+
151
+ ## React Usage
152
+
153
+ ```tsx
154
+ import { CareCompassEmbed } from "@nexalink/carecompass-sdk";
155
+ import config from "./carecompass.config.json";
156
+
157
+ export function MemberSupport() {
158
+ return <CareCompassEmbed config={config} />;
159
+ }
160
+ ```
161
+
162
+ ## Vanilla JavaScript Usage
163
+
164
+ ```ts
165
+ import { mountCareCompass } from "@nexalink/carecompass-sdk";
166
+ import config from "./carecompass.config.json";
167
+
168
+ mountCareCompass(document.getElementById("carecompass-root"), config);
169
+ ```
170
+
171
+ ## Package Exports
172
+
173
+ ```ts
174
+ import {
175
+ CareCompassEmbed,
176
+ mountCareCompass,
177
+ validateCareCompassConfig,
178
+ createCareCompassClient,
179
+ } from "@nexalink/carecompass-sdk";
180
+
181
+ import type {
182
+ CareCompassConfig,
183
+ CareCompassTheme,
184
+ CareCompassLabels,
185
+ CareCompassPromptConfig,
186
+ } from "@nexalink/carecompass-sdk";
187
+ ```
188
+
189
+ ## Runtime Dependencies
190
+
191
+ The package has a small runtime surface:
192
+
193
+ - `zod` for shared config validation
194
+ - `react` as a peer dependency for the embed component
195
+ - `react-dom` as a peer dependency for mounting
196
+
197
+ Peer dependency range:
198
+
199
+ ```json
200
+ {
201
+ "react": "^18.3.0 || ^19.0.0",
202
+ "react-dom": "^18.3.0 || ^19.0.0"
203
+ }
204
+ ```
205
+
206
+ The CLI requires Node.js 18 or newer.
207
+
208
+ ## What Runs In The Browser
209
+
210
+ The browser receives only public embed configuration:
211
+
212
+ - payer ID
213
+ - environment
214
+ - public `embedKey`
215
+ - branding and theme values
216
+ - labels and support links
217
+ - approved prompt settings
218
+
219
+ The browser does not receive:
220
+
221
+ - the secret SDK API key
222
+ - SageMaker credentials
223
+ - private model endpoint details
224
+ - Nexalink server-side allowlists
225
+
226
+ Chat requests are sent to Nexalink-hosted CareCompass API routes. The component does not call the model endpoint directly.
227
+
228
+ ## API Keys And Usage Tracking
229
+
230
+ SDK API keys are issued in the payer portal and stored server-side as hashes. Each key is associated with a payer, environment, public embed key, and allowed origins.
231
+
232
+ CareCompass usage under a key is tracked so Nexalink can support future Stripe metered billing. The backend records estimated prompt tokens, completion tokens, total tokens, and last-used timestamps per payer/API key.
233
+
234
+ ## Staging And Production
235
+
236
+ Use separate keys and config files for staging and production.
237
+
238
+ ```bash
239
+ carecompass validate --config carecompass.staging.json
240
+ carecompass snippet --config carecompass.staging.json --output staging-embed.html
241
+ carecompass doctor --config carecompass.staging.json
242
+ ```
243
+
244
+ Before production, confirm:
245
+
246
+ - production origin is allowlisted exactly
247
+ - production `embedKey` is separate from staging
248
+ - support links route to the payer's approved support surface
249
+ - prompt instructions are approved by Nexalink and the payer
250
+ - no secret API key appears in generated source code
251
+
252
+ ## Troubleshooting
253
+
254
+ `Missing Nexalink API key`
255
+
256
+ Run `carecompass login --api-key <key>` or set `CARECOMPASS_API_KEY`.
257
+
258
+ `Origin is not authorized`
259
+
260
+ Add the exact website origin to the payer portal SDK configuration.
261
+
262
+ `Prompt configuration violates CareCompass guardrails`
263
+
264
+ Remove unsafe or unsupported instructions and re-run validation.
265
+
266
+ `CareCompass embed client is not authorized`
267
+
268
+ Confirm `payerId`, `embedKey`, `environment`, and allowed origins match the key issued in the payer portal.
269
+
270
+ `CareCompass inference service is not configured`
271
+
272
+ Nexalink server operators should confirm the hosted environment has `CARECOMPASS_LLM_URL` configured.
273
+
274
+ ## License
275
+
276
+ This SDK is proprietary software owned by Nexalink Health, Inc. See the included `LICENSE` file.
package/package.json CHANGED
@@ -1,8 +1,29 @@
1
1
  {
2
2
  "name": "@nexalink/carecompass-sdk",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Embeddable CareCompass SDK and CLI for payer-whitelabeled deployments.",
5
5
  "type": "module",
6
+ "homepage": "https://nexalink.care",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/nexalink-care/nexalink-webapp.git",
10
+ "directory": "packages/carecompass-sdk"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/nexalink-care/nexalink-webapp/issues"
14
+ },
15
+ "keywords": [
16
+ "carecompass",
17
+ "nexalink",
18
+ "payer",
19
+ "healthcare",
20
+ "embed",
21
+ "sdk",
22
+ "react",
23
+ "cli",
24
+ "llm"
25
+ ],
26
+ "sideEffects": false,
6
27
  "bin": {
7
28
  "carecompass": "dist/cli.js"
8
29
  },
@@ -24,8 +45,12 @@
24
45
  },
25
46
  "files": [
26
47
  "dist",
27
- "README.md"
48
+ "README.md",
49
+ "LICENSE"
28
50
  ],
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
29
54
  "scripts": {
30
55
  "build": "tsc -p tsconfig.json"
31
56
  },