# PR-13 Embedded Bootstrap, Container-Owned Event Bus, and Packer Composition Root

Domain Owner: `docs/packer`
Cross-Domain Impact: `docs/studio`

## Briefing

After the cleanup baseline, the next step is to make embedded Studio bootstrap explicit and introduce one composition root for the packer.

This is where the Studio `Container` becomes a contract plus global holder, while the concrete embedded boot and `prometeu-packer-v1` wiring move into the application layer.

## Objective

Deliver the embedded bootstrap contract, explicit `PackerEventSink` wiring, and an explicit `prometeu-packer-api` to `prometeu-packer-v1` composition root for Studio embedding.

## Dependencies

- [`./PR-12-cleanup-and-unused-surface-removal-before-runtime-service-wave.md`](./PR-12-cleanup-and-unused-surface-removal-before-runtime-service-wave.md)
- [`../specs/5. Diagnostics, Operations, and Studio Integration Specification.md`](../specs/5.%20Diagnostics,%20Operations,%20and%20Studio%20Integration%20Specification.md)
- cross-domain reference: [`../../studio/specs/2. Studio UI Foundations Specification.md`](../../studio/specs/2.%20Studio%20UI%20Foundations%20Specification.md)

## Scope

- define the embedded packer bootstrap contract
- define the packer composition root for the active service wave inside the application layer
- keep `prometeu-studio` bound only to `prometeu-packer-api`
- wire the Studio `Container` contract/holder as the owner of the shared typed event bus reference used by the host-side `PackerEventSink` bridge
- ensure application boot installs a `Container` implementation before packer-backed use begins
- make the active embedded runtime entrypoint explicit enough that future capabilities do not depend on hidden constructors or side boot paths

## Non-Goals

- no runtime snapshot yet
- no read migration yet
- no write lane yet
- no alternate bootstrap retained for inactive `doctor`, `build/pack`, or reconcile paths

## Execution Method

1. Define the explicit packer bootstrap/composition entrypoint.
2. Make the host-provided `PackerEventSink` an explicit dependency for Studio embedding.
3. Refactor Studio `Container` into a contract plus installed global holder.
4. Move concrete packer wiring to the application layer that chooses `prometeu-packer-v1`.
5. Remove remaining ambiguity around packer-local versus container-owned event visibility by bridging `PackerEventSink` into the host bus at the application layer.
5. Remove remaining embedded bootstrap variants that only exist to keep inactive service surfaces alive.

## Acceptance Criteria

- the active packer wave has one explicit composition root
- `prometeu-studio` depends only on `prometeu-packer-api`
- the application layer installs the `Container` implementation and chooses `prometeu-packer-v1`
- Studio `Container` owns the shared typed event bus reference through its installed implementation
- the packer composition root receives an explicit `PackerEventSink` rather than reaching directly into host event bus types
- packer-backed work starts only after `Container.install(...)`
- packer publication uses `PackerEventSink`, and the application layer bridges that sink into the container-owned path when embedded in Studio
- no public `PackerEventSink.noop()`-style default is treated as acceptable production bootstrap behavior
- hidden bootstrap paths that only support inactive service surfaces are removed

## Validation

- bootstrap tests for the packer composition root
- Studio boot tests for `Container.install(...)`
- integration tests for packer event visibility through the host bridge into the container-owned path

## Affected Artifacts

- `prometeu-packer/prometeu-packer-api/src/main/java/p/packer/**`
- `prometeu-packer/prometeu-packer-v1/src/main/java/p/packer/services/**`
- `prometeu-packer/prometeu-packer-v1/src/main/java/p/packer/events/**`
- `prometeu-studio/src/main/java/p/studio/Container.java`
- `prometeu-studio/src/main/java/p/studio/events/**`
- `prometeu-app/src/main/java/p/studio/App.java`
- `prometeu-app/src/main/java/p/studio/AppContainer.java`
