# @lssm-tech/lib.creator-operations-runtime

Reusable transactional creator operations.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `0.2.4`
- Package path: `packages/domains/creator/runtime`
- Manifest path: `packages/domains/creator/runtime/package.json`
- Manifest Git blob: `3b4b8fefe46f4532908ec57dcb0fb9f8db7e0096`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/lib.creator-operations-runtime](https://lssm.co/docs/packages/lib.creator-operations-runtime/)
- 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/domains/creator/runtime)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.creator-operations-runtime.txt)

## Package metadata

```json
{
  "layer": "domains",
  "physicalArea": "creator",
  "primaryArea": "content-and-growth",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "runtime",
    "catalogKind": "library",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

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

Primary area: [Content, growth and creator operations](https://lssm.co/docs/areas/content-and-growth/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/domains/creator/runtime/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/README.md",
  "blobSha": "1e4649c1f2088e2d104a904ae70586cfc1748e2a",
  "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.

# Creator operations runtime

Reusable creator campaign lifecycle, immutable accepted agreements, submission review,
cumulative tiered CPM accrual and wallet-backed settlement orchestration.

Contracts are owned by `lib.contracts-spec/creator-operations`. Inject a transactional
store, a trusted authority and a clock. Every authority request contains the requested
parameters and evidence references; the host must verify scope, permissions, observation
evidence and financial authority against canonical records. There is no default grant.

Money uses integer decimal strings with an explicit currency and scale. Tiered CPM
uses per-band integer division, matching the existing Hirly calculation. Cumulative
accrual subtracts previously credited units so repeated observations cannot pay flat
fees twice. Accepted terms and earned balances are immutable; corrections never claw
back earnings implicitly. Campaign exposure is an additional funding ceiling.

Payout reservations, debits and history commit atomically. Unknown outcomes retain
their reservation; reconciliation does not resubmit. The provider port is shared by
Stripe, PayPal and manual settlement; each host adapter must verify the exact rail,
destination, unit conversion and settlement evidence before claiming payment.

This is additive capability extraction. Existing Hirly deployments have not migrated
and its 213-operation parity inventory is not certified by these package tests.


`training` contains the pure creator-training state transition extracted from Hirly's
current API behavior: locale, module views, quiz outcomes, micro-events and acknowledgement
state. Passed modules remain completed after a later failed quiz; updates use optimistic
versions and immutable snapshots. Hosts still validate course/module membership and quiz
evidence, persist request receipts and own migration. Spanish locale support is additive.


`training-service` adds authorized initialization and durable updates. Configure the
initial locale explicitly (Hirly uses fr) and a transactional CreatorTrainingStore.
Request receipts bind the full parsed event, creator, course, scope and expected version.
Exact retry returns the recorded state; altered request IDs fail. Host authority validates
course/module membership and quiz evidence before any read or write.


Result-only legacy training receipts are rejected by default because they cannot prove
exact input. Set `legacyReplay: 'preserve_native'` only in a reviewed native compatibility
adapter to replay the stored result for the same course without mutation. Imported
legacy IDs remain reserved and cannot become new exact-input update receipts.


`training-course` validates module, quiz, progress-event and locale membership against
a versioned course definition. Call it from the training authorization hook before
verifying quiz results. It does not authenticate creators or prove that a quiz was passed.


`createCreatorTrainingAuthority` composes authorized course loading, membership checks
and server-owned quiz-result verification. The returned function can be passed directly
to CreatorTrainingService.authorize. It rejects mismatched course scope and claimed quiz
outcomes; the loader still owns creator enrollment/identity authorization.


`training-progress` projects recorded module completion against an authorized course
revision. Duplicate completions count once; removed module IDs are reported separately
and cannot inflate completion. Quiz outcomes do not implicitly rewrite native historical
completion. The summary awards no XP or qualification.


CreatorTrainingProgressService authorizes the creator/course binding before reading
stored progress. Missing training state remains absent; dashboard reads do not initialize
progress or emit training receipts. The configured store may still use transactional locks.


`training-quiz` scores submitted answers against a private server-owned versioned key,
preserving rounded percentage thresholds. Missing answers are incorrect; unknown
question/option identifiers and malformed keys fail validation. Persist attempt evidence
server-side and feed its result to the training authority; never trust a browser score.


CreatorTrainingQuizService authorizes exact quiz revisions, scores privately and records
attempt receipts through an injected atomic store. The receipt contains submitted answers
and scoring results, never the answer key. Attempt replay rejects changed inputs and
does not itself update training progress. Durable attempt storage is still required.


The source-bound quiz compatibility script compares every achievable score across
Hirly's localized quiz packs and records source hashes. Use
`scripts/check-creator-quiz-compatibility.ts --source-root <creator-platform>` to refresh
that evidence when native content changes. No answer keys are written to the report.


CreatorQuizCompletionService scores/persists an attempt before deriving a training
quiz event from its server result. Its deterministic completion request identity prevents
duplicate progress writes. A version conflict leaves scoring durable and can be retried
against the correct training version; these are two recoverable stages, not one atomic
transaction. Both underlying services retain their authorization hooks.


Completion passes its scored attempt into the training authorization hook. The service
checks scope/creator/course/module/quiz/result binding before invoking that hook; host
authorization can compare the supplied receipt with durable attempt storage. Supplied
evidence is not intrinsically trusted and direct event updates retain their existing
authority requirements.


`createStoredCreatorQuizVerifier` plugs into createCreatorTrainingAuthority.verifyQuiz.
It requires completion attempt evidence, verifies creator/course/module/result binding,
and compares the full receipt with private durable storage. Enrollment authorization
must run first, and only trusted scorers may write attempt storage.


## Declared capabilities

### Canonical creator business runtime

Capability ID: `package.lssm.tech.lib.creator.operations.runtime`

Reusable transactional creator operations.

Use cases:

- Canonical creator business runtime

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "bun",
    "node"
  ],
  "requires": [
    "TypeScript",
    "Host-owned authority"
  ],
  "avoidWhen": [
    "Full Hirly application parity or live payment qualification is required without host integration."
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "creator",
    "campaign",
    "wallet",
    "settlement"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 65
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.creator-operations-runtime",
    "symbols": [
      "CreatorCampaignService",
      "CreatorAccrualService",
      "CreatorPayoutService"
    ]
  }
]
```

