> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manthan.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# shared

> @parmana/shared — canonical domain model, repository contracts, and errors

`@parmana/shared` has no internal dependencies — every other package depends on it. Its public surface (`packages/shared/src/index.ts`) exports four things: `./domain/index.js`, `./repositories/index.js`, `./config/index.js`, `./errors/index.js`, plus a few standalone types and `normalizePolicy`.

## Domain model

`packages/shared/src/domain/` is the canonical, interface-based model — `Authority`, `Authorization`, `Intent`, `BusinessTransaction`, `PolicyReference`, `Decision`, `Execution`, `Verification`, `Receipt`, `Override`, `ExecutionTrustRecord`, plus enums like `AuthorityType` and `BusinessTransactionStatus`. This is the model both SDKs mirror — see [TypeScript SDK → Models](/docs/typescript-sdk/models) and [Python SDK → APIs & Models](/docs/python-sdk/apis-and-models) — and the one every [Concepts](/docs/concepts/overview) page describes.

<Warning>
  `packages/shared/src/` also contains several parallel, older implementations of the same concepts that are **not** part of the package's public export surface: class-based `Authority`, `Authorization`, `Intent`, `Execution`, `Evidence`, `Verification` under top-level folders (`authority/`, `authorization/`, `intent/`, `execution/`, `evidence/`, `verification/`), plus empty stub files (`Authority.ts`, `Authorization.ts`, `Intent.ts`, `Execution.ts`, `Evidence.ts`, `Verification.ts`) at the package root. None of these are re-exported from `index.ts`. For example, the class-based `Authorization` (`authorization/Authorization.ts`) models a PERMIT/DENY `decision` with a `policyId`, which is an entirely different shape from the canonical `domain/authorization.ts` interface (`authorizationId`, `authorityId`, `purpose`, `issuedAt`). If you're reading source in this package, confirm which folder you're in — `domain/` is the one that matters.
</Warning>

## Repository contracts

`packages/shared/src/repositories/`:

```ts theme={null}
interface BusinessTransactionRepository { /* accept, get, list */ }
interface ExecutionTrustRecordRepository { /* findByTransactionId, appendVerification, appendReceipt, ... */ }
interface PolicyRepository { /* load */ }
```

These are the interfaces [`storage`](/docs/packages/storage) implements and [`runtime`](/docs/packages/runtime) depends on — `runtime` never imports a concrete repository class directly.

## Errors

`packages/shared/src/errors/` defines a base `ParmanaError` plus specific errors like `ValidationError`, `BusinessTransactionNotFoundError`, `PolicyNotFoundError`, `VerificationFailedError`, `ReceiptGenerationError`, `UnauthorizedError`, `ForbiddenError`, `ConflictError`, `OverrideNotAllowedError`, `DecisionNotApprovedError`, and others. `packages/runtime/src/errors/` layers a small number of runtime-specific errors (like `VerificationFailedError`, `ReceiptGenerationError`) on top of these.

<Note>
  This `ParmanaError` is unrelated to the TypeScript SDK's own `ParmanaError` (`typescript/src/errors/ParmanaError.ts`) — same name, two independent classes in two different packages, one server-side and one client-side. Don't assume `instanceof` checks cross the boundary.
</Note>

## Configuration

`packages/shared/src/config/` defines `Config`, `ConfigLoader`, and validation/parsing utilities, along with enumerated `CryptoAlgorithms`, `KeyProviders`, `StorageProviders`, and `TrustProfiles` — the vocabulary other packages (`crypto`, `storage`) use for their own configuration.

## Related

<CardGroup cols={2}>
  <Card title="Package Architecture" href="/docs/architecture/package-architecture">Where `shared` sits in the dependency graph.</Card>
  <Card title="Business Transaction" href="/docs/concepts/business-transaction">The concept this package's central type models.</Card>
  <Card title="Error Model" href="/docs/api/error-model">How these errors surface over HTTP.</Card>
  <Card title="storage" href="/docs/packages/storage">Implements `shared`'s repository contracts.</Card>
</CardGroup>
