# scene-from-image-composer · integration layer

Block I integrations land here. Each integration is a single source file plus a
test file that adapts an external isis library to the composer's phase-output
shape.

## Map of integrations and external library status

(Status surveyed by block I chunk 1 — see commit message for the survey notes.)

| Integration                  | External lib                | Status                            | Adapter notes                                                                                                                                                                                  |
| ---------------------------- | --------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| gallery-registration         | `@isis/output-gallery`      | available now                     | OutputRecord is type-only; composer constructs records inline. May propose a `record-builder.ts` helper in output-gallery as an optional future cleanup.                                       |
| lineage-builder              | `@isis/outputs/lineage`     | available now                     | `composited-from` relation already exists in `LineageRelationType`; `LineageGraphManager` covers add-node/add-edge + cycle detection. No upstream change needed.                               |
| budget-enforcer              | `@isis/token-budget`        | needs thin wrapper                | Library is rule-based + model-pricing-driven; composer's per-phase cost reporting needs a `recordCost(opName, cents)` adapter on top. Will land in the budget integration file (chunk-N).      |
| license-compliance           | `@isis/model-governance-3d` | available now                     | Use `evaluate3DModelCommercialPolicy` per per-mesh artifact; composer collects per-artifact license tags during run and calls the evaluator.                                                   |
| anomaly-sampler              | `@isis/anomaly-detection`   | needs thin wrapper                | Library exposes `analyzeTransaction` for fraud-style detection but no telemetry-style `recordSample(channel, value)` API. Composer will wrap that pattern locally.                             |
| consensus-checkpoint-handler | `@isis/agent-consensus`     | available now (different pattern) | Library is session-driven (`ConvergenceEngine.createSession` → iterative `addPosition`), not single-function `runConsensus`. Adapter manages the session lifecycle inside a CheckpointHandler. |

## Files per integration

```
integration/
├── gallery-registration.ts
├── gallery-registration.test.ts
├── lineage-builder.ts
├── lineage-builder.test.ts
├── budget-enforcer.ts
├── budget-enforcer.test.ts
├── license-compliance.ts
├── license-compliance.test.ts
├── anomaly-sampler.ts
├── anomaly-sampler.test.ts
├── consensus-checkpoint-handler.ts
└── consensus-checkpoint-handler.test.ts
```

These are wired into the composer in a final chunk via `types.ts` (adding
`policyContext?` + `checkpointHandler?`) and the runner (post-manifest-phase
hooks for gallery/lineage/anomaly; per-phase hooks for budget/license; per-phase
checkpoint policy for consensus).