## Catalogue metadata

```json
{
  "family": "runtime",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "bun",
    "node"
  ],
  "entrypoints": [
    "."
  ]
}
```

## 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.lib.creator.operations.runtime",
    "from": "@lssm-tech/lib.creator-operations-runtime",
    "symbols": [
      "CreatorCampaignService",
      "CreatorAccrualService",
      "CreatorPayoutService"
    ]
  }
]
```

## 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/lib.creator-operations-runtime` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/index.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/accrual` — subpath `./accrual`
  - `unconditional`: `./src/accrual.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/accrual.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/calculation` — subpath `./calculation`
  - `unconditional`: `./src/calculation.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/calculation.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/campaigns` — subpath `./campaigns`
  - `unconditional`: `./src/campaigns.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/campaigns.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/creator-operations-runtime.feature` — subpath `./creator-operations-runtime.feature`
  - `unconditional`: `./src/creator-operations-runtime.feature.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/creator-operations-runtime.feature.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/dependencies` — subpath `./dependencies`
  - `unconditional`: `./src/dependencies.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/dependencies.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/payouts` — subpath `./payouts`
  - `unconditional`: `./src/payouts.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/payouts.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/submissions` — subpath `./submissions`
  - `unconditional`: `./src/submissions.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/submissions.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training` — subpath `./training`
  - `unconditional`: `./src/training.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-attempt-verifier` — subpath `./training-attempt-verifier`
  - `unconditional`: `./src/training-attempt-verifier.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-attempt-verifier.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-authority` — subpath `./training-authority`
  - `unconditional`: `./src/training-authority.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-authority.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-course` — subpath `./training-course`
  - `unconditional`: `./src/training-course.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-course.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-progress` — subpath `./training-progress`
  - `unconditional`: `./src/training-progress.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-progress.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-progress-service` — subpath `./training-progress-service`
  - `unconditional`: `./src/training-progress-service.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-progress-service.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-quiz` — subpath `./training-quiz`
  - `unconditional`: `./src/training-quiz.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-quiz.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-quiz-completion` — subpath `./training-quiz-completion`
  - `unconditional`: `./src/training-quiz-completion.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-quiz-completion.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-quiz-service` — subpath `./training-quiz-service`
  - `unconditional`: `./src/training-quiz-service.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-quiz-service.ts); verified source file.

