@capxul/sdk 1.2.1 → 1.2.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.
package/README.md CHANGED
@@ -19,32 +19,30 @@ const client = created.value;
19
19
  Every public operation resolves a `Promise<CapxulResult<T>>`. Domain failures
20
20
  are values, not thrown exceptions.
21
21
 
22
- ## Engineering telemetry
22
+ ## Observability
23
23
 
24
- Production hosts can opt into sanitized Effect logs and traces through the
25
- public client input:
24
+ Hosts can attach the PostHog client they already initialized through one
25
+ product-and-failure module:
26
26
 
27
27
  ```ts
28
+ import { postHogObservability } from "@capxul/sdk";
29
+
28
30
  const created = await createCapxulClient({
29
31
  publishableKey: "cap_pk_…",
30
- engineeringTelemetry: {
31
- host: "https://us.i.posthog.com",
32
- headers: { Authorization: "Bearer phc_…" },
32
+ observability: postHogObservability(posthog, {
33
33
  capxulEnv: "production",
34
- serviceName: "capxul-sdk",
35
- },
34
+ context: () => ({ correlationId, journeyId, organizationId }),
35
+ }),
36
36
  });
37
37
  ```
38
38
 
39
- Use the browser-safe PostHog project token (`phc_...`), never a personal API
40
- key (`phx_...`) or another secret. The host URL must be a credential-free HTTPS
41
- origin; credentials belong only in the explicit header. The SDK supplies its
42
- runtime producer and version, permits only closed identity classifications and
43
- safe correlation identifiers, and excludes email, OTP, auth/session tokens,
44
- wallet data, request/response bodies, provider messages, raw causes, and
45
- stacks. Export is best-effort and cannot change the operation result. An OTLP
46
- HTTP 200 is not delivery proof: verify a live run by querying both PostHog
47
- `logs` and `posthog.trace_spans` for the same fresh trace.
39
+ The SDK initializes no analytics client and preserves host consent. Product
40
+ events and sanitized failures share one enable/context/delivery policy.
41
+ Engineering logs and traces are separate internally, but applications do not
42
+ configure them: the versioned bootstrap response optionally supplies the
43
+ governed PostHog ingest origin, public project token, and environment. The SDK
44
+ derives endpoints, service, producer, and version. Missing or invalid policy
45
+ disables engineering export without failing client creation.
48
46
 
49
47
  Onboarding uses explicit domain objects. Personal completion accepts
50
48
  `{ profile }`; Organization completion accepts independently validated
@@ -60,7 +58,7 @@ Public Profile reads include the durable `onboarded` flag and optional
60
58
  The packed npm package exposes only:
61
59
 
62
60
  - `@capxul/sdk` — the client factory, public method and value types, signers,
63
- and observation helpers.
61
+ and the host observability helper.
64
62
  - `@capxul/sdk/node` — Node-only signer and runtime helpers.
65
63
  - `@capxul/sdk/testing` — the real identity runtime assembled over
66
64
  deterministic in-memory ports, with OTP, advance-only clock, transition,
@@ -96,8 +94,8 @@ The testing entry is identity-scoped and hermetic. Fine-grained
96
94
  evidence, and update triggers.
97
95
  - [Architecture](./docs/architecture.md) — client assembly, flows, ports,
98
96
  adapters, and proof map.
99
- - [Observation](./docs/observation.md) — host-owned failure observation and
100
- bounded backend linkage.
97
+ - [Observation](./docs/observation.md) — unified host observability,
98
+ bootstrap-owned engineering policy, and bounded backend linkage.
101
99
  - [Public SDK documentation](../../apps/docs/content/docs/sdk/index.mdx) —
102
100
  tutorials, guides, reference, and explanation for npm consumers.
103
101