# @lssm-tech/module.design-studio

Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.4`
- Package path: `packages/platform/ui/design-studio`
- Manifest path: `packages/platform/ui/design-studio/package.json`
- Manifest Git blob: `ef857d9fdfe8b01bf2f57a2b455117f542cc7bb1`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/module.design-studio](https://lssm.co/docs/packages/module.design-studio/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/module.design-studio.txt)

## Package metadata

```json
{
  "layer": "platform",
  "physicalArea": "ui",
  "primaryArea": "ui-and-presentations",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "ui",
    "catalogKind": "module",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Interfaces, presentations and design](https://lssm.co/docs/areas/ui-and-presentations/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/platform/ui/design-studio/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/README.md",
  "blobSha": "5b5724d8b628b9d3e7230bc250d586db5e840fd0",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/module.design-studio

Reusable, spec-first design selection and publishing workflows for ContractSpec
applications.

The core package provides a canonical async `DesignAuthoringStorePort` service
created with `createDesignStudioService({ store, clock, ids, certifier })` and
an `InMemoryDesignAuthoringStore` reference adapter. The original synchronous
service remains available through `createInMemoryDesignStudioService` for
compatibility. Both paths preserve strict
tenant scoping, private user-owned drafts, optimistic revisions, safe patches,
permission-gated certification, immutable publications, unpublication receipts,
and deterministic fallback metadata. Catalog discovery supports industry and
style filters through a contract adapter.

`@lssm-tech/module.design-studio/tenant-authoring` is the managed tenant
authoring profile used behind authenticated HTTP routes:
`TenantDesignAuthoringService({ storeFor, now?, id? })` merges built-in packs
with the tenant's published designs, enforces the tenant selection policy
(fixed, allowed, custom-design switch), keeps private-draft selections in sync,
and runs create/clone/replace/restore/delete with revision CAS, validation and
preview, certification receipts and publish/unpublish. It differs from
`AsyncDesignStudioService` deliberately: patches replace rather than append,
drafts start only from built-in packs, publication requires the exact certified
receipt and keeps the per-draft ref `tenant.<tenant>.design.<draft>@<revision>.0.0`,
and every reset request is audited. Errors are `DesignStudioError` codes with
stable host-facing messages. `InMemoryDesignAuthoringDatabase` gives one
tenant-guarded `InMemoryDesignAuthoringStore` per tenant; the reference store
lists drafts newest first and, like the SQL adapter, fences updates by owner and
returns `false` for a stale delete.

Presentation exports provide matching web and React Native faceted gallery,
picker, structured section controls, editor, diagnostics, responsive preview,
history/diff, and publish controls built from design-system primitives.
Consumers own persistence adapters, routing, and application-specific previews.
The reference API application supplies the production PostgreSQL adapter and
authenticated route composition; the reference web and Expo applications mount
the paired Studio surfaces against the real authenticated lifecycle.

`@lssm-tech/module.design-studio/presentation/design-studio-session` is the
platform-neutral client session shared by those web and Expo hosts:
`useDesignStudioSession({ client, onRefresh })` drives select -> draft -> patch
-> validate -> certify -> publish/unpublish -> restore over an injected
`DesignStudioClient` transport port and calls `onRefresh` after every persisted
change (the saved patch refreshes before validation, so an invalid draft is
still reflected); selecting a pack clears the draft and publication.
`assertDesignValidation` joins patch and certification issues into one error.
Hosts keep the transport adapter and the refresh binding.

## Commands

- `bun run test`
- `bun run typecheck`
- `bun run lint:check`
- `bun run build`


## Declared capabilities

### Module Design Studio

Capability ID: `package.lssm.tech.module.design.studio`

Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.

Use cases:

- Adopt tenant-safe design pack selection, drafting, certification, and reusable studio surfaces

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/module.design-studio package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "design",
    "studio",
    "themes",
    "react",
    "module"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/module.design-studio",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.design-studio/core",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.design-studio/presentation",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.design-studio/tenant-authoring",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "ui",
  "kind": "module",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./core",
    "./presentation",
    "./presentation/design-studio-session",
    "./tenant-authoring"
  ],
  "examples": [],
  "replacements": [],
  "visualTesting": {
    "status": "deferred",
    "owner": "@contractspec-core",
    "targetWave": "wave-3-react-packages",
    "rationale": "Foundational Storybook adoption establishes shared catalogs and guardrails before this package migrates."
  }
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.module.design.studio",
    "from": "@lssm-tech/module.design-studio",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.design.studio",
    "from": "@lssm-tech/module.design-studio/core",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.design.studio",
    "from": "@lssm-tech/module.design-studio/presentation",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.design.studio",
    "from": "@lssm-tech/module.design-studio/tenant-authoring",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/module.design-studio` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/src/index.ts); verified source file.

- `@lssm-tech/module.design-studio/core` — subpath `./core`
  - `unconditional`: `./src/core/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/src/core/index.ts); verified source file.

