# PR-08 assets.pa and Companion Artifact Emission

Domain Owner: `docs/packer`

## Briefing

Implement writer-side artifact emission on top of the deterministic build planner.

This PR turns validated and planned build state into the published packer outputs.

## Objective

Deliver `build`, `assets.pa`, and the baseline companion artifacts with deterministic ordering and stable writer-side contracts.

## Dependencies

- [`./PR-07-build-plan-determinism-and-cache-key-foundation.md`](./PR-07-build-plan-determinism-and-cache-key-foundation.md)
- [`../specs/1. Domain and Artifact Boundary Specification.md`](../specs/1.%20Domain%20and%20Artifact%20Boundary%20Specification.md)
- [`../specs/4. Build Artifacts and Deterministic Packing Specification.md`](../specs/4.%20Build%20Artifacts%20and%20Deterministic%20Packing%20Specification.md)

## Scope

- implement the `build` service
- emit `assets.pa`
- emit:
  - `build/asset_table.json`
  - `build/preload.json`
  - `build/asset_table_metadata.json`
- implement canonical header serialization and file writing
- implement payload-region offset materialization from the build plan
- expose build summaries and applied-artifact metadata for Studio and CI

## Non-Goals

- no cartridge assembly
- no shipper coupling
- no speculative layout optimization beyond deterministic packing

## Execution Method

1. Convert the build plan into emitted artifact bytes and companion files.
2. Preserve header authority and 1:1 mirror rules for companion JSON outputs.
3. Add golden fixtures for emitted headers and companion artifacts.
4. Keep runtime-facing semantics bounded to writer-side production rules already specified.

## Acceptance Criteria

- `build` produces `assets.pa` and companion artifacts deterministically
- companion JSON outputs mirror the runtime header where required
- emitted ordering and offsets follow the build plan contract
- repeated equivalent builds do not drift

## Validation

- golden tests for `assets.pa` envelope and header bytes
- golden tests for companion JSON mirrors
- repeated-build determinism tests

## Affected Artifacts

- `prometeu-packer/**`
- build output fixtures
- CI artifact assertions
