# Upgrading to 0.40.0

This page lists what changed since the previous release; see the [upgrade procedure](README.md).

## @openlup/core

- Register the platform-owned ecommerce-export and checkout-qualification event vocabulary. This adds no executor or handler and activates no provider; the host selects disjoint claim allowlists explicitly.

- Ship the reader guide under `docs/guide/`; start with `docs/guide/README.md`.
- Search the installed reader guide, package `AGENTS.md`, `README.md`, declarations and exports with `openlup-context` and its MCP tools. Upgrade questions also search `CHANGELOG.md`.
- Stop shipping the package-root `AGENT_CONTEXT.md` corpus. Result and JSON output shapes are unchanged; a hit's optional `owner` field is no longer set.

## @openlup/outbox

- Stop shipping `AGENT_CONTEXT.md`. Use core's `openlup-context` and the reader guide shipped in `@openlup/core`.

Skip payload compaction while an owner pins `metadata.retainPayload=true`, retaining unresolved downstream evidence without blocking unrelated terminal pruning. Removing the pin remains the obligation owner's responsibility.

## @openlup/platform

- Add experimental neutral ecommerce-event contracts, retained paid-time source snapshots and explicit PostgreSQL projection through the existing outbox. Paid orders, nonfinancial refund status, checkout qualification and subscription lifecycle facts keep source identities separate from delivery attempts.
- Extend `@openlup/platform/communications/klaviyo` with separately qualified events using the account's existing pacing and cooldown. Provider acceptance remains distinct from ingestion; pending scope, historical import and stale authority refuse before HTTP.
- Ship offline wiring recipes for transactional delivery, marketing refusals and frozen event replay. Local fixtures do not qualify provider accounts or activate any route, job or flow.

Migration: apply the complete packaged migration chain before composing the new projection. Select the fixed live cutoff, account/environment and mapping explicitly; register actual privacy/retention policy and preserve pending duties during recovery. Existing installations do not export events automatically.

Require the complete declared scope set for the opt-in marketing adapter's consent-push capability, including profile write permission. Missing evidence remains verification-pending before provider HTTP. Preserve the existing transport outcome contract and clarify host retry, delivery and adapter-selection responsibilities.

- Stop shipping `AGENT_CONTEXT.md`. Use core's `openlup-context` and the reader guide shipped in `@openlup/core`.

## API changes

### `packages/platform/api/communications-contracts.api.md`

Added declarations:

```ts nocheck
// API report diff: not compiled.
export type EcommerceEvent = Fact<'order.paid', {
export interface EcommerceEventExportRequest {
export type EcommerceEventExportResult = {
export interface EcommerceEventsPort {
export {};
export type * from "./ecommerceEvents.js";
```

### `packages/platform/api/communications-klaviyo.api.md`

Added declarations:

```ts nocheck
// API report diff: not compiled.
export type EcommerceEvent = Fact<'order.paid', {
export interface EcommerceEventExportRequest {
export type EcommerceEventExportResult = {
export interface EcommerceEventsPort {
export {};
```

### `packages/platform/api/communications.api.md`

Added declarations:

```ts nocheck
// API report diff: not compiled.
export type EcommerceEvent = Fact<'order.paid', {
export interface EcommerceEventExportRequest {
export type EcommerceEventExportResult = {
export interface EcommerceEventsPort {
export {};
export declare function createEcommerceEventPrivacyContributor(): PersonalDataContributor<PgQueryExecutor>;
export declare const ECOMMERCE_EXPORT_EVENT_TYPE = "communication.ecommerce.export.v1";
export declare const ecommerceEventSchema: z.ZodType<EcommerceEvent>;
export declare const ecommerceEventExportRequestSchema: z.ZodType<EcommerceEventExportRequest>;
export type * from './contracts/ecommerceEvents.js';
export * from './ecommerceEvents.js';
export * from './postgresEcommerceEvents.js';
export * from './ecommerceEventPrivacy.js';
export interface EcommerceEventTransaction {
export interface EcommerceEventTarget {
export interface PostgresEcommerceEventOptions extends EcommerceEventTransaction {
export declare function createPostgresEcommerceEventProjection(options: PostgresEcommerceEventOptions): {
export declare function createPostgresEcommerceEventHandler(options: EcommerceEventTransaction & {
export declare function reconcilePostgresEcommerceEvent(options: EcommerceEventTransaction & {
```

The report also gained the unchanged `dist/identity/` and `dist/kernel/` declaration files,
341 exported declaration lines, because `createEcommerceEventPrivacyContributor` returns
the identity `PersonalDataContributor` type. `@openlup/platform/communications` exports
none of them, and the identity API report did not change.

### `packages/platform/api/marketing-server.api.md`

Added declarations:

```ts nocheck
// API report diff: not compiled.
export type EcommerceEvent = Fact<'order.paid', {
export interface EcommerceEventExportRequest {
export type EcommerceEventExportResult = {
export interface EcommerceEventsPort {
export {};
export type * from "./ecommerceEvents.js";
```