- `@lssm-tech/module.design-studio/presentation` — subpath `./presentation`
  - `unconditional`: `./src/presentation/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/src/presentation/index.ts); verified source file.

- `@lssm-tech/module.design-studio/presentation/design-studio-session` — subpath `./presentation/design-studio-session`
  - `unconditional`: `./src/presentation/design-studio-session.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/src/presentation/design-studio-session.ts); verified source file.

- `@lssm-tech/module.design-studio/tenant-authoring` — subpath `./tenant-authoring`
  - `unconditional`: `./src/core/tenant-authoring.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/design-studio/src/core/tenant-authoring.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./core": {
      "types": "./dist/core/index.d.ts",
      "browser": "./dist/browser/core/index.js",
      "bun": "./dist/core/index.js",
      "node": "./dist/node/core/index.js",
      "default": "./dist/core/index.js"
    },
    "./presentation": {
      "types": "./dist/presentation/index.d.ts",
      "browser": "./dist/browser/presentation/index.js",
      "bun": "./dist/presentation/index.js",
      "node": "./dist/node/presentation/index.js",
      "default": "./dist/presentation/index.js"
    },
    "./presentation/design-studio-session": {
      "types": "./dist/presentation/design-studio-session.d.ts",
      "browser": "./dist/browser/presentation/design-studio-session.js",
      "bun": "./dist/presentation/design-studio-session.js",
      "node": "./dist/node/presentation/design-studio-session.js",
      "default": "./dist/presentation/design-studio-session.js"
    },
    "./tenant-authoring": {
      "types": "./dist/core/tenant-authoring.d.ts",
      "browser": "./dist/browser/core/tenant-authoring.js",
      "bun": "./dist/core/tenant-authoring.js",
      "node": "./dist/node/core/tenant-authoring.js",
      "default": "./dist/core/tenant-authoring.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-spec-core](https://lssm.co/docs/packages/lib.contracts-spec-core/): `workspace:^`
- [@lssm-tech/lib.crypto-utils](https://lssm.co/docs/packages/lib.crypto-utils/): `workspace:^`
- [@lssm-tech/lib.design-catalog](https://lssm.co/docs/packages/lib.design-catalog/): `workspace:^`
- [@lssm-tech/lib.design-system](https://lssm.co/docs/packages/lib.design-system/): `workspace:^`
- `react`: `catalog:`

### Peer dependencies

- `react`: `catalog:`

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `@types/react`: `catalog:types`
- `@types/react-dom`: `catalog:types`
- `happy-dom`: `catalog:testing`
- `react-dom`: `catalog:`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "clean": "rimraf dist .turbo",
  "lint": "bun lint:fix",
  "lint:fix": "node ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../../scripts/biome.cjs check .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Module Design Studio documentation](https://www.npmjs.com/package/%40lssm-tech%2Fmodule.design-studio) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fmodule.design-studio",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/module.design-studio.txt",
  "route": "/llms/module.design-studio",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/module.design-studio.txt",
  "blobSha": "5b5724d8b628b9d3e7230bc250d586db5e840fd0",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
