@lovelace_lol/polymer 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +434 -12
  2. package/dist/index.d.ts +1945 -244
  3. package/dist/index.js +1686 -1017
  4. package/dist/vision/face-worker.js +296 -0
  5. package/dist/vision/face_landmarker.task +0 -0
  6. package/dist/vision/manifest.edn +1 -0
  7. package/dist/vision/vision_bundle.js +2 -0
  8. package/dist/vision/wasm/vision_wasm_internal.js +8841 -0
  9. package/dist/vision/wasm/vision_wasm_internal.wasm +0 -0
  10. package/dist/vision/wasm/vision_wasm_module_internal.js +8837 -0
  11. package/dist/vision/wasm/vision_wasm_module_internal.wasm +0 -0
  12. package/dist/vision/wasm/vision_wasm_nosimd_internal.js +8832 -0
  13. package/dist/vision/wasm/vision_wasm_nosimd_internal.wasm +0 -0
  14. package/dist/worker/agency-worker.js +1276 -962
  15. package/dist/worker/manifest.edn +1 -1
  16. package/package.json +33 -20
  17. package/dist/test.cjs +0 -1519
  18. package/shadow-cljs.edn +0 -173
  19. package/src/polymer/animation/agency.cljs +0 -84
  20. package/src/polymer/animation/domain.cljs +0 -110
  21. package/src/polymer/animation/planner.cljs +0 -88
  22. package/src/polymer/animation/runtime.cljs +0 -137
  23. package/src/polymer/animation/scheduler.cljs +0 -178
  24. package/src/polymer/animation/service.cljs +0 -981
  25. package/src/polymer/animation/state.cljs +0 -112
  26. package/src/polymer/blink/agency.cljs +0 -131
  27. package/src/polymer/blink/planner.cljs +0 -115
  28. package/src/polymer/blink/scheduler.cljs +0 -90
  29. package/src/polymer/blink/snippet.cljs +0 -50
  30. package/src/polymer/blink/state.cljs +0 -102
  31. package/src/polymer/camera_context/agency.cljs +0 -132
  32. package/src/polymer/camera_context/domain.cljs +0 -186
  33. package/src/polymer/camera_context/planner.cljs +0 -50
  34. package/src/polymer/camera_context/scheduler.cljs +0 -113
  35. package/src/polymer/camera_context/state.cljs +0 -121
  36. package/src/polymer/character.cljs +0 -403
  37. package/src/polymer/conversation/agency.cljs +0 -83
  38. package/src/polymer/conversation/domain.cljs +0 -35
  39. package/src/polymer/conversation/effector.cljs +0 -130
  40. package/src/polymer/conversation/planner.cljs +0 -178
  41. package/src/polymer/conversation/scheduler.cljs +0 -202
  42. package/src/polymer/conversation/service.cljs +0 -329
  43. package/src/polymer/conversation/state.cljs +0 -186
  44. package/src/polymer/core.cljs +0 -172
  45. package/src/polymer/eye_head/agency.cljs +0 -75
  46. package/src/polymer/eye_head/domain.cljs +0 -133
  47. package/src/polymer/eye_head/goap.cljs +0 -106
  48. package/src/polymer/eye_head/scheduler.cljs +0 -176
  49. package/src/polymer/eye_head/service.cljs +0 -259
  50. package/src/polymer/eye_head/snippet.cljs +0 -92
  51. package/src/polymer/eye_head/state.cljs +0 -167
  52. package/src/polymer/gaze/agency.cljs +0 -85
  53. package/src/polymer/gaze/domain.cljs +0 -211
  54. package/src/polymer/gaze/goap.cljs +0 -208
  55. package/src/polymer/gaze/scheduler.cljs +0 -184
  56. package/src/polymer/gaze/state.cljs +0 -202
  57. package/src/polymer/gesture/agency.cljs +0 -185
  58. package/src/polymer/gesture/goap.cljs +0 -461
  59. package/src/polymer/gesture/scheduler.cljs +0 -122
  60. package/src/polymer/gesture/snippet.cljs +0 -198
  61. package/src/polymer/gesture/state.cljs +0 -273
  62. package/src/polymer/lipsync/agency.cljs +0 -593
  63. package/src/polymer/lipsync/articulation/jaw.cljs +0 -258
  64. package/src/polymer/lipsync/articulation/snippet.cljs +0 -605
  65. package/src/polymer/lipsync/articulation/tongue.cljs +0 -418
  66. package/src/polymer/lipsync/articulation/visemes.cljs +0 -429
  67. package/src/polymer/lipsync/goap.cljs +0 -132
  68. package/src/polymer/lipsync/pronunciation/effector.cljs +0 -51
  69. package/src/polymer/lipsync/scheduler.cljs +0 -302
  70. package/src/polymer/lipsync/state.cljs +0 -202
  71. package/src/polymer/nlp/phonemes.cljs +0 -164
  72. package/src/polymer/prosodic/agency.cljs +0 -196
  73. package/src/polymer/prosodic/goap.cljs +0 -122
  74. package/src/polymer/prosodic/scheduler.cljs +0 -99
  75. package/src/polymer/prosodic/snippet.cljs +0 -106
  76. package/src/polymer/prosodic/state.cljs +0 -139
  77. package/src/polymer/runtime/embody.cljs +0 -117
  78. package/src/polymer/runtime/embody_wasm.cljs +0 -177
  79. package/src/polymer/runtime/rust_embody_host.cljs +0 -647
  80. package/src/polymer/society.cljs +0 -253
  81. package/src/polymer/stream.cljs +0 -130
  82. package/src/polymer/transcription/agency.cljs +0 -69
  83. package/src/polymer/transcription/domain.cljs +0 -68
  84. package/src/polymer/transcription/effector.cljs +0 -611
  85. package/src/polymer/transcription/planner.cljs +0 -203
  86. package/src/polymer/transcription/scheduler.cljs +0 -225
  87. package/src/polymer/transcription/service.cljs +0 -209
  88. package/src/polymer/transcription/state.cljs +0 -239
  89. package/src/polymer/tts/agency.cljs +0 -503
  90. package/src/polymer/tts/azure.cljs +0 -290
  91. package/src/polymer/tts/planner.cljs +0 -178
  92. package/src/polymer/tts/runtime.cljs +0 -624
  93. package/src/polymer/tts/scheduler.cljs +0 -162
  94. package/src/polymer/tts/state.cljs +0 -191
  95. package/src/polymer/worker.cljs +0 -81
