@nexalink/carecompass-sdk 0.2.0-beta.11 → 0.2.0-beta.13

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/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
- export const CARECOMPASS_SDK_VERSION = "0.2.0-beta.11"; // x-release-please-version
1
+ export const CARECOMPASS_SDK_VERSION = "0.2.0-beta.13"; // x-release-please-version
2
2
  export const CARECOMPASS_COMPONENT_VERSION = "1.0.0";
3
3
  export const CARECOMPASS_TELEMETRY_CONTRACT_VERSION = "1.0.0";
package/package.json CHANGED
@@ -1,17 +1,10 @@
1
1
  {
2
2
  "name": "@nexalink/carecompass-sdk",
3
- "version": "0.2.0-beta.11",
3
+ "version": "0.2.0-beta.13",
4
4
  "description": "Embeddable CareCompass SDK and CLI for healthcare ecosystem integrations with Nexalink onboarding, BAA coverage, and API keys.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.9",
7
7
  "homepage": "https://nexalink.care",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/nexalink-care/carecompass-sdk.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/nexalink-care/carecompass-sdk/issues"
14
- },
15
8
  "keywords": [
16
9
  "carecompass",
17
10
  "nexalink",
@@ -46,13 +39,8 @@
46
39
  "files": [
47
40
  "dist/**/*.js",
48
41
  "dist/**/*.d.ts",
49
- "CHANGELOG.md",
50
42
  "README.md",
51
- "TELEMETRY.md",
52
- "LICENSE",
53
- "RELEASE.md",
54
- "SECURITY_AUDIT.md",
55
- "RUNTIME_SECURITY_AUDIT.md"
43
+ "LICENSE"
56
44
  ],
57
45
  "engines": {
58
46
  "node": ">=18"
package/CHANGELOG.md DELETED
@@ -1,37 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@nexalink/carecompass-sdk` are documented in this file.
4
-
5
- This project uses [release-please](https://github.com/googleapis/release-please) and conventional commits to prepare changelog and version updates.
6
-
7
- ## [0.2.0-beta.11](https://github.com/nexalink-care/carecompass-sdk/compare/v0.1.0-beta.11...v0.2.0-beta.11) (2026-06-07)
8
-
9
-
10
- ### Features
11
-
12
- * baa self-serve ([3ff6d66](https://github.com/nexalink-care/carecompass-sdk/commit/3ff6d662dc83215b85615515eec01c54600fb9ea))
13
- * baa self-serve (CARE-155) ([92c11df](https://github.com/nexalink-care/carecompass-sdk/commit/92c11df5dfc85df195788f5b5aea03112c4c2420))
14
- * cli update ([99ef0e5](https://github.com/nexalink-care/carecompass-sdk/commit/99ef0e52166b519d8982bd67997fae4a0f1a4bb1))
15
- * implement telemetry (CARE-158) ([6337fd7](https://github.com/nexalink-care/carecompass-sdk/commit/6337fd791dc8bbf2192f2b683dbd2d0ef3bbf03a))
16
- * initial commit ([5369c40](https://github.com/nexalink-care/carecompass-sdk/commit/5369c409361be39caaa84db8d3ab1f98f5aec134))
17
- * initial commit ([26ec799](https://github.com/nexalink-care/carecompass-sdk/commit/26ec79928226e98235cd8c42a348a9e070b948c9))
18
- * necessary comments ([127c834](https://github.com/nexalink-care/carecompass-sdk/commit/127c8346bc865c5054b02490c890a53bd03db97a))
19
- * necessary comments ([d7f0d6b](https://github.com/nexalink-care/carecompass-sdk/commit/d7f0d6b7525b9e6282961b8172415e514305bed0))
20
- * security audit ([8115fe2](https://github.com/nexalink-care/carecompass-sdk/commit/8115fe2a75d522f2560ec1ec0f5d9ea1eb1feba4))
21
- * security audit ([0505ae1](https://github.com/nexalink-care/carecompass-sdk/commit/0505ae11937ab15d51b633c782494fe6af468217))
22
- * telemetry ([8f4dff3](https://github.com/nexalink-care/carecompass-sdk/commit/8f4dff3efc80e6e08ad6f0d19b12b7f85688b406))
23
- * telemetry update ([cd15546](https://github.com/nexalink-care/carecompass-sdk/commit/cd15546a756abfa30bf18705d204e9a21d12822f))
24
- * update cli flow ([69c55d5](https://github.com/nexalink-care/carecompass-sdk/commit/69c55d58d55ad64281384254852da468e20214f4))
25
- * updated init flow ([4bd0acf](https://github.com/nexalink-care/carecompass-sdk/commit/4bd0acfd08255b4614fb04b1d5c92b163fb8bcee))
26
-
27
-
28
- ### Bug Fixes
29
-
30
- * whitespace issue ([764c7fc](https://github.com/nexalink-care/carecompass-sdk/commit/764c7fc23de945f4e358c944312c06c3567b0e5e))
31
-
32
- ## [0.1.0-beta.11] - 2026-05-30
33
-
34
- ### Added
35
-
36
- - Initial beta SDK package with React embed, vanilla mount helper, CLI setup flow, config validation, snippet generation, and local diagnostics.
37
- - Supply-chain and runtime security audit documentation for payer deployments.
package/RELEASE.md DELETED
@@ -1,65 +0,0 @@
1
- # CareCompass SDK Release Process
2
-
3
- This package is public, but production use requires Nexalink onboarding, BAA coverage where PHI may be involved, and Nexalink-issued credentials. Treat each package release as a supply-chain event.
4
-
5
- ## Release Authority
6
-
7
- - Only approved Nexalink maintainers may publish `@nexalink/carecompass-sdk`.
8
- - Publish from the canonical GitHub repository: `https://github.com/nexalink-care/carecompass-sdk`.
9
- - Use the pinned package manager in `package.json` and keep `bun.lock` committed.
10
- - Do not publish from a dirty working tree or from a local branch that has not passed review.
11
-
12
- ## Versioning
13
-
14
- - Version and changelog updates are managed by release-please on `main`.
15
- - Use beta versions for pre-production SDKs and avoid reusing a published version.
16
- - Record security-relevant dependency or packaging changes in the release notes.
17
- - Use conventional commit messages so release-please can classify release notes.
18
-
19
- ## Required Validation
20
-
21
- Run the full local release check before publishing:
22
-
23
- ```bash
24
- bun install --frozen-lockfile
25
- bun run release:check
26
- ```
27
-
28
- `release:check` runs lint, tests, build, dependency audit, and a dry-run package assembly. The package dry run uses `bun pm pack --dry-run --ignore-scripts` so package assembly does not execute install lifecycle scripts.
29
-
30
- Before approval, review the dry-run file list and confirm it contains only:
31
-
32
- - `dist/**/*.js`
33
- - `dist/**/*.d.ts`
34
- - `CHANGELOG.md`
35
- - `README.md`
36
- - `TELEMETRY.md`
37
- - `LICENSE`
38
- - `RELEASE.md`
39
- - `SECURITY_AUDIT.md`
40
- - `RUNTIME_SECURITY_AUDIT.md`
41
- - `package.json`
42
-
43
- Do not publish source maps, local credentials, generated payer configs, test fixtures with secret-like values, `.env` files, package-manager caches, or build logs.
44
-
45
- ## Dependency And Lockfile Controls
46
-
47
- - Use `bun install --frozen-lockfile` in CI to verify reproducible installs.
48
- - Run `bun audit` before every release.
49
- - Review `bun outdated` output during routine maintenance and update dev tooling deliberately.
50
- - Do not add install lifecycle scripts unless the security impact is documented and reviewed.
51
- - Do not trust transitive package lifecycle scripts in Bun unless there is a specific approved need.
52
-
53
- ## Provenance, SBOM, And Publishing
54
-
55
- Preferred production publishing should use npm trusted publishing or `npm publish --provenance --access public` from CI after the release check passes. Local publishing is allowed only for emergency releases approved by the package owners.
56
-
57
- Generate an SBOM during CI when the release pipeline supports it, and retain the SBOM, audit output, package dry-run output, and final tarball integrity in release artifacts.
58
-
59
- Release PRs are opened by `.github/workflows/release-please.yml` using the manifest files under `.github/`. Merging the release PR updates `package.json`, `CHANGELOG.md`, and the release manifest, then creates the GitHub release.
60
-
61
- ## Secret Handling
62
-
63
- - Never place Nexalink SDK API keys, payer credentials, SageMaker credentials, AppSync signing roles, or private endpoint URLs in source, docs, tests, generated snippets, package metadata, or release artifacts.
64
- - CLI credentials must stay in the local credentials file or environment variables described in `README.md`.
65
- - Generated browser embed files may include public payer configuration and prompt text. Review generated files before committing them to an integrating application.
@@ -1,180 +0,0 @@
1
- # CARE-153 Runtime, API, And Tenant-Isolation Audit
2
-
3
- Audit date: 2026-05-30
4
-
5
- Scope: SDK-side runtime, embed, CLI validation, generated snippets, browser configuration, prompt configuration, sensitive-data handling, and documentation for payer deployments. Hosted Nexalink API route implementations, backend rate limiting, backend CORS enforcement, backend logs, analytics stores, and SageMaker/AppSync infrastructure are outside this repository and must be validated in the hosted API codebase.
6
-
7
- ## Summary
8
-
9
- The SDK does not ship private SageMaker credentials, AppSync signing roles, privileged backend tokens, or secret Nexalink SDK API keys to the browser. Browser requests use public payer configuration and public embed headers; backend hosted routes remain the authoritative enforcement point for payer identity, embed-key authorization, allowed origins, rate limits, prompt guardrails, logs, analytics, and tenant isolation.
10
-
11
- This audit found and remediated two SDK-side runtime issues:
12
-
13
- - Staging and production configs could previously point `apiBaseUrl` at any HTTPS origin. The schema now requires a Nexalink-hosted HTTPS API URL for staging and production, with localhost allowed only for development.
14
- - Generated embed snippets previously serialized config with plain `JSON.stringify` inside a module script. Config values containing `</script>` could break the script context when served as raw HTML. Snippet generation now escapes script-sensitive JSON characters and iframe attributes.
15
-
16
- ## Auth And API Access Model
17
-
18
- - CLI commands use the secret Nexalink SDK API key from `--api-key`, `CARECOMPASS_API_KEY`, or the local credentials file.
19
- - `init` uses that API key to check BAA status and submit execution metadata to Nexalink-hosted routes. The CLI never receives AWS credentials.
20
- - Browser/runtime code never receives the secret SDK API key.
21
- - Browser requests include:
22
- - `x-carecompass-payer-id`
23
- - `x-carecompass-embed-key`
24
- - `x-carecompass-environment`
25
- - Browser requests target only these SDK paths under the configured Nexalink-hosted API base URL:
26
- - `POST /api/carecompass/embed/config/validate`
27
- - `POST /api/carecompass/embed/ask`
28
- - `GET /api/carecompass/embed/status/:jobId`
29
-
30
- Backend requirements that must remain enforced outside this SDK:
31
-
32
- - payer ID and embed key binding
33
- - environment binding
34
- - exact allowed-origin checks
35
- - tenant isolation for configuration, prompts, requests, responses, logs, analytics, and usage records
36
- - rate limiting and request attribution by payer/deployment
37
-
38
- ## Tenant Isolation Review
39
-
40
- SDK-side controls:
41
-
42
- - The config schema validates payer ID format, embed key format, deployment environment, allowed origins, API base URL, prompt structure, theme values, and public branding fields.
43
- - Staging and production cannot use localhost API base URLs or localhost allowed origins.
44
- - The client sends payer ID, embed key, and environment on every config-validation and inference request.
45
- - The SDK does not expose APIs for reading another payer's configuration, analytics, logs, prompt history, or user data.
46
-
47
- Backend-owned validation:
48
-
49
- - The SDK cannot prove cross-payer isolation by itself because tenant state lives in hosted Nexalink services.
50
- - Hosted routes must reject mismatched payer ID, embed key, environment, and origin tuples.
51
- - Hosted routes must scope job status lookups by payer/deployment, not only by `jobId`.
52
-
53
- ## Allowed Origin And API Base URL Controls
54
-
55
- Resolved in this branch:
56
-
57
- - `apiBaseUrl` must be a Nexalink-hosted HTTPS URL, except localhost for development.
58
- - Staging and production configs reject localhost `apiBaseUrl`.
59
- - Staging and production configs reject localhost allowed origins.
60
- - Browser-hosted pages still fail fast if a non-local page tries to call a localhost API base URL.
61
-
62
- Follow-up for hosted API:
63
-
64
- - Test unauthorized origins against deployed staging and production routes.
65
- - Confirm CORS and origin checks happen server-side and are not based only on SDK validation.
66
-
67
- ## Client-Side Token And Secret Handling
68
-
69
- No client-side secret exposure was found.
70
-
71
- - Secret SDK API keys are read by the CLI only.
72
- - The browser receives public `embedKey`, payer ID, environment, branding, labels, allowed origins, and prompt configuration.
73
- - Credential storage writes local keys with file mode `0600`.
74
- - CLI output prints the credentials path and source, not the API key value.
75
- - Executed BAA copies contain agreement metadata and terms, not the SDK API key
76
- or private cloud credentials. The CLI writes local executed copies with
77
- owner-only (`0600`) permissions.
78
-
79
- ## Prompt Controls And Sensitive Data Handling
80
-
81
- SDK-side controls:
82
-
83
- - Prompt instructions are length-limited and checked for explicit guardrail-bypass patterns.
84
- - Generated setup guidance warns against secrets, raw PHI, diagnosis instructions, treatment instructions, and guardrail bypass attempts in prompt files.
85
- - `allowUserContext` defaults to `false`.
86
-
87
- Backend-owned validation:
88
-
89
- - Hosted routes must re-validate prompt configuration against Nexalink policy because browser config is attacker-controlled.
90
- - Hosted routes must treat user messages, prompt content, model responses, and optional user context as sensitive data.
91
-
92
- ## Embed, XSS, And CSP Review
93
-
94
- Resolved in this branch:
95
-
96
- - Generated config JSON is escaped before insertion into `<script type="module">`.
97
- - Generated iframe `title` and `src` attributes are HTML-attribute escaped.
98
-
99
- Existing controls:
100
-
101
- - React renders labels and messages as text, not raw HTML.
102
- - The component does not use `dangerouslySetInnerHTML`, `innerHTML`, `eval`, or `new Function`.
103
-
104
- Integration guidance:
105
-
106
- - Prefer bundler mode over CDN mode for production.
107
- - If CDN mode is used for a raw browser demo, the integrating page should set CSP `script-src` for the approved CDN and Nexalink assets only.
108
- - Do not place unreviewed payer-provided HTML or third-party scripts in generated embed pages.
109
-
110
- ## Logging, Diagnostics, Telemetry, And Errors
111
-
112
- CARE-158 adds an always-on privacy-safe telemetry transport documented in
113
- `TELEMETRY.md`. The SDK sends only allowlisted anonymous lifecycle metadata to
114
- PostHog's public ingestion API using a Nexalink-owned public ingestion token.
115
- Integrators do not configure telemetry or receive a disable switch. The SDK
116
- does not bundle `posthog-js`, enable session replay or autocapture, identify
117
- users, set cookies, or persist analytics state.
118
-
119
- The CLI sends fixed onboarding funnel events through the same transport. Each
120
- CLI process uses an ephemeral random session ID that is not persisted. CLI
121
- payloads exclude arguments, terminal input, file paths, API keys, and BAA signer
122
- details.
123
-
124
- Telemetry payloads exclude prompts, model responses, chat history, optional
125
- user context, PHI/PII, credentials, raw errors, stack traces, request payloads,
126
- and response bodies. Error telemetry uses fixed codes and categories. Telemetry
127
- delivery failures are swallowed so analytics cannot interrupt SDK workflows.
128
- Runtime errors shown in the component remain derived from local network
129
- failures or backend error responses.
130
-
131
- Backend-owned controls:
132
-
133
- - Hosted routes must avoid logging raw PHI/PII, credentials, raw prompts, raw model responses, or privileged backend tokens unless an explicitly approved secure diagnostic path exists.
134
- - Backend error responses should be sanitized because the component may display the error message.
135
-
136
- ## Rate Limiting And Abuse Prevention
137
-
138
- The SDK can attribute requests by payer ID, embed key, and environment headers, but cannot enforce real rate limits or abuse controls because browser clients are untrusted.
139
-
140
- Hosted routes must enforce:
141
-
142
- - per-payer and per-origin rate limits
143
- - per-embed-key request attribution
144
- - abuse detection for prompt flooding and job-status polling
145
- - safe status lookup scoping by payer/deployment
146
-
147
- ## Verification
148
-
149
- Commands run:
150
-
151
- | Command | Result |
152
- | ----------------------- | ------------------------------------------------------------------------------------------- |
153
- | `bun run test` | Validates schema hardening, snippet escaping, CLI behavior, and component runtime requests. |
154
- | `bun run lint` | Ensures code quality after remediation. |
155
- | `bun run build` | Regenerates distributable JavaScript and declarations. |
156
- | `bun run release:check` | Runs frozen install, lint, tests, build, audit, and package dry run. |
157
-
158
- New regression coverage:
159
-
160
- - Reject non-Nexalink `apiBaseUrl` values.
161
- - Allow localhost API/origin/support URLs only for development.
162
- - Reject unsafe branding URL schemes.
163
- - Escape `</script>`-style values in generated embed config JSON.
164
- - Escape iframe attributes.
165
-
166
- ## Findings And Follow-Up
167
-
168
- Resolved:
169
-
170
- - Medium: staging/production `apiBaseUrl` allowed arbitrary HTTPS endpoints. Owner: SDK. Remediation: require Nexalink-hosted HTTPS API URLs outside development.
171
- - Medium: generated script snippets did not escape script-sensitive JSON characters. Owner: SDK. Remediation: escape `<`, `>`, `&`, U+2028, and U+2029 in serialized config JSON.
172
-
173
- No high or critical SDK-side runtime findings remain in this repository.
174
-
175
- Follow-up required outside this SDK repository:
176
-
177
- - Validate deployed hosted API CORS/origin enforcement with unauthorized origins.
178
- - Validate cross-payer tenant isolation for config, prompt, analytics, logs, job status, and model request data in the hosted API codebase.
179
- - Validate backend log/telemetry redaction for raw prompts, model responses, credentials, PHI/PII, and privileged tokens.
180
- - Validate backend rate limiting and request attribution by payer, environment, origin, and embed key.
package/SECURITY_AUDIT.md DELETED
@@ -1,78 +0,0 @@
1
- # CARE-152 Dependency And Supply-Chain Audit
2
-
3
- Audit date: 2026-05-30
4
-
5
- Scope: `@nexalink/carecompass-sdk` source, package metadata, Bun lockfile, generated `dist` artifacts, README guidance, local package assembly, and release-process documentation.
6
-
7
- ## Summary
8
-
9
- No high or critical dependency vulnerabilities were found by the available package-manager audit. No hardcoded Nexalink API key, payer credential, SageMaker credential, AppSync signing role, private model endpoint, AWS access key, or private endpoint URL was found in the package source or generated distributable files.
10
-
11
- The audit found supply-chain process gaps rather than an active secret exposure: release provenance and SBOM expectations were not previously documented, the package manager was not pinned in `package.json`, and the package dry-run script delegated to `bunx --bun npm pack`. These have been remediated in this branch with pinned package-manager metadata, a safer dry-run pack script, explicit release documentation, and exclusion of source maps from the published package surface.
12
-
13
- ## Commands Run
14
-
15
- | Command | Result |
16
- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
17
- | `bun audit` | Passed. No vulnerabilities found. |
18
- | `npm audit --audit-level=high` | Not applicable because this repository uses `bun.lock` and has no `package-lock.json`. |
19
- | `bun outdated` | Runtime dependency `zod` current. Dev-tooling major updates available for `@eslint/js`, `eslint`, `@types/node`, `globals`, and `typescript`. |
20
- | `bun run build` | Passed after refreshing local Bun install links. |
21
- | `bun run lint` | Passed. |
22
- | `bun run test` | Passed: 3 suites, 17 tests. |
23
- | `bun pm pack --dry-run --ignore-scripts` | Passed and confirmed the intended package contents. |
24
-
25
- ## Dependency Review
26
-
27
- Runtime dependency:
28
-
29
- - `zod` `^4.4.3`
30
-
31
- Peer dependencies:
32
-
33
- - `react` `^18.3.0 || ^19.0.0`
34
- - `react-dom` `^18.3.0 || ^19.0.0`
35
-
36
- Development dependencies are limited to the React, Jest, ESLint, Prettier, TypeScript, and type-definition toolchain. The dependencies are mainstream packages, and the runtime package surface is small.
37
-
38
- `bun.lock` pins concrete transitive versions and integrity hashes for Bun installs. Non-Bun package managers are supported for consumers, but repository development and release validation are intentionally pinned to Bun with `bun install --frozen-lockfile`.
39
-
40
- ## Package Script Review
41
-
42
- No `preinstall`, `install`, `postinstall`, `prepare`, `prepublish`, `publish`, or `postpublish` lifecycle scripts are declared by the root package.
43
-
44
- Package assembly now uses:
45
-
46
- ```bash
47
- bun pm pack --dry-run --ignore-scripts
48
- ```
49
-
50
- This avoids fetching or executing an external pack command through `bunx` and prevents lifecycle scripts during the dry run.
51
-
52
- ## Generated Artifact Review
53
-
54
- The package publishes only `dist/**/*.js`, `dist/**/*.d.ts`, `README.md`, `LICENSE`, `RELEASE.md`, `SECURITY_AUDIT.md`, `RUNTIME_SECURITY_AUDIT.md`, and `package.json`.
55
-
56
- Source maps were removed from the published package surface. They did not contain embedded `sourcesContent`, but excluding them reduces accidental source-path and metadata disclosure in the public npm package.
57
-
58
- Searches for secret-like terms found only documented placeholders, public configuration examples, local credential handling code, and expected hosted API URLs. Credential writes use file mode `0600`, and CLI output does not print the secret API key.
59
-
60
- ## Release-Process Risks And Remediation
61
-
62
- Resolved in this branch:
63
-
64
- - Added `packageManager` to pin Bun for development and release validation.
65
- - Added repository and issue metadata to `package.json`.
66
- - Added npm registry to `publishConfig`.
67
- - Added `audit` and `release:check` scripts.
68
- - Replaced `pack:dry-run` with a Bun-native dry run that ignores scripts.
69
- - Added `RELEASE.md` with versioning, validation, provenance, SBOM, and secret-handling expectations.
70
- - Excluded source maps from the package surface.
71
-
72
- Follow-up recommendations:
73
-
74
- - Add CI that runs `bun install --frozen-lockfile`, `bun run release:check`, and stores audit and package dry-run output as artifacts.
75
- - Publish through npm trusted publishing or `npm publish --provenance --access public`.
76
- - Generate and retain an SBOM for each production release.
77
- - Review major dev-tooling updates reported by `bun outdated` on a maintenance cadence.
78
- - Keep runtime dependency additions rare and require security review for any package with install lifecycle scripts or native binary behavior.
package/TELEMETRY.md DELETED
@@ -1,129 +0,0 @@
1
- # CareCompass SDK Telemetry Contract
2
-
3
- Contract version: `1.0.0`
4
-
5
- CareCompass SDK telemetry measures deployment health without collecting PHI,
6
- PII, chat content, or credentials. The web SDK sends allowlisted anonymous
7
- events directly to PostHog's public ingestion API. The CLI uses the same narrow
8
- transport for onboarding funnel events. React Native and Flutter SDKs should
9
- adopt the same event names and property contract.
10
-
11
- ## Configuration
12
-
13
- Telemetry is enabled automatically for every web SDK deployment. Integrators do
14
- not need to run an additional CLI command, add a runtime config block, or manage
15
- a PostHog token.
16
-
17
- The web SDK sends events to Nexalink's PostHog project through the public US
18
- ingestion endpoint. It uses a Nexalink-owned public PostHog project token
19
- compiled into the SDK. The token permits event ingestion only; it is never a
20
- PostHog personal or admin API key.
21
-
22
- The anonymous deployment ID is derived from the public payer ID, environment,
23
- and web platform. For example, payer `acme-health` in staging is reported as
24
- `acme-health-staging-web`.
25
-
26
- CLI invocations use an ephemeral random `cli_session_id` as their anonymous
27
- PostHog `distinct_id`. It is created in memory for one process invocation and is
28
- not persisted. Before the CLI has public payer context, events use
29
- `anonymous-unknown-cli`; later events use the public payer ID and environment.
30
-
31
- ## Event Taxonomy
32
-
33
- Initialization and configuration:
34
-
35
- - `carecompass_sdk_initialized`
36
- - `carecompass_sdk_initialization_failed`
37
- - `carecompass_sdk_configuration_validated`
38
- - `carecompass_sdk_configuration_failed`
39
-
40
- Component lifecycle:
41
-
42
- - `carecompass_component_rendered`
43
- - `carecompass_component_opened`
44
- - `carecompass_component_closed`
45
- - `carecompass_component_error`
46
-
47
- Inference lifecycle:
48
-
49
- - `carecompass_prompt_submitted`
50
- - `carecompass_inference_succeeded`
51
- - `carecompass_inference_failed`
52
- - `carecompass_inference_rate_limited`
53
-
54
- Customization and deployment health:
55
-
56
- - `carecompass_theme_loaded`
57
- - `carecompass_prompt_configuration_loaded`
58
- - `carecompass_prompt_configuration_failed`
59
-
60
- CLI onboarding:
61
-
62
- - `carecompass_cli_started`
63
- - `carecompass_cli_login_started`
64
- - `carecompass_cli_login_succeeded`
65
- - `carecompass_cli_login_failed`
66
- - `carecompass_cli_init_started`
67
- - `carecompass_cli_init_failed`
68
- - `carecompass_cli_setup_kit_generated`
69
- - `carecompass_cli_validation_succeeded`
70
- - `carecompass_cli_validation_failed`
71
- - `carecompass_cli_snippet_generated`
72
- - `carecompass_cli_doctor_completed`
73
- - `carecompass_cli_command_failed`
74
-
75
- For the always-visible web embed, opened and closed map to mount and unmount.
76
- Future mobile components should map these events to their equivalent visible
77
- screen lifecycle.
78
-
79
- ## Allowed Properties
80
-
81
- Events contain only:
82
-
83
- - `contract_version`
84
- - `sdk_version`
85
- - `component_version`
86
- - `platform`
87
- - `environment`
88
- - `payer_id`
89
- - `deployment_id`
90
- - `event_timestamp`
91
- - `duration_bucket`, when applicable
92
- - `failure_category`, when applicable
93
- - `error_code`, when applicable
94
- - `cli_session_id`, for CLI events only
95
- - `$process_person_profile: false`
96
-
97
- The transport also sends the public PostHog project token, event name, anonymous
98
- `distinct_id`, and timestamp required by the PostHog ingestion API. Web events
99
- use the deployment ID as `distinct_id`; CLI events use the ephemeral
100
- `cli_session_id`. It does not identify individual users or create person
101
- profiles.
102
-
103
- ## Prohibited Data
104
-
105
- Never send:
106
-
107
- - raw user prompts, model responses, chat history, or optional user context
108
- - PHI, PII, member IDs, policy IDs, names, emails, or phone numbers
109
- - API keys, access tokens, cookies, credentials, or session secrets
110
- - CLI arguments, terminal input, or file paths
111
- - SageMaker credentials, internal infrastructure details, or privileged tokens
112
- - raw error objects, stack traces, request payloads, or response bodies
113
- - payer prompt text; use an approved non-sensitive configuration ID in a future
114
- contract version if needed
115
-
116
- The web SDK intentionally does not bundle `posthog-js`. It does not enable
117
- session replay, autocapture, DOM capture, form capture, cookies, persistence,
118
- surveys, feature flags, or user identification.
119
-
120
- Package download counts remain registry-owned metrics. CLI telemetry begins when
121
- the user invokes the installed package.
122
-
123
- ## Verification
124
-
125
- 1. Mount a development component, submit a non-PHI prompt, and complete an
126
- inference.
127
- 2. Confirm the expected lifecycle events arrive in Nexalink's PostHog project.
128
- 3. Inspect event payloads and verify they contain only the allowlisted
129
- properties above.