# ID9 — r207 PreviewHost + Inspector Mount — AI Summary (v2)

**Date**: 2026-08-30 | **Source**: a797 (full report, 34 KB) — supersedes a795
**Thread**: vibecoder-standalone-mavis (9) | **Operator directive**: r207 with r206 verified shipped

---

## TL;DR (5 bullets)

- **r206 verified shipped at commit `0746358` on `clean/baseline-plus-wdm`** in `avidtech6/vibecoder-standalone`. 7 r206 files at `src/host/workspace/` + 2 supporting (`cms-negotiator.ts`, `workspace-manager.ts`). Real r206 differs significantly from the spec I wrote in a793: nested bag (not flat), 33 events (not 11), window-level bus, lazy-mount via `vsil.asset.bind`, surface-targeting via `targetSurface` field.
- **r207 binds to REAL r206** — `useStudio()` hook (returns the nested `StudioContext`), `EventPayloadMap` (33 typed events), and 6 capability bags (`InspectorCapabilities`, `GalleryCapabilities`, `PreviewCapabilities`, `SurfaceCapabilities`, `OriginPreviewCapabilities`, `AppPreviewCapabilities`). No new event types, no new capability types.
- **5 new files, ~750 LoC** at `avidtech6/vibecoder-standalone/src/host/mounts/`: `PreviewHostVSIL.tsx` (180), `InspectorHost.tsx` (150), `CompositionGraphHost.tsx` (220), `mounts.ts` (80), `__tests__/mounts.test.ts` (120). Plus 1 LoC comment update in `src/vibechat/tools.ts:521`.
- **InspectorCard stub migration (a788)**: `studio/modules/vibescope/src/cards/InspectorCard.tsx` in freshvibestudio rewritten as a ~15 LoC wrapper that imports `useStudio` + `InspectorHost` from vibecoder-standalone. **Default: link via package alias** (option b), no vendor copies.
- **Lazy-mount + surface-targeting + READ-ONLY invariants**: r207 honors the r206 contract — hosts mount on `composition:host-mounted` (emitted by `vsil.asset.bind`), filter events by `targetSurface === ctx.activeSurface`, and the InspectorHost rejects all `transform` calls when `readOnly` is true (a788 invariant).

## What this means for the operator

r207 is the **mounting layer** that turns r206's capability bags + event bus into React components. Without r207, VibeCoder's UI components (VSILPanel, InspectorCard, etc.) can only call capabilities directly via `getStudioContext().inspector.vsil.applyCamera(...)` ad-hoc. With r207, those same components live inside declarative React hosts that subscribe to typed events and render the current state automatically.

**Critical difference from prior turn's plan**: the r206 contract is **already shipped and substantially different** from what I wrote in a793. The most important differences:
- `StudioContext` is a **nested bag** (`ctx.inspector.vsil.applyCamera(...)`), NOT flat methods
- Bus is **window-level** (not per-workspace)
- 33 events in `EventPayloadMap`, NOT 11 untyped events
- **Lazy-mount contract**: hosts mount on first `vsil.asset.bind`, not on initial render
- **Surface-targeting**: `preview:*` events carry `targetSurface`; hosts filter by it
- **READ-ONLY invariant**: capabilities return `{ ok: false, reason }`; no `composition:edit-rejected` event needed

## What's at risk

1. **freshvibestudio / vibecoder-standalone cross-repo coupling** — the `studio/modules/vibescope/src/cards/InspectorCard.tsx` migration requires freshvibestudio to import from vibecoder-standalone. Default fix: package alias (`"vibecoder-standalone": "avidtech6/vibecoder-standalone#clean/baseline-plus-wdm"`). Alternative: vendor r206+r207 files (anti-pattern).
2. **r207 over-eager writes** — the `CompositionGraphHost` could write via `ctx.inspector.region.transform` on mount. Default: strictly READ-ONLY in v1; defers writes to r208.
3. **No new `composition:edit-rejected` event** — r206 uses capability return shape (`{ ok: false, reason }`) for rejection. r207 surfaces this via console.warn (InspectorHost) and edge-panel toast (TBD).
4. **`studio/` module weight** — InspectorCard wrapper imports from vibecoder-standalone, which pulls in r206's full capability layer. Bundle size impact: ~30 KB minified. Acceptable for VibeCoder but worth flagging.

## 3 open questions (operator decides)

1. **InspectorCard migration strategy**: vendor r206+r207 (option a, anti-pattern) or link via package alias (option b)? → **default: option b**
2. **r207 implementation start**: this discovery only, no code, awaiting next directive? → **default: yes, discovery-only this turn**
3. **Composition host write in v1**: allow `transform` (writes) or strictly READ-ONLY in v1 (defers to r208)? → **default: strictly READ-ONLY in v1**

## What doesn't change

- r206 capability types (`capability-types.ts`) — consumed as-is
- r206 event types (`event-types.ts`) — consumed as-is, no new events
- r206 StudioContext shape — consumed as-is, no extensions
- 5 surface states (MAIN / WORKING / DRAFT / PREVIEW / ORIGIN) — `SurfaceId` from r206 `types.ts`
- a788 InspectorCard read-only invariant — preserved (default `readOnly={true}`)
- ID10 v2 capability layer — `*_CAPABILITIES` pattern reused in `mounts.ts`
- VibeCoder workspaces (vibecoder-self, oscar-tree-academy, oscar-static-source, hopfan-europe) — work unchanged

## Discuss-with-team topics

1. **Cross-repo dependency**: should freshvibestudio depend on vibecoder-standalone at all? The `studio/` module is meant to be the canonical module, not a consumer. Alternative: r207 ships in freshvibestudio too (parallel implementations). → recommend: package alias + small wrapper, accept the coupling.
2. **r207 write semantics**: should r207 components ever write, or are they always wrapped in something that mediates writes? The a788 read-only invariant is clear, but the Composition host could legitimately write (region transforms, preset application). → recommend: r207 v1 = READ-ONLY; r208 = WRITE via guarded capabilities.
3. **Test isolation**: r207 mounts depend on `getStudioContext()` singleton, which is window-level. Tests need to reset state between runs. → recommend: add `__resetStudioContextForTests()` exported from `context.ts` (test-only).

---

**Word count**: ~500. **Source report**: a797 (full, 34 KB). **Cross-references**: a786, a787, a788, a789, a791, a793 (superseded), ID10 v2.