@@ -1,117 +0,0 @@
1
- (ns polymer.runtime.embody
2
- (:require ["@lovelace_lol/embody" :as embody]
3
- [polymer.runtime.rust-embody-host :as rust-host]))
4
-
5
- ;; Polymer is the package boundary for character runtime APIs. LoomLarge imports
6
- ;; these helpers from Polymer, while Polymer remains free to change the concrete
7
- ;; Embody/Three.js implementation behind this boundary later.
8
- ;; scripts/embody-export-contract.mjs is the canonical public export list; CI
9
- ;; verifies this namespace, shadow-cljs, dist JS, declarations, and the pinned
10
- ;; Embody package against that one contract.
11
-
12
- (def Embody (aget embody "Embody"))
13
- (def BLENDING_MODES (or (.-BLENDING_MODES embody)
14
- (.-THREE_BLENDING_MODES embody)))
15
- (def THREE_BLENDING_MODES (.-THREE_BLENDING_MODES embody))
16
- (def collectMorphMeshes (.-collectMorphMeshes embody))
17
-
18
- (def analyzeModel (.-analyzeModel embody))
19
- (def extractModelData (.-extractModelData embody))
20
- (def getPreset (.-getPreset embody))
21
- (def validateMappings (.-validateMappings embody))
22
- (def extendCharacterConfigWithPreset (.-extendCharacterConfigWithPreset embody))
23
- (def extractProfileOverrides (.-extractProfileOverrides embody))
24
- (def mergeCharacterRegionsByName (.-mergeCharacterRegionsByName embody))
25
-
26
- (def applyAUBoneBindingUpdate (.-applyAUBoneBindingUpdate embody))
27
- (def applyBilateralAxisBindingUpdate (.-applyBilateralAxisBindingUpdate embody))
28
- (def applyBoneAxisBindingUpdate (.-applyBoneAxisBindingUpdate embody))
29
- (def buildBoneAuOptions (.-buildBoneAuOptions embody))
30
- (def classifyAuAsJointControl (.-classifyAuAsJointControl embody))
31
- (def createBilateralBoneAxisAu (.-createBilateralBoneAxisAu embody))
32
- (def createBoneAxisAu (.-createBoneAxisAu embody))
33
- (def DEFAULT_AXIS_TO_CHANNEL (.-DEFAULT_AXIS_TO_CHANNEL embody))
34
- (def DEFAULT_BONE_MAX_DEGREES (.-DEFAULT_BONE_MAX_DEGREES embody))
35
- (def ensureBilateralBoneNodeKeys (.-ensureBilateralBoneNodeKeys embody))
36
- (def ensureBoneNodeKey (.-ensureBoneNodeKey embody))
37
- (def findNodeKeyForBone (.-findNodeKeyForBone embody))
38
- (def formatAxisDirectionLabel (.-formatAxisDirectionLabel embody))
39
- (def formatAxisLabel (.-formatAxisLabel embody))
40
- (def getAUBoneBindingState (.-getAUBoneBindingState embody))
41
- (def getAxisFromChannel (.-getAxisFromChannel embody))
42
- (def getBilateralAxisBindingState (.-getBilateralAxisBindingState embody))
43
- (def getBoneAxisBindingState (.-getBoneAxisBindingState embody))
44
- (def inferChiralBoneNamePair (.-inferChiralBoneNamePair embody))
45
- (def inferEyeControlFamily (.-inferEyeControlFamily embody))
46
- (def inferEyeControlScope (.-inferEyeControlScope embody))
47
- (def isJointControlAuInfo (.-isJointControlAuInfo embody))
48
- (def isMaxDegreesOnlyAxisBindingUpdate (.-isMaxDegreesOnlyAxisBindingUpdate embody))
49
- (def JOINT_CONTROL_SECTION (.-JOINT_CONTROL_SECTION embody))
50
- (def resolveBoneAxisChannel (.-resolveBoneAxisChannel embody))
51
- (def resolveBoneNameForNodeKey (.-resolveBoneNameForNodeKey embody))
52
- (def resolveContinuumDisplayLabel (.-resolveContinuumDisplayLabel embody))
53
- (def stripConfiguredBoneAffixes (.-stripConfiguredBoneAffixes embody))
54
-
55
- (def computeCameraRelativeGazeOffset (.-computeCameraRelativeGazeOffset embody))
56
- (def detectAnnotationLaterality (.-detectAnnotationLaterality embody))
57
- (def fuzzyNameMatch (.-fuzzyNameMatch embody))
58
- (def getDefaultAnnotationLaterality (.-getDefaultAnnotationLaterality embody))
59
- (def getMeshNamesForAUProfile (.-getMeshNamesForAUProfile embody))
60
- (def getModelLocalOrbitAngle (.-getModelLocalOrbitAngle embody))
61
- (def getSemanticHorizontalSign (.-getSemanticHorizontalSign embody))
62
- (def getSemanticHorizontalSignForSide (.-getSemanticHorizontalSignForSide embody))
63
- (def getWorldDirectionForCameraAngle (.-getWorldDirectionForCameraAngle embody))
64
- (def hasLeftRightMorphs (.-hasLeftRightMorphs embody))
65
- (def isMixedAU (.-isMixedAU embody))
66
- (def passesMarkerCameraAngleGate (.-passesMarkerCameraAngleGate embody))
67
- (def resolveBoneNames (.-resolveBoneNames embody))
68
- (def resolveFaceCenter (.-resolveFaceCenter embody))
69
- (def resolveRegionCameraAngle (.-resolveRegionCameraAngle embody))
70
- (def resolveRegionVisibilityCameraAngle (.-resolveRegionVisibilityCameraAngle embody))
71
- (def toWorldDirection (.-toWorldDirection embody))
72
- (def RustAnnotationCameraCore (.-RustAnnotationCameraCore embody))
73
- (def createRustAnnotationCameraCore (.-createRustAnnotationCameraCore embody))
74
-
75
- (def CC4_BONES (or (aget embody "CC4_BONES")
76
- (aget embody "CC4_BONE_NODES")))
77
- (def VISEME_KEYS (.-VISEME_KEYS embody))
78
-
79
- ;; Hair appearance/materials are Embody runtime APIs (not a Polymer agency).
80
- ;; Re-export so hosts can import presets/helpers from Polymer without depending
81
- ;; on @lovelace_lol/embody directly.
82
- (def HAIR_COLOR_PRESETS (.-HAIR_COLOR_PRESETS embody))
83
- (def DEFAULT_HAIR_COLOR_APPEARANCE (.-DEFAULT_HAIR_COLOR_APPEARANCE embody))
84
- (def normalizeHairColorAppearance (.-normalizeHairColorAppearance embody))
85
-
86
- (def HUMANOID_SKELETON_TEMPLATES (.-HUMANOID_SKELETON_TEMPLATES embody))
87
- (def JONATHAN_HUMANOID_SKELETON_TEMPLATE (.-JONATHAN_HUMANOID_SKELETON_TEMPLATE embody))
88
- (def getHumanoidSkeletonTemplate (.-getHumanoidSkeletonTemplate embody))
89
- (def getHumanoidSkeletonTemplateBoneNames (.-getHumanoidSkeletonTemplateBoneNames embody))
90
- (def createValidationSkeletonFromHumanoidTemplate (.-createValidationSkeletonFromHumanoidTemplate embody))
91
- (def computeHumanoidSkeletonTemplateRestBounds (.-computeHumanoidSkeletonTemplateRestBounds embody))
92
- (def extractHumanoidSkeletonTemplateFromModel (.-extractHumanoidSkeletonTemplateFromModel embody))
93
-
94
- (def createCharacterHost (.-createCharacterHost embody))
95
-
96
- ;; Polymer owns the CLJS host boundary and talks directly to RuntimeCore. Embody
97
- ;; contributes only the Wasm ABI and reusable Three.js inspection/application
98
- ;; utilities.
99
- (def createRustEmbodyHost rust-host/createRustEmbodyHost)
100
- (def createRustEmbodyHostUnbound rust-host/createRustEmbodyHostUnbound)
101
- (def supportsRustEmbodyPreset rust-host/supportsRustEmbodyPreset)
102
-
103
- (def createDefaultCharacterScene (.-createDefaultCharacterScene embody))
104
- (def createDefaultCharacterLighting (.-createDefaultCharacterLighting embody))
105
- (def createShadowPlane (.-createShadowPlane embody))
106
- (def loadCharacterModel (.-loadCharacterModel embody))
107
- (def parseCharacterModel (.-parseCharacterModel embody))
108
- (def applyCharacterModelTransform (.-applyCharacterModelTransform embody))
109
- (def disposeCharacterModel (.-disposeCharacterModel embody))
110
- (def DEFAULT_CHARACTER_LIGHTING_PRESET_ID (.-DEFAULT_CHARACTER_LIGHTING_PRESET_ID embody))
111
- (def DEFAULT_CHARACTER_LIGHTING_PRESET_IDS (.-DEFAULT_CHARACTER_LIGHTING_PRESET_IDS embody))
112
- (def DEFAULT_CHARACTER_LIGHTING_PRESETS (.-DEFAULT_CHARACTER_LIGHTING_PRESETS embody))
113
- (def DEFAULT_CHARACTER_LIGHTING_SETTINGS (.-DEFAULT_CHARACTER_LIGHTING_SETTINGS embody))
114
- (def normalizeDefaultCharacterLightingSettings (.-normalizeDefaultCharacterLightingSettings embody))
115
- (def CHARACTER_SCENE_TYPES (.-CHARACTER_SCENE_TYPES embody))
116
- (def CHARACTER_SCENE_TYPE_IDS (.-CHARACTER_SCENE_TYPE_IDS embody))
117
- (def DEFAULT_CHARACTER_SCENE_TYPE_ID (.-DEFAULT_CHARACTER_SCENE_TYPE_ID embody))
@@ -1,177 +0,0 @@
1
- (ns polymer.runtime.embody-wasm
2
- "Direct CLJS access to the Embody Rust/Wasm core.
3
-
4
- Agencies and LoomLarge tooling should load numeric kernels through this
5
- namespace rather than going through the TypeScript Embody facade. The Three.js
6
- adapter (polymer.runtime.embody / Embody class) remains responsible for scene
7
- graph mutation, AnimationMixer, and host writes."
8
- (:require ["@lovelace_lol/embody/wasm" :as wasm]))
9
-
10
- ;; Public aliases in this namespace are listed in
11
- ;; scripts/embody-export-contract.mjs and validated across source, shadow-cljs,
12
- ;; checked-in dist JS, declarations, and the pinned upstream Wasm entry.
13
-
14
- (def ^:private *core (atom nil))
15
- (def ^:private *init-promise (atom nil))
16
-
17
- (defn- js-call
18
- [obj method & args]
19
- (let [f (aget obj method)]
20
- (when-not (fn? f)
21
- (throw (js/Error. (str "Embody Wasm module is missing method: " method))))
22
- (apply f args)))
23
-
24
- (defn core-ready?
25
- "True when init-core! has resolved a Wasm module."
26
- []
27
- (some? @*core))
28
-
29
- (defn get-core
30
- "Return the initialized Wasm module or throw."
31
- []
32
- (or @*core
33
- (throw (js/Error. "Embody Wasm core is not initialized. Call initEmbodyCore / init-core! first."))))
34
-
35
- (defn init-core!
36
- "Initialize the Embody Wasm core via @lovelace_lol/embody/wasm.
37
-
38
- Returns a Promise that resolves to the Wasm module. Subsequent calls reuse
39
- the same in-flight or completed initialization."
40
- []
41
- (if-let [pending @*init-promise]
42
- pending
43
- (let [pending
44
- (-> (wasm/initEmbodyCore)
45
- (.then
46
- (fn [mod]
47
- (let [expected (or (.-EMBODY_CORE_ABI_VERSION wasm) 1)
48
- actual (js-call mod "core_abi_version")]
49
- (when (not= actual expected)
50
- (throw (js/Error.
51
- (str "Embody Wasm ABI mismatch: runtime=" actual
52
- " expected=" expected))))
53
- (reset! *core mod)
54
- mod)))
55
- (.catch
56
- (fn [err]
57
- (reset! *init-promise nil)
58
- (throw err))))]
59
- (reset! *init-promise pending)
60
- pending)))
61
-
62
- ;; JS-friendly aliases for shadow-cljs / TypeScript consumers
63
- (def initEmbodyCore init-core!)
64
- (def isEmbodyCoreReady core-ready?)
65
- (def getEmbodyCore get-core)
66
-
67
- (defn core-abi-version
68
- []
69
- (js-call (get-core) "core_abi_version"))
70
-
71
- (def coreAbiVersion core-abi-version)
72
-
73
- (defn pack-morph-frame-delta
74
- [mesh-ids morph-target-ids values modes]
75
- (js-call (get-core) "pack_morph_frame_delta" mesh-ids morph-target-ids values modes))
76
-
77
- (def packMorphFrameDelta pack-morph-frame-delta)
78
-
79
- (defn solve-bilateral-values
80
- [base balance]
81
- (js-call (get-core) "solve_bilateral_values" base balance))
82
-
83
- (def solveBilateralValues solve-bilateral-values)
84
-
85
- (defn solve-morph-batch
86
- [values balances mix-weights]
87
- (js-call (get-core) "solve_morph_batch" values balances mix-weights))
88
-
89
- (def solveMorphBatch solve-morph-batch)
90
-
91
- (defn solve-axis-quaternion
92
- [axis degrees value scale]
93
- (js-call (get-core) "solve_axis_quaternion" axis degrees value scale))
94
-
95
- (def solveAxisQuaternion solve-axis-quaternion)
96
-
97
- (defn analyze-mesh-proportions
98
- [vertices vertical-axis]
99
- (js-call (get-core) "analyze_mesh_proportions" vertices vertical-axis))
100
-
101
- (def analyzeMeshProportions analyze-mesh-proportions)
102
-
103
- (defn solve-template-skeleton-fit
104
- [mesh-vertices template-bounds vertical-axis vertical-anchor]
105
- (js-call (get-core)
106
- "solve_template_skeleton_fit"
107
- mesh-vertices
108
- template-bounds
109
- vertical-axis
110
- vertical-anchor))
111
-
112
- (def solveTemplateSkeletonFit solve-template-skeleton-fit)
113
-
114
- (defn compose-template-fit-adjustment
115
- [fit scale-multiplier offset-x offset-y offset-z]
116
- (js-call (get-core)
117
- "compose_template_fit_adjustment"
118
- fit
119
- scale-multiplier
120
- offset-x
121
- offset-y
122
- offset-z))
123
-
124
- (def composeTemplateFitAdjustment compose-template-fit-adjustment)
125
-
126
- (defn compose-template-skeleton-fit-transform
127
- [fit-scale fit-translation manual-scale manual-translation]
128
- (js-call (get-core)
129
- "compose_template_skeleton_fit_transform"
130
- fit-scale
131
- fit-translation
132
- manual-scale
133
- manual-translation))
134
-
135
- (def composeTemplateSkeletonFitTransform compose-template-skeleton-fit-transform)
136
-
137
- (defn default-hair-physics-config-values
138
- []
139
- (js-call (get-core) "default_hair_physics_config_values"))
140
-
141
- (def defaultHairPhysicsConfigValues default-hair-physics-config-values)
142
-
143
- (defn create-hair-physics-solver
144
- "Construct a Wasm HairPhysicsSolver from optional packed config values."
145
- ([]
146
- (create-hair-physics-solver (default-hair-physics-config-values)))
147
- ([config-values]
148
- (let [Ctor (aget (get-core) "HairPhysicsSolver")]
149
- (when-not Ctor
150
- (throw (js/Error. "Embody Wasm module does not export HairPhysicsSolver")))
151
- (new Ctor config-values))))
152
-
153
- (def createHairPhysicsSolver create-hair-physics-solver)
154
-
155
- (defn create-runtime-core
156
- "Construct the Wasm live morph RuntimeCore (AU/viseme state -> packed
157
- morph FrameDelta rows). Load bindings with load_au_morph_bindings /
158
- load_viseme_morph_bindings before evaluating."
159
- [viseme-slot-count]
160
- (let [Ctor (aget (get-core) "RuntimeCore")]
161
- (when-not Ctor
162
- (throw (js/Error. "Embody Wasm module does not export RuntimeCore")))
163
- (new Ctor viseme-slot-count)))
164
-
165
- (def createRuntimeCore create-runtime-core)
166
-
167
- ;; Re-export ABI constants from the JS wasm entry for consumers that need them
168
- ;; before init completes.
169
- (def EMBODY_CORE_ABI_VERSION (or (.-EMBODY_CORE_ABI_VERSION wasm) 1))
170
- (def PACKED_MORPH_FRAME_DELTA_STRIDE (.-PACKED_MORPH_FRAME_DELTA_STRIDE wasm))
171
- (def HAIR_CONFIG_STRIDE (.-HAIR_CONFIG_STRIDE wasm))
172
- (def HAIR_STATE_STRIDE (.-HAIR_STATE_STRIDE wasm))
173
- (def HAIR_HEAD_STATE_STRIDE (.-HAIR_HEAD_STATE_STRIDE wasm))
174
- (def HAIR_MORPH_OUTPUT_STRIDE (.-HAIR_MORPH_OUTPUT_STRIDE wasm))
175
- (def MESH_PROPORTIONS_STRIDE (.-MESH_PROPORTIONS_STRIDE wasm))
176
- (def TEMPLATE_SKELETON_FIT_SOLUTION_STRIDE (.-TEMPLATE_SKELETON_FIT_SOLUTION_STRIDE wasm))
177
- (def TEMPLATE_SKELETON_FIT_TRANSFORM_STRIDE (.-TEMPLATE_SKELETON_FIT_TRANSFORM_STRIDE wasm))