# @lssm-tech/integration.fake-outbox-adapter

Fake/sandbox outbox adapter for builder delivery loop testing.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.4`
- Package path: `packages/integrations/fake-outbox-adapter`
- Manifest path: `packages/integrations/fake-outbox-adapter/package.json`
- Manifest Git blob: `6823707a9b2cc5e510573c1fd92ce25dccecb410`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/integration.fake-outbox-adapter](https://lssm.co/docs/packages/integration.fake-outbox-adapter/)
- 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/integrations/fake-outbox-adapter)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/fake-outbox-adapter/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/fake-outbox-adapter/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.fake-outbox-adapter.txt)

## Package metadata

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

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

Primary area: [Integrations and provider selection](https://lssm.co/docs/areas/integrations-and-providers/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/integrations/fake-outbox-adapter/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/fake-outbox-adapter/README.md",
  "blobSha": "84c5d8c9191a3eccc1dc47f0abb535ed3aca0f4e",
  "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/integration.fake-outbox-adapter

Website: https://contractspec.io

**Fake/sandbox outbox adapter for builder delivery loop testing.**

## What It Provides

- Simulated outbox adapter for testing builder delivery loop transitions without real provider SDKs or credentials.
- Supports `fake` and `sandbox` modes only; rejects production mode.
- Implements preflight checks, draft preparation, submission, receipt generation, and rollback.
- Idempotency key tracking and duplicate detection.
- Configurable latency simulation and failure rates for testing.

## When to Use

- Testing builder-delivery-loop transitions in development/staging.
- CI/CD integration tests that don't require real provider sends.
- Local development where real credentials aren't available.
- **Never use in production** - this adapter is explicitly designed to reject production mode.

## Usage

```typescript
import { createFakeOutboxAdapter } from '@lssm-tech/integration.fake-outbox-adapter';

const adapter = createFakeOutboxAdapter({
  mode: 'sandbox',
  simulateLatencyMs: 100,
  failureRate: 0.1, // 10% simulated failure rate
});

// Preflight check
const preflight = await adapter.preflight({
  loopId: 'loop-123',
  idempotencyKey: 'unique-key-123',
  billingOSRefs: ['billing-ref-1'],
  companyOSRefs: ['company-ref-1'],
  operatorApprovalRef: 'approval-123',
});

if (preflight.canProceed) {
  // Prepare draft
  const draft = await adapter.prepareDraft(input, preflight);
  
  // Submit
  const submission = await adapter.submit(draft, {
    draftId: draft.draftId,
    loopId: 'loop-123',
    idempotencyKey: 'unique-key-123',
    approvalStillValid: true,
    revisionAtSubmission: 1,
  });
  
  // Get receipt
  const receipt = await adapter.getReceipt({
    submissionId: submission.submissionId,
    idempotencyKey: 'unique-key-123',
  });
}
```


## Architecture

- Pure TypeScript implementation with no external provider dependencies.
- In-memory storage for drafts, submissions, and receipts.
- Fails closed on production mode detection.
- Supports idempotency for safe retry semantics.

## Safety

- **Always rejects production mode** - set `rejectProductionMode: true` (default).
- Requires idempotency keys for all operations.
- Requires operator approval references.
- Duplicate idempotency keys return existing receipts (idempotent).

## Local Commands

- `bun run dev` — contractspec-bun-build dev
- `bun run build` — contractspec-bun-build build
- `bun run test` — bun test
- `bun run lint:check` — biome check .


## Declared capabilities

### Integration Fake Outbox Adapter

Capability ID: `package.lssm.tech.integration.fake.outbox.adapter`

Fake/sandbox outbox adapter for builder delivery loop testing.

Use cases:

- Adopt fake/sandbox outbox adapter for builder delivery loop testing

Constraints:

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

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "integration",
    "fake",
    "outbox",
    "adapter"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/integration.fake-outbox-adapter",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.fake-outbox-adapter/fake-outbox-adapter",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "integrations",
  "kind": "integration",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./fake-outbox-adapter"
  ],
  "examples": [],
  "replacements": []
}
```

## 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.integration.fake.outbox.adapter",
    "from": "@lssm-tech/integration.fake-outbox-adapter",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.fake.outbox.adapter",
    "from": "@lssm-tech/integration.fake-outbox-adapter/fake-outbox-adapter",
    "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/integration.fake-outbox-adapter` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/fake-outbox-adapter/src/index.ts); verified source file.

- `@lssm-tech/integration.fake-outbox-adapter/fake-outbox-adapter` — subpath `./fake-outbox-adapter`
  - `unconditional`: `./src/fake-outbox-adapter.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/fake-outbox-adapter/src/fake-outbox-adapter.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"
    },
    "./fake-outbox-adapter": {
      "types": "./dist/fake-outbox-adapter.d.ts",
      "browser": "./dist/browser/fake-outbox-adapter.js",
      "bun": "./dist/fake-outbox-adapter.js",
      "node": "./dist/node/fake-outbox-adapter.js",
      "default": "./dist/fake-outbox-adapter.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.builder-spec](https://lssm.co/docs/packages/lib.builder-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:*`
- `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 run 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 --pass-with-no-tests",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Integration Fake Outbox Adapter documentation](https://www.npmjs.com/package/%40lssm-tech%2Fintegration.fake-outbox-adapter) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fintegration.fake-outbox-adapter",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/integration.fake-outbox-adapter.txt",
  "route": "/llms/integration.fake-outbox-adapter",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.fake-outbox-adapter.txt",
  "blobSha": "84c5d8c9191a3eccc1dc47f0abb535ed3aca0f4e",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
