@nexalink/carecompass-sdk 0.1.0-beta.8 → 0.2.0-beta.11
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/CHANGELOG.md +37 -0
- package/LICENSE +2 -1
- package/README.md +150 -39
- package/RELEASE.md +65 -0
- package/RUNTIME_SECURITY_AUDIT.md +180 -0
- package/SECURITY_AUDIT.md +78 -0
- package/TELEMETRY.md +129 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +377 -41
- package/dist/client.d.ts +4 -2
- package/dist/client.js +163 -24
- package/dist/component.js +41 -2
- package/dist/credentials.js +4 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -2
- package/dist/mount.js +10 -2
- package/dist/schema.d.ts +3 -1
- package/dist/schema.js +79 -5
- package/dist/snippet.js +22 -4
- package/dist/telemetry.d.ts +71 -0
- package/dist/telemetry.js +180 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.js +3 -0
- package/package.json +37 -9
- package/dist/cli.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/component.js.map +0 -1
- package/dist/credentials.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mount.js.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/snippet.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
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.
|
package/dist/cli.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ type CliIO = {
|
|
|
3
3
|
stdout: Pick<NodeJS.WriteStream, "write">;
|
|
4
4
|
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
5
5
|
env: NodeJS.ProcessEnv;
|
|
6
|
+
stdin?: NodeJS.ReadStream;
|
|
7
|
+
prompt?: (question: string) => Promise<string>;
|
|
6
8
|
};
|
|
7
9
|
export declare function runCareCompassCli(argv?: string[], io?: CliIO): Promise<1 | 0>;
|
|
8
10
|
export {};
|