Skip to content

[agency] Harden CLJS hair agency as a worker-safe state planner #8

Description

@meekmachine

Goal

Finish Hair as a ClojureScript worker-safe state planner that emits host commands for material, part, outline, and physics updates without touching Three/Loom3 objects directly.

Current state

Polyester already has src-cljs/latticework/hair.cljs, in-process creation, worker client methods, color presets, part state, and physics config planning. The old TypeScript service still bridges into actual LoomLarge/Loom3 objects.

This mirrors the Latticework research issue: meekmachine/Latticework#40.

Clojure-way direction

  • Move serializable hair color, eyebrow color, outline, visibility, part scale/position, object registration metadata, and physics config into CLJS planner state.
  • Main thread applies emitted applyHairState and applyHairPhysics outputs to materials, meshes, morphs, and runtime physics.
  • Keep worker outputs plain data and avoid object references.
  • Preserve current public behavior through a JS/TS compatibility adapter.

Acceptance criteria

  • Worker state snapshots are serializable and include hair state, object summaries, and physics config.
  • Worker emits object-specific host commands for color/outline/visibility/scale/position and physics config changes.
  • No worker code references Loom3, Three objects, DOM, or global debug APIs.
  • Existing hair behavior remains unchanged through the main-thread adapter.
  • Add parity tests for color presets, custom colors, object registration, part visibility/scale/position, outline, reset, and physics config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions