content(sim): rotating clip pools + progressive tracked labels & emotions
Content-pipeline Increment 2, part 1 (the experience). Implements design §11 (docs/superpowers/specs/2026-06-24-content-pipeline-design.md): - Rotating pool (§11.1): each ring scale references a POOL of vetted clips (docs/content-candidate-pool.md); the player picks a random member on landing. player.ring.Scale gains `pool` + pure `pick_clip_id(scale, r)` (injected randomness); the pick happens at the API boundary (random.random()), a delta=0 advance is the initial/re-roll pick. clips.py parses/exposes the pool; the client lands on move.target_clip_id. Back-compat: a scale with only clip_id is a pool of one. - Rename ring scale forest -> coast (new land<->sea scale, orbit..reef); ring order cosmos -> orbit -> coast -> reef -> abyss -> wrap. Cleanup: dropped the leftover local media (cosmos_traverse, orbit_westcoast, old forest/reef, the Increment-1 orbit/abyss single bases); new coast-edge transition placeholders. - Time-windowed tracked labels (§11.2): annotations gain appear/disappear (loop-normalized, wraps across the seam); a label shows only while on screen and its box tracks the subject. abyss + reef pools authored as test material. - Progressive LEFT detail tiers (§11.3): per-object `salience` (first shows at Left 5-salience) + tiered strings (general -> specific -> scientific -> +fact) escalating with the Left knob; replaces flat min_level gating. Strings may be a tier list or a static string (back-compat). No engine change (client reads overlay.level). - Progressive RIGHT emotion tiers (§11.4): affect vocabulary escalates basic -> compound with the Right knob (dream.strength); appearance still gated by min(left,right). No engine change. New simulator/build_pool_manifest.py holds the hand-authored content and emits the 19-clip pool manifest (the reproducible baseline). setup_scales_media.py marked superseded. 251 passed / 4 skipped (+ ring pool + API pool/window tests). By-eye visual review deferred to the operator (no Chrome on this box). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+37
-8
@@ -73,6 +73,18 @@ def load_manifest(path: str | Path) -> list[Clip]:
|
||||
return [_clip_from_dict(c) for c in data["clips"]]
|
||||
|
||||
|
||||
def _scale_from_dict(s: dict[str, Any]) -> Scale:
|
||||
"""A ring scale node, with its rotating clip pool (content-pipeline §11.1).
|
||||
|
||||
Accepts a `pool` list (the rotating model) and/or a legacy single `clip_id`.
|
||||
The primary `clip_id` is the explicit one if given, else the first pool
|
||||
member; `pool` defaults to `(clip_id,)` for a pre-pool manifest.
|
||||
"""
|
||||
pool = tuple(s.get("pool", []))
|
||||
clip_id = s.get("clip_id") or (pool[0] if pool else "")
|
||||
return Scale(id=s["id"], clip_id=clip_id, pool=pool)
|
||||
|
||||
|
||||
def load_ring(path: str | Path) -> ScaleRing | None:
|
||||
"""Load the optional `ring` section as a `ScaleRing`, or None if absent.
|
||||
|
||||
@@ -85,9 +97,7 @@ def load_ring(path: str | Path) -> ScaleRing | None:
|
||||
ring = data.get("ring")
|
||||
if not ring:
|
||||
return None
|
||||
scales = tuple(
|
||||
Scale(id=s["id"], clip_id=s["clip_id"]) for s in ring.get("scales", [])
|
||||
)
|
||||
scales = tuple(_scale_from_dict(s) for s in ring.get("scales", []))
|
||||
transitions = tuple(
|
||||
Transition(file=t["file"], model=t.get("model", ""))
|
||||
for t in ring.get("transitions", [])
|
||||
@@ -97,27 +107,46 @@ def load_ring(path: str | Path) -> ScaleRing | None:
|
||||
|
||||
def ring_to_dict(ring: ScaleRing, clips: list[Clip]) -> dict:
|
||||
"""JSON form of the ring for the API: ordered scales (with their clip title)
|
||||
and the per-edge transitions."""
|
||||
and the per-edge transitions.
|
||||
|
||||
Each scale carries its full rotating `pool` (clip id + title per member) plus
|
||||
the primary `clip_id`/`title` for back-compat. The client lands on a member
|
||||
chosen at the API boundary (`/api/ring/advance` → `target_clip_id`)."""
|
||||
titles = {c.id: c.title for c in clips}
|
||||
return {
|
||||
"scales": [
|
||||
{"id": s.id, "clip_id": s.clip_id, "title": titles.get(s.clip_id, s.id)}
|
||||
{
|
||||
"id": s.id,
|
||||
"clip_id": s.clip_id,
|
||||
"title": titles.get(s.clip_id, s.id),
|
||||
"pool": [
|
||||
{"clip_id": cid, "title": titles.get(cid, cid)}
|
||||
for cid in s.members
|
||||
],
|
||||
}
|
||||
for s in ring.scales
|
||||
],
|
||||
"transitions": [{"file": t.file, "model": t.model} for t in ring.transitions],
|
||||
}
|
||||
|
||||
|
||||
def ring_move_to_dict(move: RingMove, ring: ScaleRing) -> dict:
|
||||
def ring_move_to_dict(
|
||||
move: RingMove, ring: ScaleRing, chosen_clip_id: str | None = None
|
||||
) -> dict:
|
||||
"""JSON form of an encoder move: the landing scale's clip and the ordered
|
||||
transition clips to play (with direction). `fast` flags a collapsed fast-spin
|
||||
pass; the single step then carries `blended` so the renderer plays it quick."""
|
||||
pass; the single step then carries `blended` so the renderer plays it quick.
|
||||
|
||||
`target_clip_id` is the pool member the player should load on landing. The
|
||||
caller passes the random pick (`pick_clip_id(landed_scale, random.random())`,
|
||||
content-pipeline §11.1); when omitted it falls back to the scale's primary
|
||||
`clip_id` (deterministic — keeps pre-pool callers/tests working)."""
|
||||
return {
|
||||
"from_index": move.from_index,
|
||||
"to_index": move.to_index,
|
||||
"wrapped": move.wrapped,
|
||||
"fast": move.fast,
|
||||
"target_clip_id": scale_at(ring, move.to_index).clip_id,
|
||||
"target_clip_id": chosen_clip_id or scale_at(ring, move.to_index).clip_id,
|
||||
"steps": [
|
||||
{
|
||||
"edge": st.edge,
|
||||
|
||||
Reference in New Issue
Block a user