- `@lssm-tech/lib.creator-operations-runtime/training-service` — subpath `./training-service`
  - `unconditional`: `./src/training-service.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime/src/training-service.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"
    },
    "./accrual": {
      "types": "./dist/accrual.d.ts",
      "browser": "./dist/browser/accrual.js",
      "bun": "./dist/accrual.js",
      "node": "./dist/node/accrual.js",
      "default": "./dist/accrual.js"
    },
    "./calculation": {
      "types": "./dist/calculation.d.ts",
      "browser": "./dist/browser/calculation.js",
      "bun": "./dist/calculation.js",
      "node": "./dist/node/calculation.js",
      "default": "./dist/calculation.js"
    },
    "./campaigns": {
      "types": "./dist/campaigns.d.ts",
      "browser": "./dist/browser/campaigns.js",
      "bun": "./dist/campaigns.js",
      "node": "./dist/node/campaigns.js",
      "default": "./dist/campaigns.js"
    },
    "./creator-operations-runtime.feature": {
      "types": "./dist/creator-operations-runtime.feature.d.ts",
      "browser": "./dist/browser/creator-operations-runtime.feature.js",
      "bun": "./dist/creator-operations-runtime.feature.js",
      "node": "./dist/node/creator-operations-runtime.feature.js",
      "default": "./dist/creator-operations-runtime.feature.js"
    },
    "./dependencies": {
      "types": "./dist/dependencies.d.ts",
      "browser": "./dist/browser/dependencies.js",
      "bun": "./dist/dependencies.js",
      "node": "./dist/node/dependencies.js",
      "default": "./dist/dependencies.js"
    },
    "./payouts": {
      "types": "./dist/payouts.d.ts",
      "browser": "./dist/browser/payouts.js",
      "bun": "./dist/payouts.js",
      "node": "./dist/node/payouts.js",
      "default": "./dist/payouts.js"
    },
    "./submissions": {
      "types": "./dist/submissions.d.ts",
      "browser": "./dist/browser/submissions.js",
      "bun": "./dist/submissions.js",
      "node": "./dist/node/submissions.js",
      "default": "./dist/submissions.js"
    },
    "./training": {
      "types": "./dist/training.d.ts",
      "browser": "./dist/browser/training.js",
      "bun": "./dist/training.js",
      "node": "./dist/node/training.js",
      "default": "./dist/training.js"
    },
    "./training-attempt-verifier": {
      "types": "./dist/training-attempt-verifier.d.ts",
      "browser": "./dist/browser/training-attempt-verifier.js",
      "bun": "./dist/training-attempt-verifier.js",
      "node": "./dist/node/training-attempt-verifier.js",
      "default": "./dist/training-attempt-verifier.js"
    },
    "./training-authority": {
      "types": "./dist/training-authority.d.ts",
      "browser": "./dist/browser/training-authority.js",
      "bun": "./dist/training-authority.js",
      "node": "./dist/node/training-authority.js",
      "default": "./dist/training-authority.js"
    },
    "./training-course": {
      "types": "./dist/training-course.d.ts",
      "browser": "./dist/browser/training-course.js",
      "bun": "./dist/training-course.js",
      "node": "./dist/node/training-course.js",
      "default": "./dist/training-course.js"
    },
    "./training-progress": {
      "types": "./dist/training-progress.d.ts",
      "browser": "./dist/browser/training-progress.js",
      "bun": "./dist/training-progress.js",
      "node": "./dist/node/training-progress.js",
      "default": "./dist/training-progress.js"
    },
    "./training-progress-service": {
      "types": "./dist/training-progress-service.d.ts",
      "browser": "./dist/browser/training-progress-service.js",
      "bun": "./dist/training-progress-service.js",
      "node": "./dist/node/training-progress-service.js",
      "default": "./dist/training-progress-service.js"
    },
    "./training-quiz": {
      "types": "./dist/training-quiz.d.ts",
      "browser": "./dist/browser/training-quiz.js",
      "bun": "./dist/training-quiz.js",
      "node": "./dist/node/training-quiz.js",
      "default": "./dist/training-quiz.js"
    },
    "./training-quiz-completion": {
      "types": "./dist/training-quiz-completion.d.ts",
      "browser": "./dist/browser/training-quiz-completion.js",
      "bun": "./dist/training-quiz-completion.js",
      "node": "./dist/node/training-quiz-completion.js",
      "default": "./dist/training-quiz-completion.js"
    },
    "./training-quiz-service": {
      "types": "./dist/training-quiz-service.d.ts",
      "browser": "./dist/browser/training-quiz-service.js",
      "bun": "./dist/training-quiz-service.js",
      "node": "./dist/node/training-quiz-service.js",
      "default": "./dist/training-quiz-service.js"
    },
    "./training-service": {
      "types": "./dist/training-service.d.ts",
      "browser": "./dist/browser/training-service.js",
      "bun": "./dist/training-service.js",
      "node": "./dist/node/training-service.js",
      "default": "./dist/training-service.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.creator-operations-spec](https://lssm.co/docs/packages/lib.creator-operations-spec/): `workspace:^`

### Peer dependencies

No declarations in the inspected manifest.

### 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/bun`: `catalog:types`
- `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
{
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "lint:check": "node ../../../../scripts/biome.cjs check .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit",
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose"
}
```

## Declared documentation links

- [@lssm-tech/lib.creator-operations-runtime](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/creator/runtime) — verified pinned repository path.

```json
{
  "url": "https://github.com/lssm-tech/contractspec/tree/main/packages/domains/creator/runtime",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/lib.creator-operations-runtime.txt",
  "route": "/llms/lib.creator-operations-runtime",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.creator-operations-runtime.txt",
  "blobSha": "1e4649c1f2088e2d104a904ae70586cfc1748e2a",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
