@holoscript/core 8.0.8 → 8.0.10
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.
- package/LICENSE +21 -0
- package/bin/holoscript.cjs +5 -1
- package/dist/GLTFPipeline-L76YTXKA.js +15 -0
- package/dist/GLTFPipeline-ZWJN7GI6.cjs +36 -0
- package/dist/HoloCompositionParser-K76KTEEE.js +12 -0
- package/dist/HoloCompositionParser-UZH6Y4HO.cjs +45 -0
- package/dist/HoloScriptCodeParser-2D4ERFUZ.js +6 -0
- package/dist/HoloScriptCodeParser-UDRLDA7I.cjs +23 -0
- package/dist/HoloScriptPlusParser-FTMCGWXD.js +13 -0
- package/dist/HoloScriptPlusParser-LQR5GIKF.cjs +30 -0
- package/dist/HoloScriptRuntime-UTRLJI5L.js +12 -0
- package/dist/HoloScriptRuntime-YBYXJHJN.cjs +21 -0
- package/dist/SceneIRCompiler-63KA3M2F.js +17 -0
- package/dist/SceneIRCompiler-KWUFHZ4O.cjs +42 -0
- package/dist/{USDZExporter-AUHZODOF.cjs → USDZExporter-ML4UMIGC.cjs} +3 -3
- package/dist/{USDZExporter-GXB4AUSG.js → USDZExporter-ZFKLQ76G.js} +3 -3
- package/dist/agents/index.cjs +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/audit/AuditLogger.d.ts +106 -0
- package/dist/audit/AuditQueryBuilder.d.ts +79 -0
- package/dist/audit/ComplianceReporter.d.ts +90 -0
- package/dist/audit/index.d.ts +13 -0
- package/dist/{chunk-FGMDMJM7.js → chunk-2BYAUHBO.js} +3 -3
- package/dist/{chunk-EDPYCLRC.cjs → chunk-2E6PP5UE.cjs} +83 -59
- package/dist/{chunk-GASCWJK5.js → chunk-2EGGAZT3.js} +65 -287
- package/dist/{chunk-SIEXCILW.js → chunk-2I3XAGMF.js} +3 -3
- package/dist/{chunk-OS533P33.cjs → chunk-2KKOYZYI.cjs} +1074 -1655
- package/dist/chunk-2MQKNDNH.js +51 -0
- package/dist/{chunk-7DMMMBCY.cjs → chunk-2X3IPCBK.cjs} +10 -10
- package/dist/chunk-2ZOTBO25.cjs +202 -0
- package/dist/chunk-356N4NPM.cjs +152 -0
- package/dist/{chunk-X3GJPRVK.cjs → chunk-36NPLOI4.cjs} +92 -81
- package/dist/{chunk-SLU6UPJI.cjs → chunk-37HHY7RH.cjs} +5 -5
- package/dist/{chunk-YDPEHCCI.cjs → chunk-3CDDRUER.cjs} +3 -118
- package/dist/chunk-3F7ZZWIN.js +1651 -0
- package/dist/chunk-3ILD7TKP.cjs +187 -0
- package/dist/{chunk-X27QRG4C.cjs → chunk-3IUHTGDD.cjs} +153 -41
- package/dist/{chunk-PXNZ6TME.js → chunk-4376VHNJ.js} +60 -36
- package/dist/{chunk-YKGPCZEE.cjs → chunk-4FIBOJW6.cjs} +10 -10
- package/dist/chunk-4Q7RKQQI.cjs +14195 -0
- package/dist/{chunk-YCM6QQRT.cjs → chunk-566ZB4LZ.cjs} +180 -8
- package/dist/{chunk-2Y3V22SG.js → chunk-5CURIYGT.js} +3 -3
- package/dist/{chunk-QBWNJXNR.js → chunk-5FYMCVBY.js} +5 -5
- package/dist/{chunk-ZA34AN3R.js → chunk-5LVFTGKH.js} +841 -12
- package/dist/{chunk-Z6PMDS4G.js → chunk-5OUOMBKK.js} +1090 -53
- package/dist/chunk-63AUAIL6.js +48 -0
- package/dist/chunk-655FATJU.js +110 -0
- package/dist/{chunk-TQ377OLB.cjs → chunk-65S62L4D.cjs} +28 -22
- package/dist/chunk-6NTAZN5Z.cjs +502 -0
- package/dist/chunk-6TRX6AR2.js +9376 -0
- package/dist/chunk-6ZCCLKS2.cjs +51 -0
- package/dist/{chunk-MDR235RZ.js → chunk-734OB5SK.js} +721 -8
- package/dist/{chunk-Q2Q34NF3.js → chunk-77QI552M.js} +6 -6
- package/dist/{chunk-WKX5AMOY.js → chunk-7I74JWPW.js} +3 -3
- package/dist/{chunk-5FSKKMR7.cjs → chunk-7IDJDMPU.cjs} +232 -4
- package/dist/chunk-7VBKRGIZ.cjs +847 -0
- package/dist/{chunk-KCPHASCO.js → chunk-AATYYLYK.js} +5 -5
- package/dist/{chunk-DTGBOSEM.cjs → chunk-AWXFEAQL.cjs} +12 -12
- package/dist/{chunk-THCK6ECW.js → chunk-B3CWTCK2.js} +231 -3
- package/dist/chunk-BCP4E7MD.cjs +997 -0
- package/dist/chunk-BG7RPYJP.js +91 -0
- package/dist/{chunk-VF257YKO.js → chunk-BP4KTMLY.js} +117 -5
- package/dist/{chunk-YN6IETRZ.js → chunk-BQJ3YBF3.js} +6424 -987
- package/dist/{chunk-7X5PNIQJ.js → chunk-BXSOEQI3.js} +27 -25
- package/dist/{chunk-WFKVS2K4.cjs → chunk-C65C5VED.cjs} +1101 -55
- package/dist/{chunk-KOUAQL2B.cjs → chunk-CANAL6CT.cjs} +1569 -168
- package/dist/{chunk-FDSGHPAK.js → chunk-CBSDJF3B.js} +3 -3
- package/dist/{chunk-FEWUHQNM.cjs → chunk-CFVK26P4.cjs} +4 -4
- package/dist/{chunk-M7K4LE66.cjs → chunk-CI33NINL.cjs} +4 -4
- package/dist/{chunk-2OWDB4FB.js → chunk-CKV5NYAE.js} +6 -6
- package/dist/{chunk-LPS5AMQD.cjs → chunk-CM4NHXVO.cjs} +24 -24
- package/dist/chunk-D3HSRXYB.js +115 -0
- package/dist/{chunk-FNHJRI32.js → chunk-DBH3D2MU.js} +1561 -160
- package/dist/{chunk-GW3LKD5C.js → chunk-DJNH4HFW.js} +3 -3
- package/dist/{chunk-2GCNOI2U.cjs → chunk-DN6F4DHH.cjs} +9 -3
- package/dist/chunk-DQRJ5RJG.js +432 -0
- package/dist/{chunk-C7ZBSV2Q.js → chunk-DUG3OQAS.js} +106 -43
- package/dist/chunk-ECUYJOJ2.cjs +199 -0
- package/dist/chunk-EEMTCAK7.js +182 -0
- package/dist/{chunk-3SKLAUDD.cjs → chunk-EI3J6LTW.cjs} +359 -581
- package/dist/{chunk-SSSN7VAM.js → chunk-EM2OGPYE.js} +4 -4
- package/dist/{chunk-56VOWURB.cjs → chunk-ENZCIQZC.cjs} +522 -453
- package/dist/chunk-ESBXUYOC.cjs +836 -0
- package/dist/{chunk-L5U4W6JC.js → chunk-ESSEF6U2.js} +4 -4
- package/dist/chunk-ET3AN4W3.js +824 -0
- package/dist/chunk-EXKSFGSX.cjs +14 -14
- package/dist/{chunk-I76GIKN7.cjs → chunk-F3YT6GUF.cjs} +17 -17
- package/dist/{chunk-WRWEX5ZF.js → chunk-F75DZBBI.js} +3 -3
- package/dist/{chunk-4JGRWHZJ.js → chunk-FG6PYGIZ.js} +12 -6
- package/dist/chunk-FGGJQRLZ.js +14 -14
- package/dist/{chunk-SXOSDZD6.js → chunk-FWCHPCD4.js} +128 -10
- package/dist/{chunk-XW6IXEQH.cjs → chunk-G35CAQ7I.cjs} +5 -5
- package/dist/{chunk-7VMGP2FW.js → chunk-G6KACNMO.js} +132 -188
- package/dist/{chunk-FJPADH77.cjs → chunk-GAWJJAGT.cjs} +6 -6
- package/dist/chunk-GGR7QUKK.cjs +4724 -0
- package/dist/chunk-GIBF4BHH.js +14098 -0
- package/dist/{chunk-AWB7QYY6.cjs → chunk-GILYQ5VH.cjs} +6 -6
- package/dist/{chunk-FWVYAMNW.cjs → chunk-GKFCHGCM.cjs} +4 -4
- package/dist/{chunk-Y3ZFVUUU.js → chunk-GLEJ2TLS.js} +3 -3
- package/dist/{chunk-3GWWJT7L.js → chunk-GP3OKSKT.js} +13 -13
- package/dist/chunk-GTIPOEHN.js +196 -0
- package/dist/{chunk-LMJ5EBV7.cjs → chunk-GZPUA2TL.cjs} +16 -15
- package/dist/{chunk-IELX2OKI.js → chunk-H4LJ4HEA.js} +3 -115
- package/dist/{chunk-ACVWFGBI.cjs → chunk-HCX4SMFK.cjs} +3 -3
- package/dist/{chunk-HYNTS5CP.js → chunk-HHRZ6STP.js} +24 -2
- package/dist/chunk-HIDEIEFG.js +48 -0
- package/dist/{chunk-W6RW64BB.cjs → chunk-HSWBIDZM.cjs} +228 -5
- package/dist/{chunk-GSOUNWEL.js → chunk-HVX7QQYK.js} +1035 -1616
- package/dist/{chunk-TRCGG42I.cjs → chunk-IFW5IW4L.cjs} +6502 -1019
- package/dist/{chunk-F5LKJ6F5.cjs → chunk-IJU6AS67.cjs} +32 -28
- package/dist/{chunk-TVANHNJ7.js → chunk-IK6Z2HNC.js} +173 -3
- package/dist/{chunk-QGMUTVVH.cjs → chunk-IS7NTKY5.cjs} +20 -20
- package/dist/{chunk-YFVQWSNJ.js → chunk-IXWGYWH6.js} +3 -3
- package/dist/chunk-J2DAS2PL.js +148 -0
- package/dist/chunk-JBQXZIWB.js +148 -0
- package/dist/chunk-JBYBMBMW.js +261 -0
- package/dist/{chunk-LWUOUCYL.js → chunk-JEJ7TT54.js} +5 -5
- package/dist/{chunk-DUCB6LGL.js → chunk-JOTCTHN5.js} +211 -5
- package/dist/{chunk-47RUFYKR.js → chunk-K56UVEXV.js} +3 -3
- package/dist/{chunk-XSFNHP2E.js → chunk-KB26H447.js} +3 -3
- package/dist/{chunk-3NGDZZR4.js → chunk-KEYG7HGY.js} +430 -37
- package/dist/{chunk-DY72BMU5.js → chunk-KFVNCW4Q.js} +4 -4
- package/dist/chunk-KPGC7SK2.js +192 -0
- package/dist/chunk-KROXXBK5.cjs +53 -0
- package/dist/{chunk-ZPZAVHXL.cjs → chunk-LB3ZZMKT.cjs} +137 -19
- package/dist/chunk-LDYZWNJW.cjs +1654 -0
- package/dist/{chunk-UGXHYIWT.cjs → chunk-LHNHO27U.cjs} +28 -28
- package/dist/{chunk-ULMSSHCJ.cjs → chunk-LMB555QB.cjs} +405 -38
- package/dist/{chunk-CBJY23VL.js → chunk-MD4IVS42.js} +3 -3
- package/dist/{chunk-VMLKSV26.js → chunk-MDDWEBCX.js} +226 -3
- package/dist/chunk-MUWH4QK5.cjs +94 -0
- package/dist/{chunk-T6W3Z3SH.cjs → chunk-N2ILK7BF.cjs} +4 -4
- package/dist/{chunk-6EX3I5P4.cjs → chunk-N74QRJGP.cjs} +6 -6
- package/dist/chunk-NFFHLX37.cjs +132 -0
- package/dist/chunk-NJSYWX7H.js +190 -0
- package/dist/{chunk-SH5PPVK7.cjs → chunk-NQN5LFN4.cjs} +165 -221
- package/dist/chunk-NTQRFOPP.cjs +56 -0
- package/dist/{chunk-YFWRJW4B.js → chunk-NWMJPTVL.js} +51 -55
- package/dist/{chunk-63ZGNR2T.cjs → chunk-OC6GV5QH.cjs} +42 -42
- package/dist/{chunk-7E7GCQCK.js → chunk-OG3MBHM3.js} +9 -3
- package/dist/chunk-OMNHTCS4.cjs +264 -0
- package/dist/chunk-OQXB6NNC.cjs +117 -0
- package/dist/{chunk-Y57W2CT5.cjs → chunk-OV46CCA2.cjs} +51 -55
- package/dist/{chunk-6PRZIHGL.cjs → chunk-OV6HHKLE.cjs} +21 -266
- package/dist/{chunk-C37BHB7N.cjs → chunk-P26YYPOO.cjs} +5 -5
- package/dist/{chunk-2BZHWUSR.cjs → chunk-P7JEKJTZ.cjs} +16 -16
- package/dist/{chunk-NGBXXZLL.cjs → chunk-PDXX5UI4.cjs} +45 -45
- package/dist/{chunk-FHQFPYV4.js → chunk-PJFTTSKE.js} +8 -7
- package/dist/{chunk-GVFJ6T4S.cjs → chunk-PVODJEJ7.cjs} +721 -8
- package/dist/{chunk-ZZ7RO2UQ.js → chunk-Q265VZJ4.js} +3 -3
- package/dist/{chunk-E7JP3BS3.cjs → chunk-Q47JEE2C.cjs} +4 -4
- package/dist/chunk-QBY7LRN2.js +281 -0
- package/dist/{chunk-GH6C2QGW.cjs → chunk-QEDMOGF3.cjs} +857 -16
- package/dist/{chunk-5WUNN6ZN.cjs → chunk-QHSAVOOL.cjs} +24 -2
- package/dist/chunk-QJNCDVYM.cjs +137 -0
- package/dist/chunk-QM7FJB5W.js +4717 -0
- package/dist/chunk-QQFB4RT2.cjs +448 -0
- package/dist/chunk-QSYBHQAD.cjs +196 -0
- package/dist/{chunk-2YSNA2F2.cjs → chunk-QVJMDVYZ.cjs} +5 -5
- package/dist/chunk-RAJMAX6D.js +131 -0
- package/dist/{chunk-VVKVQZI6.js → chunk-RAN3ECAS.js} +3 -3
- package/dist/chunk-RKGUZBOC.js +79 -0
- package/dist/{chunk-HLFDZ35S.cjs → chunk-RRQIAJLQ.cjs} +8 -8
- package/dist/{chunk-PABONWKI.js → chunk-RXQNRZ5F.js} +3 -3
- package/dist/{chunk-7ZHYEITD.cjs → chunk-S4O7CFHQ.cjs} +10 -11
- package/dist/chunk-SE7ANBGN.js +128 -0
- package/dist/{chunk-X2AVEAZM.cjs → chunk-SJIRCTIS.cjs} +176 -2
- package/dist/{chunk-WXQ57LAO.js → chunk-SQXAZHDG.js} +4 -4
- package/dist/chunk-SR73L5ZP.cjs +84 -0
- package/dist/{chunk-OABEO6HH.js → chunk-SZOLTWWD.js} +2349 -214
- package/dist/{chunk-5JEU52DW.js → chunk-TPZ3BN2D.js} +3 -3
- package/dist/{chunk-QFU53KRH.js → chunk-TSTFYGGX.js} +4 -5
- package/dist/{chunk-EBS32AJI.cjs → chunk-TZCFKZ6Z.cjs} +5 -5
- package/dist/chunk-UCVZXQ63.js +724 -0
- package/dist/chunk-UGQ3QNV6.js +992 -0
- package/dist/chunk-UNMVGZVW.js +142 -0
- package/dist/{chunk-TEVX443G.js → chunk-UTUD6GJI.js} +178 -6
- package/dist/chunk-UXBYA7DV.cjs +155 -0
- package/dist/chunk-V6GXFSK7.cjs +443 -0
- package/dist/chunk-VHORVGCG.cjs +761 -0
- package/dist/{chunk-B4EKV6HQ.js → chunk-VKCTYLDN.js} +500 -442
- package/dist/{chunk-O3MGZDCT.cjs → chunk-VTEXJOSD.cjs} +63 -63
- package/dist/chunk-VVAAZITA.cjs +287 -0
- package/dist/{chunk-V7AKE5VT.cjs → chunk-W2GA3EQB.cjs} +435 -42
- package/dist/chunk-W4GABFCR.js +37 -0
- package/dist/chunk-WKEK4NCA.js +490 -0
- package/dist/{chunk-5A4TCHOC.cjs → chunk-WNYXT4TE.cjs} +4 -4
- package/dist/{chunk-S762UEV5.js → chunk-WTH23ISI.js} +6 -6
- package/dist/{chunk-BTKZGHAV.js → chunk-WWNCM473.js} +10 -6
- package/dist/{chunk-4YNYPHH3.cjs → chunk-X75H75UY.cjs} +2351 -213
- package/dist/{chunk-LYJJI7ZK.cjs → chunk-XCUDDFKC.cjs} +216 -9
- package/dist/chunk-YAO4HPJL.cjs +120 -0
- package/dist/chunk-YKY2JBER.cjs +9443 -0
- package/dist/chunk-YP5CHEYU.cjs +154 -0
- package/dist/{chunk-WRNEH5MO.js → chunk-YW3I2FQL.js} +18 -7
- package/dist/{chunk-BRNUPDHJ.js → chunk-Z557DVYN.js} +386 -19
- package/dist/{chunk-VSACG2AR.js → chunk-Z6LZUYZF.js} +21 -264
- package/dist/chunk-ZHPMP447.cjs +43 -0
- package/dist/{chunk-LODTHGST.cjs → chunk-ZK7KX5CD.cjs} +133 -70
- package/dist/{chunk-CCPSNT6B.cjs → chunk-ZRPALBQB.cjs} +5 -5
- package/dist/chunk-ZVFHPMC5.js +824 -0
- package/dist/chunk-ZVQMKUGJ.js +443 -0
- package/dist/cli/holoscript-runner.cjs +86 -48
- package/dist/cli/holoscript-runner.js +54 -16
- package/dist/codebase/index.cjs +1 -1
- package/dist/codebase/index.js +1 -1
- package/dist/compiler/agent-inference.cjs +11 -11
- package/dist/compiler/agent-inference.js +9 -6
- package/dist/compiler/android-xr.cjs +13 -12
- package/dist/compiler/android-xr.js +11 -10
- package/dist/compiler/android.cjs +12 -12
- package/dist/compiler/android.js +10 -10
- package/dist/compiler/business-quest.cjs +10 -10
- package/dist/compiler/business-quest.js +2 -2
- package/dist/compiler/coco.cjs +1 -1
- package/dist/compiler/coco.js +1 -1
- package/dist/compiler/context.cjs +9 -9
- package/dist/compiler/context.js +6 -6
- package/dist/compiler/daimon-seed.cjs +36 -0
- package/dist/compiler/daimon-seed.js +12 -0
- package/dist/compiler/domain-block-utils.cjs +205 -156
- package/dist/compiler/domain-block-utils.js +8 -7
- package/dist/compiler/dtdl.cjs +10 -10
- package/dist/compiler/dtdl.js +7 -7
- package/dist/compiler/gltf-pipeline.cjs +9 -9
- package/dist/compiler/gltf-pipeline.js +2 -2
- package/dist/compiler/godot.cjs +10 -9
- package/dist/compiler/godot.js +9 -8
- package/dist/compiler/incremental.cjs +11 -11
- package/dist/compiler/incremental.js +6 -6
- package/dist/compiler/index.cjs +2585 -3273
- package/dist/compiler/index.d.ts +149 -35
- package/dist/compiler/index.js +2197 -3102
- package/dist/compiler/ios.cjs +11 -11
- package/dist/compiler/ios.js +9 -9
- package/dist/compiler/llm-provider-capabilities.cjs +9 -9
- package/dist/compiler/llm-provider-capabilities.js +6 -6
- package/dist/compiler/nodetoy.cjs +1 -1
- package/dist/compiler/nodetoy.js +1 -1
- package/dist/compiler/openxr.cjs +11 -10
- package/dist/compiler/openxr.js +10 -9
- package/dist/compiler/remotion.cjs +1 -1
- package/dist/compiler/remotion.js +1 -1
- package/dist/compiler/reproducibility.cjs +1 -1
- package/dist/compiler/reproducibility.js +1 -1
- package/dist/compiler/sdf.cjs +11 -10
- package/dist/compiler/sdf.js +9 -8
- package/dist/compiler/semantic-scene.cjs +7 -7
- package/dist/compiler/semantic-scene.js +2 -2
- package/dist/compiler/state.cjs +9 -9
- package/dist/compiler/state.js +7 -7
- package/dist/compiler/trait-composition.cjs +11 -11
- package/dist/compiler/trait-composition.js +7 -7
- package/dist/compiler/traits/ProvenanceSemiring.d.ts +167 -0
- package/dist/compiler/traits/Semiring.d.ts +26 -0
- package/dist/compiler/unity.cjs +11 -10
- package/dist/compiler/unity.js +10 -9
- package/dist/compiler/unreal.cjs +12 -11
- package/dist/compiler/unreal.js +10 -9
- package/dist/compiler/urdf.cjs +18 -17
- package/dist/compiler/urdf.js +9 -8
- package/dist/compiler/usd-physics.cjs +11 -10
- package/dist/compiler/usd-physics.js +8 -7
- package/dist/compiler/visionos.cjs +11 -10
- package/dist/compiler/visionos.js +10 -9
- package/dist/compiler/vrchat.cjs +11 -10
- package/dist/compiler/vrchat.js +9 -8
- package/dist/compiler/wasm.cjs +14 -13
- package/dist/compiler/wasm.js +9 -8
- package/dist/compiler/webgpu.cjs +10 -9
- package/dist/compiler/webgpu.js +9 -8
- package/dist/constants.cjs +398 -0
- package/dist/constants.js +9 -0
- package/dist/coordinators/index.cjs +4 -1
- package/dist/coordinators/index.js +4 -1
- package/dist/debugger.cjs +11 -9
- package/dist/debugger.js +9 -7
- package/dist/{dist-ACXG6IH5.cjs → dist-GRMOP2UL.cjs} +341 -65
- package/dist/{dist-VD4L6V7Q.js → dist-ZBUKU2JG.js} +333 -63
- package/dist/entries/interop.cjs +23 -23
- package/dist/entries/interop.js +3 -3
- package/dist/entries/scripting.cjs +12 -11
- package/dist/entries/scripting.js +8 -7
- package/dist/evolution/index.cjs +66 -0
- package/dist/evolution/index.d.ts +162 -0
- package/dist/evolution/index.js +17 -0
- package/dist/hololand/index.cjs +41 -37
- package/dist/hololand/index.js +3 -3
- package/dist/index.cjs +12394 -3224
- package/dist/index.d.ts +260 -18
- package/dist/index.js +10755 -2182
- package/dist/keyword-registry/PluginKeywordRegistry.d.ts +138 -0
- package/dist/keyword-registry/index.cjs +29 -0
- package/dist/keyword-registry/index.d.ts +1 -0
- package/dist/keyword-registry/index.js +4 -0
- package/dist/math/tropical-spmv.cjs +11 -11
- package/dist/math/tropical-spmv.d.ts +1 -0
- package/dist/math/tropical-spmv.js +2 -2
- package/dist/math/tropicalSpmv.d.ts +43 -0
- package/dist/math/vec3.cjs +1 -1
- package/dist/math/vec3.js +1 -1
- package/dist/matter/StagedMatter.d.ts +82 -0
- package/dist/matter/index.cjs +17 -0
- package/dist/matter/index.d.ts +1 -0
- package/dist/matter/index.js +4 -0
- package/dist/{ml-dsa-Z7JDKW4L.js → ml-dsa-J6VKVT4K.js} +3 -3
- package/dist/{ml-dsa-FSKBTE3W.cjs → ml-dsa-MTIK4ZUQ.cjs} +23 -23
- package/dist/paper-0c-spike/index.cjs +1 -1
- package/dist/paper-0c-spike/index.js +1 -1
- package/dist/parameter-envelope/ParameterEnvelope.d.ts +128 -0
- package/dist/parameter-envelope/index.cjs +17 -0
- package/dist/parameter-envelope/index.d.ts +2 -0
- package/dist/parameter-envelope/index.js +4 -0
- package/dist/parser/HoloCompositionTypes.d.ts +2013 -0
- package/dist/parser/PipelineParser.d.ts +162 -0
- package/dist/parser.cjs +36 -20
- package/dist/parser.js +13 -9
- package/dist/plugin-manifest/ManifestAutoLoader.d.ts +35 -0
- package/dist/plugin-manifest/PluginManifest.d.ts +156 -0
- package/dist/plugin-manifest/index.cjs +25 -0
- package/dist/plugin-manifest/index.d.ts +2 -0
- package/dist/plugin-manifest/index.js +4 -0
- package/dist/plugin-solver-contract/PluginSolverContract.d.ts +288 -0
- package/dist/plugin-solver-contract/index.cjs +41 -0
- package/dist/plugin-solver-contract/index.d.ts +1 -0
- package/dist/plugin-solver-contract/index.js +4 -0
- package/dist/policy/ContentPolicyGate.d.ts +51 -0
- package/dist/policy/PolicyPack.d.ts +120 -0
- package/dist/policy/blocklist.d.ts +32 -0
- package/dist/policy/defaults.d.ts +44 -0
- package/dist/policy/index.cjs +106 -0
- package/dist/policy/index.d.ts +17 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/jsonLogic.d.ts +31 -0
- package/dist/policy/types.d.ts +174 -0
- package/dist/proof-composition/ProofCompositionLaw.d.ts +93 -0
- package/dist/proof-composition/index.cjs +25 -0
- package/dist/proof-composition/index.d.ts +1 -0
- package/dist/proof-composition/index.js +4 -0
- package/dist/receipts/hash-policy.d.ts +85 -0
- package/dist/reconstruction/index.cjs +75 -47
- package/dist/reconstruction/index.js +5 -5
- package/dist/runtime/plugin-trait-registrar.d.ts +36 -0
- package/dist/runtime.cjs +81 -79
- package/dist/runtime.js +9 -7
- package/dist/scene-presets-EDKYZ5GW.js +4 -0
- package/dist/scene-presets-NCW2CFRS.cjs +17 -0
- package/dist/self-improvement/index.cjs +1 -1
- package/dist/self-improvement/index.js +1 -1
- package/dist/{src-PT2FERDV.cjs → src-G3D7ZATQ.cjs} +545 -21
- package/dist/{src-J6CM4AUR.js → src-UXYA7HM6.js} +539 -16
- package/dist/storage/index.cjs +10 -10
- package/dist/storage/index.js +3 -3
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/index.cjs +3631 -0
- package/dist/tools/index.js +3581 -0
- package/dist/traitDocs/traitDocs.cjs +9 -9
- package/dist/traitDocs/traitDocs.d.ts +1 -0
- package/dist/traitDocs/traitDocs.js +3 -3
- package/dist/traits/ControlLoopTrait.d.ts +154 -0
- package/dist/traits/KinematicChainTrait.d.ts +116 -0
- package/dist/traits/SensorSamplingTrait.d.ts +154 -0
- package/dist/traits/TraitTypes.d.ts +270 -0
- package/dist/traits/TransactionTrait.d.ts +121 -0
- package/dist/traits/botanical-lotus.cjs +54 -50
- package/dist/traits/botanical-lotus.js +2 -5
- package/dist/traits/control-loop.cjs +21 -0
- package/dist/traits/control-loop.d.ts +1 -0
- package/dist/traits/control-loop.js +4 -0
- package/dist/traits/engines/cloth-verlet.d.ts +65 -0
- package/dist/traits/engines/index.cjs +19 -19
- package/dist/traits/engines/index.d.ts +15 -275
- package/dist/traits/engines/index.js +3 -3
- package/dist/traits/engines/motion-data-schema.d.ts +119 -0
- package/dist/traits/engines/motion-matching.d.ts +102 -0
- package/dist/traits/engines/noise.d.ts +25 -0
- package/dist/traits/engines/onnx-adapter.d.ts +173 -0
- package/dist/traits/engines/onnx-motion-matching.d.ts +163 -0
- package/dist/traits/engines/pfnn-network.d.ts +92 -0
- package/dist/traits/engines/synthetic-walk-cycle.d.ts +38 -0
- package/dist/traits/engines/tensor-ops.d.ts +15 -0
- package/dist/traits/index.cjs +2789 -1259
- package/dist/traits/index.d.ts +35 -0
- package/dist/traits/index.js +1692 -411
- package/dist/traits/kinematic-chain.cjs +25 -0
- package/dist/traits/kinematic-chain.d.ts +1 -0
- package/dist/traits/kinematic-chain.js +4 -0
- package/dist/traits/sensor-sampling.cjs +33 -0
- package/dist/traits/sensor-sampling.d.ts +1 -0
- package/dist/traits/sensor-sampling.js +4 -0
- package/dist/traits/simulation-solver-factory.cjs +1 -1
- package/dist/traits/simulation-solver-factory.js +1 -1
- package/dist/traits/transaction.cjs +29 -0
- package/dist/traits/transaction.d.ts +1 -0
- package/dist/traits/transaction.js +4 -0
- package/dist/traits/webcam-gaze.cjs +1 -1
- package/dist/traits/webcam-gaze.js +1 -1
- package/dist/type-checker.cjs +7 -6
- package/dist/type-checker.js +5 -4
- package/dist/types/AdvancedTypeSystem.d.ts +489 -0
- package/dist/types/HoloScriptPlus.d.ts +810 -0
- package/dist/types/base.d.ts +248 -0
- package/dist/types.d.ts +799 -0
- package/dist/world/index.cjs +3 -4
- package/dist/world/index.js +3 -4
- package/dist/world-model/index.cjs +1 -1
- package/dist/world-model/index.js +1 -1
- package/dist/wot/index.cjs +1 -1
- package/dist/wot/index.js +1 -1
- package/package.json +135 -69
- package/dist/GLTFPipeline-3EJLL3TS.cjs +0 -38
- package/dist/GLTFPipeline-3OWJV2VK.js +0 -17
- package/dist/HoloScriptPlusParser-ADWRY5OS.cjs +0 -698
- package/dist/HoloScriptPlusParser-JLJDXHSC.js +0 -693
- package/dist/HoloScriptPlusParser-QCGFPWIL.cjs +0 -27
- package/dist/HoloScriptPlusParser-WENAFEFV.js +0 -10
- package/dist/HoloScriptRuntime-GGRVEU4T.cjs +0 -19
- package/dist/HoloScriptRuntime-GJK6VJPH.js +0 -10
- package/dist/chunk-22Q5A6RV.js +0 -979
- package/dist/chunk-4C57PR42.js +0 -468
- package/dist/chunk-4W5G5QVL.cjs +0 -847
- package/dist/chunk-5ET6L4NS.js +0 -487
- package/dist/chunk-C4GSLCHE.cjs +0 -7153
- package/dist/chunk-F2G6CWFT.js +0 -7089
- package/dist/chunk-G6PNEASF.cjs +0 -814
- package/dist/chunk-GTA4Q3A3.js +0 -1491
- package/dist/chunk-HCCQLAA4.cjs +0 -74
- package/dist/chunk-HFSVMKM3.cjs +0 -72
- package/dist/chunk-KAIVDEIG.cjs +0 -4539
- package/dist/chunk-KQU64CIX.cjs +0 -1508
- package/dist/chunk-MSYSQ2AJ.js +0 -4533
- package/dist/chunk-NHJLP37F.js +0 -70
- package/dist/chunk-NHYRRAGI.cjs +0 -490
- package/dist/chunk-OIQYIIO3.cjs +0 -473
- package/dist/chunk-OL46QLBJ.js +0 -61
- package/dist/chunk-SKZPC5AG.cjs +0 -984
- package/dist/chunk-SLHLXUMO.js +0 -445
- package/dist/chunk-UOIGFQXC.cjs +0 -9750
- package/dist/chunk-UOL6Y5TD.cjs +0 -759
- package/dist/chunk-UVFI7XIR.cjs +0 -452
- package/dist/chunk-VEPGBETF.js +0 -844
- package/dist/chunk-XQ5MWMP2.js +0 -756
- package/dist/chunk-XT6JY5W5.js +0 -9684
- package/dist/chunk-YRRAUB35.js +0 -811
- package/dist/compiler/GasOptimizationAnalyzer.d.ts +0 -73
- package/dist/compiler/NFTMarketplaceCompiler.d.ts +0 -23
- package/dist/compiler/ar.cjs +0 -23
- package/dist/compiler/ar.js +0 -11
- package/dist/compiler/babylon.cjs +0 -21
- package/dist/compiler/babylon.js +0 -15
- package/dist/compiler/multi-layer.cjs +0 -24
- package/dist/compiler/multi-layer.js +0 -15
- package/dist/compiler/playcanvas.cjs +0 -19
- package/dist/compiler/playcanvas.js +0 -13
- package/dist/compiler/r3f.cjs +0 -39
- package/dist/compiler/r3f.d.ts +0 -22
- package/dist/compiler/r3f.js +0 -17
- package/dist/compiler/vrr.cjs +0 -24
- package/dist/compiler/vrr.js +0 -12
- package/dist/parser/NFTMarketplaceTypes.d.ts +0 -191
- package/dist/playwright-3AT3AKTV.cjs +0 -98673
- package/dist/playwright-VZPDVUEQ.js +0 -98660
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { computeHoloMapReplayFingerprint } from './chunk-WNNE3PO3.js';
|
|
2
|
-
import { isWebGpuEnvironmentPresent, HOLOMAP_SIMULATION_CONTRACT_KIND } from './chunk-
|
|
2
|
+
import { isWebGpuEnvironmentPresent, HOLOMAP_SIMULATION_CONTRACT_KIND } from './chunk-K56UVEXV.js';
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
|
-
var HOLOSCRIPT_VERSION = "8.0.
|
|
6
|
-
var GIT_COMMIT_SHA = "
|
|
7
|
-
var BUILD_TIMESTAMP = "2026-
|
|
5
|
+
var HOLOSCRIPT_VERSION = "8.0.10" ;
|
|
6
|
+
var GIT_COMMIT_SHA = "416a77860" ;
|
|
7
|
+
var BUILD_TIMESTAMP = "2026-07-05T21:54:18.667Z" ;
|
|
8
8
|
function getVersionString() {
|
|
9
9
|
const sha = `+${GIT_COMMIT_SHA}` ;
|
|
10
10
|
return `${HOLOSCRIPT_VERSION}${sha}`;
|
|
@@ -279,7 +279,7 @@ function createLayerNormKernel(device) {
|
|
|
279
279
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
280
280
|
});
|
|
281
281
|
const paramsBuf = createParamsBuffer(device, rows, dModel, eps);
|
|
282
|
-
const
|
|
282
|
+
const readback2 = device.createBuffer({
|
|
283
283
|
size: input.byteLength,
|
|
284
284
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
|
|
285
285
|
});
|
|
@@ -301,18 +301,18 @@ function createLayerNormKernel(device) {
|
|
|
301
301
|
pass.dispatchWorkgroups(rows, 1, 1);
|
|
302
302
|
pass.end();
|
|
303
303
|
}
|
|
304
|
-
encoder.copyBufferToBuffer(outputBuf, 0,
|
|
304
|
+
encoder.copyBufferToBuffer(outputBuf, 0, readback2, 0, input.byteLength);
|
|
305
305
|
device.queue.submit([encoder.finish()]);
|
|
306
|
-
await
|
|
307
|
-
const bytes =
|
|
306
|
+
await readback2.mapAsync(GPUMapMode.READ);
|
|
307
|
+
const bytes = readback2.getMappedRange();
|
|
308
308
|
const out = new Float32Array(bytes.slice(0));
|
|
309
|
-
|
|
309
|
+
readback2.unmap();
|
|
310
310
|
inputBuf.destroy();
|
|
311
311
|
gammaBuf.destroy();
|
|
312
312
|
betaBuf.destroy();
|
|
313
313
|
outputBuf.destroy();
|
|
314
314
|
paramsBuf.destroy();
|
|
315
|
-
|
|
315
|
+
readback2.destroy();
|
|
316
316
|
return out;
|
|
317
317
|
}
|
|
318
318
|
};
|
|
@@ -789,7 +789,7 @@ function createGeluKernel(device) {
|
|
|
789
789
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
790
790
|
});
|
|
791
791
|
const paramsBuf = createParamsBuffer3(device, input.length);
|
|
792
|
-
const
|
|
792
|
+
const readback2 = device.createBuffer({
|
|
793
793
|
size: input.byteLength,
|
|
794
794
|
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
|
|
795
795
|
});
|
|
@@ -809,16 +809,16 @@ function createGeluKernel(device) {
|
|
|
809
809
|
pass.dispatchWorkgroups(1, 1, 1);
|
|
810
810
|
pass.end();
|
|
811
811
|
}
|
|
812
|
-
encoder.copyBufferToBuffer(outputBuf, 0,
|
|
812
|
+
encoder.copyBufferToBuffer(outputBuf, 0, readback2, 0, input.byteLength);
|
|
813
813
|
device.queue.submit([encoder.finish()]);
|
|
814
|
-
await
|
|
815
|
-
const bytes =
|
|
814
|
+
await readback2.mapAsync(GPUMapMode.READ);
|
|
815
|
+
const bytes = readback2.getMappedRange();
|
|
816
816
|
const out = new Float32Array(bytes.slice(0));
|
|
817
|
-
|
|
817
|
+
readback2.unmap();
|
|
818
818
|
inputBuf.destroy();
|
|
819
819
|
outputBuf.destroy();
|
|
820
820
|
paramsBuf.destroy();
|
|
821
|
-
|
|
821
|
+
readback2.destroy();
|
|
822
822
|
return out;
|
|
823
823
|
}
|
|
824
824
|
};
|
|
@@ -831,6 +831,7 @@ var NUM_HEADS = 4;
|
|
|
831
831
|
var HEAD_DIM = 8;
|
|
832
832
|
var PATCH_LEN = MICRO * MICRO * 3;
|
|
833
833
|
var weightCache = /* @__PURE__ */ new Map();
|
|
834
|
+
var weightBlobKeyCache = /* @__PURE__ */ new WeakMap();
|
|
834
835
|
function hashConfigSeed(config) {
|
|
835
836
|
let h = config.seed >>> 0;
|
|
836
837
|
const s = config.modelHash || "";
|
|
@@ -854,7 +855,99 @@ function fillGaussian2D(out, rng, scale) {
|
|
|
854
855
|
function microWeightKey(config) {
|
|
855
856
|
return `${config.seed}\0${config.modelHash || ""}`;
|
|
856
857
|
}
|
|
858
|
+
var MICRO_WEIGHT_MAGIC = [72, 77, 87, 49];
|
|
859
|
+
var MICRO_WEIGHT_VERSION = 1;
|
|
860
|
+
var MICRO_WEIGHT_FLOATS = EMBED_DIM * PATCH_LEN + // proj
|
|
861
|
+
3 * EMBED_DIM * EMBED_DIM + // Wq, Wk, Wv
|
|
862
|
+
EMBED_DIM * 3 + // Wxyz
|
|
863
|
+
4 * EMBED_DIM;
|
|
864
|
+
var MICRO_WEIGHT_BYTES = 8 + MICRO_WEIGHT_FLOATS * 4;
|
|
865
|
+
function toUint8(bytes) {
|
|
866
|
+
return bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
867
|
+
}
|
|
868
|
+
function fnv1a(bytes) {
|
|
869
|
+
let h = 2166136261;
|
|
870
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
871
|
+
h ^= bytes[i];
|
|
872
|
+
h = Math.imul(h, 16777619);
|
|
873
|
+
}
|
|
874
|
+
return (h >>> 0).toString(16);
|
|
875
|
+
}
|
|
876
|
+
function cachedWeightBlobKey(input) {
|
|
877
|
+
const bytes = toUint8(input);
|
|
878
|
+
const cached = weightBlobKeyCache.get(input);
|
|
879
|
+
if (cached) return { bytes, key: cached };
|
|
880
|
+
const key = `${bytes.byteLength}:${fnv1a(bytes)}`;
|
|
881
|
+
weightBlobKeyCache.set(input, key);
|
|
882
|
+
return { bytes, key };
|
|
883
|
+
}
|
|
884
|
+
function serializeMicroWeights(w) {
|
|
885
|
+
const bytes = new Uint8Array(MICRO_WEIGHT_BYTES);
|
|
886
|
+
bytes.set(MICRO_WEIGHT_MAGIC, 0);
|
|
887
|
+
const view = new DataView(bytes.buffer);
|
|
888
|
+
view.setUint32(4, MICRO_WEIGHT_VERSION, true);
|
|
889
|
+
let off = 8;
|
|
890
|
+
const put = (arr) => {
|
|
891
|
+
for (let i = 0; i < arr.length; i += 1) {
|
|
892
|
+
view.setFloat32(off, arr[i], true);
|
|
893
|
+
off += 4;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
put(w.proj);
|
|
897
|
+
put(w.Wq);
|
|
898
|
+
put(w.Wk);
|
|
899
|
+
put(w.Wv);
|
|
900
|
+
put(w.Wxyz);
|
|
901
|
+
put(w.gamma1);
|
|
902
|
+
put(w.beta1);
|
|
903
|
+
put(w.gamma2);
|
|
904
|
+
put(w.beta2);
|
|
905
|
+
return bytes;
|
|
906
|
+
}
|
|
907
|
+
function deserializeMicroWeights(input) {
|
|
908
|
+
const bytes = toUint8(input);
|
|
909
|
+
if (bytes.byteLength !== MICRO_WEIGHT_BYTES) return null;
|
|
910
|
+
for (let i = 0; i < 4; i += 1) {
|
|
911
|
+
if (bytes[i] !== MICRO_WEIGHT_MAGIC[i]) return null;
|
|
912
|
+
}
|
|
913
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
914
|
+
if (view.getUint32(4, true) !== MICRO_WEIGHT_VERSION) return null;
|
|
915
|
+
let off = 8;
|
|
916
|
+
const take = (count) => {
|
|
917
|
+
const out = new Float32Array(count);
|
|
918
|
+
for (let i = 0; i < count; i += 1) {
|
|
919
|
+
out[i] = view.getFloat32(off, true);
|
|
920
|
+
off += 4;
|
|
921
|
+
}
|
|
922
|
+
return out;
|
|
923
|
+
};
|
|
924
|
+
return {
|
|
925
|
+
proj: take(EMBED_DIM * PATCH_LEN),
|
|
926
|
+
Wq: take(EMBED_DIM * EMBED_DIM),
|
|
927
|
+
Wk: take(EMBED_DIM * EMBED_DIM),
|
|
928
|
+
Wv: take(EMBED_DIM * EMBED_DIM),
|
|
929
|
+
Wxyz: take(EMBED_DIM * 3),
|
|
930
|
+
gamma1: take(EMBED_DIM),
|
|
931
|
+
beta1: take(EMBED_DIM),
|
|
932
|
+
gamma2: take(EMBED_DIM),
|
|
933
|
+
beta2: take(EMBED_DIM)
|
|
934
|
+
};
|
|
935
|
+
}
|
|
857
936
|
function getMicroWeights(config) {
|
|
937
|
+
if (config.weightBytes) {
|
|
938
|
+
const { bytes: wb, key: blobKey } = cachedWeightBlobKey(config.weightBytes);
|
|
939
|
+
const ckptKey = `${microWeightKey(config)}\0ckpt:${blobKey}`;
|
|
940
|
+
const cachedReal = weightCache.get(ckptKey);
|
|
941
|
+
if (cachedReal) return cachedReal;
|
|
942
|
+
const real = deserializeMicroWeights(wb);
|
|
943
|
+
if (real) {
|
|
944
|
+
weightCache.set(ckptKey, real);
|
|
945
|
+
return real;
|
|
946
|
+
}
|
|
947
|
+
console.warn(
|
|
948
|
+
`[holoMapMicroEncoder] weightBytes present (${wb.byteLength} B) but not a valid HMW1 checkpoint (expected ${MICRO_WEIGHT_BYTES} B + magic) \u2014 falling back to PRNG-synthesized weights.`
|
|
949
|
+
);
|
|
950
|
+
}
|
|
858
951
|
const key = microWeightKey(config);
|
|
859
952
|
const cached = weightCache.get(key);
|
|
860
953
|
if (cached) return cached;
|
|
@@ -1447,6 +1540,615 @@ async function putCachedWeightBlob(weightCid, value) {
|
|
|
1447
1540
|
}
|
|
1448
1541
|
}
|
|
1449
1542
|
|
|
1543
|
+
// src/reconstruction/holoMapAnchoredManifest.ts
|
|
1544
|
+
function mergeAnchoredProvenance(manifest, urls) {
|
|
1545
|
+
return {
|
|
1546
|
+
...manifest,
|
|
1547
|
+
provenance: {
|
|
1548
|
+
...manifest.provenance,
|
|
1549
|
+
anchorHash: urls.anchorHash,
|
|
1550
|
+
opentimestampsProof: urls.opentimestampsProof,
|
|
1551
|
+
baseCalldataTx: urls.baseCalldataTx,
|
|
1552
|
+
capturedAtIso: manifest.provenance.capturedAtIso
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
function stripAnchoredProvenance(manifest) {
|
|
1557
|
+
return {
|
|
1558
|
+
...manifest,
|
|
1559
|
+
provenance: {
|
|
1560
|
+
capturedAtIso: manifest.provenance.capturedAtIso
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function selfAttestReconstructionManifest(manifest) {
|
|
1565
|
+
const stripped = stripAnchoredProvenance(manifest);
|
|
1566
|
+
return {
|
|
1567
|
+
...stripped,
|
|
1568
|
+
provenance: {
|
|
1569
|
+
...stripped.provenance,
|
|
1570
|
+
anchorHash: `self-attested:${stripped.replayHash}`
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
async function computeReconstructionManifestDigest(manifest) {
|
|
1575
|
+
const canonical = stableStringify(stripAnchoredProvenance(manifest));
|
|
1576
|
+
return `sha256:${await sha256Hex(canonical)}`;
|
|
1577
|
+
}
|
|
1578
|
+
async function anchorReconstructionManifest(manifest, provider) {
|
|
1579
|
+
const stripped = stripAnchoredProvenance(manifest);
|
|
1580
|
+
if (!provider) return selfAttestReconstructionManifest(stripped);
|
|
1581
|
+
const manifestDigest = await computeReconstructionManifestDigest(stripped);
|
|
1582
|
+
const urls = await provider.anchorManifest({
|
|
1583
|
+
manifestDigest,
|
|
1584
|
+
replayHash: stripped.replayHash,
|
|
1585
|
+
replayFingerprint: stripped.simulationContract.replayFingerprint,
|
|
1586
|
+
capturedAtIso: stripped.provenance.capturedAtIso,
|
|
1587
|
+
manifest: stripped
|
|
1588
|
+
});
|
|
1589
|
+
if (!urls) return selfAttestReconstructionManifest(stripped);
|
|
1590
|
+
return mergeAnchoredProvenance(stripped, urls);
|
|
1591
|
+
}
|
|
1592
|
+
function stableStringify(value) {
|
|
1593
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
1594
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
1595
|
+
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([a], [b]) => a.localeCompare(b));
|
|
1596
|
+
return `{${entries.map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
1597
|
+
}
|
|
1598
|
+
async function sha256Hex(input) {
|
|
1599
|
+
const bytes = new TextEncoder().encode(input);
|
|
1600
|
+
const subtle = globalThis.crypto?.subtle;
|
|
1601
|
+
if (subtle) {
|
|
1602
|
+
const digest = await subtle.digest("SHA-256", bytes);
|
|
1603
|
+
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
1604
|
+
}
|
|
1605
|
+
const { createHash } = await import('crypto');
|
|
1606
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// src/reconstruction/pagedKVKernels.ts
|
|
1610
|
+
var WGSL_PAGED_KV_APPEND = `
|
|
1611
|
+
struct AppendParams {
|
|
1612
|
+
numVecs: u32, // number of NEW vectors to append
|
|
1613
|
+
headDim: u32, // dimension of each vector
|
|
1614
|
+
pageSize: u32, // vectors per page
|
|
1615
|
+
}
|
|
1616
|
+
// kv_pages: flat storage for all pages. page p, slot s, dim d:
|
|
1617
|
+
// index = pageTable[p] * pageSize * headDim + s * headDim + d
|
|
1618
|
+
@group(0) @binding(0) var<storage, read> newVecs: array<f32>; // [numVecs * headDim]
|
|
1619
|
+
@group(0) @binding(1) var<storage, read> pageTable: array<u32>; // logical page \u2192 base offset in kv_pages (in elements)
|
|
1620
|
+
@group(0) @binding(2) var<storage, read> slotMap: array<u32>; // per-vector: (logicalPage << 16 | slotInPage)
|
|
1621
|
+
@group(0) @binding(3) var<storage, read_write> kvPages: array<f32>; // output KV store
|
|
1622
|
+
@group(0) @binding(4) var<uniform> p: AppendParams;
|
|
1623
|
+
@compute @workgroup_size(64, 1, 1)
|
|
1624
|
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
1625
|
+
// gid.x spans numVecs * headDim
|
|
1626
|
+
let total = p.numVecs * p.headDim;
|
|
1627
|
+
if (gid.x >= total) { return; }
|
|
1628
|
+
let vecIdx = gid.x / p.headDim;
|
|
1629
|
+
let dimIdx = gid.x % p.headDim;
|
|
1630
|
+
let slot = slotMap[vecIdx];
|
|
1631
|
+
let logPage = slot >> 16u;
|
|
1632
|
+
let inPage = slot & 0xFFFFu;
|
|
1633
|
+
let base = pageTable[logPage] * p.pageSize * p.headDim;
|
|
1634
|
+
kvPages[base + inPage * p.headDim + dimIdx] = newVecs[vecIdx * p.headDim + dimIdx];
|
|
1635
|
+
}
|
|
1636
|
+
`;
|
|
1637
|
+
var WGSL_PAGED_KV_LOOKUP = `
|
|
1638
|
+
struct LookupParams {
|
|
1639
|
+
numVecs: u32, // number of vectors to read
|
|
1640
|
+
headDim: u32,
|
|
1641
|
+
pageSize: u32,
|
|
1642
|
+
startSlot: u32, // logical first slot (token offset)
|
|
1643
|
+
}
|
|
1644
|
+
@group(0) @binding(0) var<storage, read> kvPages: array<f32>;
|
|
1645
|
+
@group(0) @binding(1) var<storage, read> pageTable: array<u32>; // logical page \u2192 base offset (in elements)
|
|
1646
|
+
@group(0) @binding(2) var<storage, read_write> out: array<f32>; // [numVecs * headDim]
|
|
1647
|
+
@group(0) @binding(3) var<uniform> p: LookupParams;
|
|
1648
|
+
@compute @workgroup_size(64, 1, 1)
|
|
1649
|
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
1650
|
+
let total = p.numVecs * p.headDim;
|
|
1651
|
+
if (gid.x >= total) { return; }
|
|
1652
|
+
let vecIdx = gid.x / p.headDim;
|
|
1653
|
+
let dimIdx = gid.x % p.headDim;
|
|
1654
|
+
let logSlot = (vecIdx + p.startSlot);
|
|
1655
|
+
let logPage = logSlot / p.pageSize;
|
|
1656
|
+
let inPage = logSlot % p.pageSize;
|
|
1657
|
+
let base = pageTable[logPage] * p.pageSize * p.headDim;
|
|
1658
|
+
out[gid.x] = kvPages[base + inPage * p.headDim + dimIdx];
|
|
1659
|
+
}
|
|
1660
|
+
`;
|
|
1661
|
+
function storageBuffer4(device, data) {
|
|
1662
|
+
const buf = device.createBuffer({
|
|
1663
|
+
size: data.byteLength,
|
|
1664
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST
|
|
1665
|
+
});
|
|
1666
|
+
device.queue.writeBuffer(buf, 0, data.buffer, data.byteOffset, data.byteLength);
|
|
1667
|
+
return buf;
|
|
1668
|
+
}
|
|
1669
|
+
function outputBuffer(device, bytes) {
|
|
1670
|
+
return device.createBuffer({
|
|
1671
|
+
size: bytes,
|
|
1672
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
function uniformBuffer(device, data) {
|
|
1676
|
+
const buf = device.createBuffer({
|
|
1677
|
+
size: data.byteLength,
|
|
1678
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
1679
|
+
});
|
|
1680
|
+
device.queue.writeBuffer(buf, 0, data);
|
|
1681
|
+
return buf;
|
|
1682
|
+
}
|
|
1683
|
+
async function readback(device, src, bytes) {
|
|
1684
|
+
const staging = device.createBuffer({
|
|
1685
|
+
size: bytes,
|
|
1686
|
+
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
|
|
1687
|
+
});
|
|
1688
|
+
const enc = device.createCommandEncoder();
|
|
1689
|
+
enc.copyBufferToBuffer(src, 0, staging, 0, bytes);
|
|
1690
|
+
device.queue.submit([enc.finish()]);
|
|
1691
|
+
await staging.mapAsync(GPUMapMode.READ);
|
|
1692
|
+
const result = new Float32Array(staging.getMappedRange().slice(0));
|
|
1693
|
+
staging.unmap();
|
|
1694
|
+
staging.destroy();
|
|
1695
|
+
return result;
|
|
1696
|
+
}
|
|
1697
|
+
function createPagedKVAppendKernel(device) {
|
|
1698
|
+
const shader = device.createShaderModule({ code: WGSL_PAGED_KV_APPEND });
|
|
1699
|
+
const pipeline = device.createComputePipeline({
|
|
1700
|
+
layout: "auto",
|
|
1701
|
+
compute: { module: shader, entryPoint: "main" }
|
|
1702
|
+
});
|
|
1703
|
+
return {
|
|
1704
|
+
async run(kvPagesData, pageTableData, slotMapData, newVectors, pageSize, headDim) {
|
|
1705
|
+
const numVecs = newVectors.length / headDim;
|
|
1706
|
+
const kvBuf = device.createBuffer({
|
|
1707
|
+
size: kvPagesData.byteLength,
|
|
1708
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC
|
|
1709
|
+
});
|
|
1710
|
+
device.queue.writeBuffer(
|
|
1711
|
+
kvBuf,
|
|
1712
|
+
0,
|
|
1713
|
+
kvPagesData.buffer,
|
|
1714
|
+
kvPagesData.byteOffset,
|
|
1715
|
+
kvPagesData.byteLength
|
|
1716
|
+
);
|
|
1717
|
+
const newVecsBuf = storageBuffer4(device, newVectors);
|
|
1718
|
+
const pageTableBuf = storageBuffer4(device, pageTableData);
|
|
1719
|
+
const slotMapBuf = storageBuffer4(device, slotMapData);
|
|
1720
|
+
const paramAB = new ArrayBuffer(16);
|
|
1721
|
+
new Uint32Array(paramAB)[0] = numVecs;
|
|
1722
|
+
new Uint32Array(paramAB)[1] = headDim;
|
|
1723
|
+
new Uint32Array(paramAB)[2] = pageSize;
|
|
1724
|
+
const paramsBuf = uniformBuffer(device, paramAB);
|
|
1725
|
+
const bg = device.createBindGroup({
|
|
1726
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
1727
|
+
entries: [
|
|
1728
|
+
{ binding: 0, resource: { buffer: newVecsBuf } },
|
|
1729
|
+
{ binding: 1, resource: { buffer: pageTableBuf } },
|
|
1730
|
+
{ binding: 2, resource: { buffer: slotMapBuf } },
|
|
1731
|
+
{ binding: 3, resource: { buffer: kvBuf } },
|
|
1732
|
+
{ binding: 4, resource: { buffer: paramsBuf } }
|
|
1733
|
+
]
|
|
1734
|
+
});
|
|
1735
|
+
const total = numVecs * headDim;
|
|
1736
|
+
const workgroups = Math.ceil(total / 64);
|
|
1737
|
+
const enc = device.createCommandEncoder();
|
|
1738
|
+
const pass = enc.beginComputePass();
|
|
1739
|
+
pass.setPipeline(pipeline);
|
|
1740
|
+
pass.setBindGroup(0, bg);
|
|
1741
|
+
pass.dispatchWorkgroups(workgroups);
|
|
1742
|
+
pass.end();
|
|
1743
|
+
device.queue.submit([enc.finish()]);
|
|
1744
|
+
const result = await readback(device, kvBuf, kvPagesData.byteLength);
|
|
1745
|
+
newVecsBuf.destroy();
|
|
1746
|
+
pageTableBuf.destroy();
|
|
1747
|
+
slotMapBuf.destroy();
|
|
1748
|
+
kvBuf.destroy();
|
|
1749
|
+
paramsBuf.destroy();
|
|
1750
|
+
return result;
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
function createPagedKVLookupKernel(device) {
|
|
1755
|
+
const shader = device.createShaderModule({ code: WGSL_PAGED_KV_LOOKUP });
|
|
1756
|
+
const pipeline = device.createComputePipeline({
|
|
1757
|
+
layout: "auto",
|
|
1758
|
+
compute: { module: shader, entryPoint: "main" }
|
|
1759
|
+
});
|
|
1760
|
+
return {
|
|
1761
|
+
async run(kvPagesData, pageTableData, numVecs, startSlot, pageSize, headDim) {
|
|
1762
|
+
const outBytes = numVecs * headDim * 4;
|
|
1763
|
+
const kvBuf = storageBuffer4(device, kvPagesData);
|
|
1764
|
+
const pageTableBuf = storageBuffer4(device, pageTableData);
|
|
1765
|
+
const outBuf = outputBuffer(device, outBytes);
|
|
1766
|
+
const paramAB = new ArrayBuffer(16);
|
|
1767
|
+
const pu = new Uint32Array(paramAB);
|
|
1768
|
+
pu[0] = numVecs;
|
|
1769
|
+
pu[1] = headDim;
|
|
1770
|
+
pu[2] = pageSize;
|
|
1771
|
+
pu[3] = startSlot;
|
|
1772
|
+
const paramsBuf = uniformBuffer(device, paramAB);
|
|
1773
|
+
const bg = device.createBindGroup({
|
|
1774
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
1775
|
+
entries: [
|
|
1776
|
+
{ binding: 0, resource: { buffer: kvBuf } },
|
|
1777
|
+
{ binding: 1, resource: { buffer: pageTableBuf } },
|
|
1778
|
+
{ binding: 2, resource: { buffer: outBuf } },
|
|
1779
|
+
{ binding: 3, resource: { buffer: paramsBuf } }
|
|
1780
|
+
]
|
|
1781
|
+
});
|
|
1782
|
+
const total = numVecs * headDim;
|
|
1783
|
+
const enc = device.createCommandEncoder();
|
|
1784
|
+
const pass = enc.beginComputePass();
|
|
1785
|
+
pass.setPipeline(pipeline);
|
|
1786
|
+
pass.setBindGroup(0, bg);
|
|
1787
|
+
pass.dispatchWorkgroups(Math.ceil(total / 64));
|
|
1788
|
+
pass.end();
|
|
1789
|
+
device.queue.submit([enc.finish()]);
|
|
1790
|
+
const result = await readback(device, outBuf, outBytes);
|
|
1791
|
+
kvBuf.destroy();
|
|
1792
|
+
pageTableBuf.destroy();
|
|
1793
|
+
outBuf.destroy();
|
|
1794
|
+
paramsBuf.destroy();
|
|
1795
|
+
return result;
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// src/reconstruction/PagedKVCache.ts
|
|
1801
|
+
var PAGE_TABLE_EMPTY = 4294967295;
|
|
1802
|
+
function createPagedKVCache(config) {
|
|
1803
|
+
validateConfig(config);
|
|
1804
|
+
const layers = Array.from({ length: config.numLayers }, () => ({
|
|
1805
|
+
pages: /* @__PURE__ */ new Map(),
|
|
1806
|
+
nextToken: 0
|
|
1807
|
+
}));
|
|
1808
|
+
const pageBytes = config.pageSize * config.hiddenDim * Float32Array.BYTES_PER_ELEMENT;
|
|
1809
|
+
const keyPages = new Float32Array(config.maxResidentPages * config.pageSize * config.hiddenDim);
|
|
1810
|
+
const valuePages = new Float32Array(config.maxResidentPages * config.pageSize * config.hiddenDim);
|
|
1811
|
+
const freePhysicalPages = Array.from({ length: config.maxResidentPages }, (_, i) => i).reverse();
|
|
1812
|
+
const appendKernel = config.device ? createPagedKVAppendKernel(config.device) : null;
|
|
1813
|
+
const lookupKernel = config.device ? createPagedKVLookupKernel(config.device) : null;
|
|
1814
|
+
let disposed = false;
|
|
1815
|
+
let nextPageId = 0;
|
|
1816
|
+
let accessClock = 0;
|
|
1817
|
+
function assertLive() {
|
|
1818
|
+
if (disposed) throw new Error("PagedKVCache has been disposed.");
|
|
1819
|
+
}
|
|
1820
|
+
function validateLayer(layer) {
|
|
1821
|
+
if (!Number.isInteger(layer) || layer < 0 || layer >= config.numLayers) {
|
|
1822
|
+
throw new Error(`PagedKVCache layer ${layer} out of range 0..${config.numLayers - 1}`);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
function pageSnapshot(page) {
|
|
1826
|
+
return {
|
|
1827
|
+
pageId: page.pageId,
|
|
1828
|
+
layer: page.layer,
|
|
1829
|
+
residency: page.residency,
|
|
1830
|
+
firstToken: page.firstToken,
|
|
1831
|
+
lastToken: page.lastToken
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function pageOffset(physicalPage) {
|
|
1835
|
+
return physicalPage * config.pageSize * config.hiddenDim;
|
|
1836
|
+
}
|
|
1837
|
+
function copyResidentPage(page, keys, values) {
|
|
1838
|
+
if (page.physicalPage === null) return;
|
|
1839
|
+
const offset = pageOffset(page.physicalPage);
|
|
1840
|
+
const end = offset + config.pageSize * config.hiddenDim;
|
|
1841
|
+
keys.set(keyPages.subarray(offset, end));
|
|
1842
|
+
values.set(valuePages.subarray(offset, end));
|
|
1843
|
+
}
|
|
1844
|
+
function zeroPhysicalPage(physicalPage) {
|
|
1845
|
+
const offset = pageOffset(physicalPage);
|
|
1846
|
+
const end = offset + config.pageSize * config.hiddenDim;
|
|
1847
|
+
keyPages.fill(0, offset, end);
|
|
1848
|
+
valuePages.fill(0, offset, end);
|
|
1849
|
+
}
|
|
1850
|
+
function residentPages() {
|
|
1851
|
+
return layers.flatMap(
|
|
1852
|
+
(layer) => Array.from(layer.pages.values()).filter((page) => page.residency === "device")
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
function evictPage(page) {
|
|
1856
|
+
if (page.physicalPage === null) return pageSnapshot(page);
|
|
1857
|
+
const hostKeys = new Float32Array(config.pageSize * config.hiddenDim);
|
|
1858
|
+
const hostValues = new Float32Array(config.pageSize * config.hiddenDim);
|
|
1859
|
+
copyResidentPage(page, hostKeys, hostValues);
|
|
1860
|
+
zeroPhysicalPage(page.physicalPage);
|
|
1861
|
+
freePhysicalPages.push(page.physicalPage);
|
|
1862
|
+
page.physicalPage = null;
|
|
1863
|
+
page.hostKeys = hostKeys;
|
|
1864
|
+
page.hostValues = hostValues;
|
|
1865
|
+
page.residency = "host";
|
|
1866
|
+
return pageSnapshot(page);
|
|
1867
|
+
}
|
|
1868
|
+
function evictOldestInternal(count, protectedPage) {
|
|
1869
|
+
if (count <= 0) return [];
|
|
1870
|
+
const victims = residentPages().filter((page) => page !== protectedPage).sort((a, b) => a.lastAccess - b.lastAccess).slice(0, count);
|
|
1871
|
+
return victims.map((page) => evictPage(page));
|
|
1872
|
+
}
|
|
1873
|
+
function allocatePhysicalPage(protectedPage) {
|
|
1874
|
+
if (freePhysicalPages.length === 0) {
|
|
1875
|
+
evictOldestInternal(1, protectedPage);
|
|
1876
|
+
}
|
|
1877
|
+
const physicalPage = freePhysicalPages.pop();
|
|
1878
|
+
if (physicalPage === void 0) {
|
|
1879
|
+
throw new Error("PagedKVCache could not allocate a resident page.");
|
|
1880
|
+
}
|
|
1881
|
+
zeroPhysicalPage(physicalPage);
|
|
1882
|
+
return physicalPage;
|
|
1883
|
+
}
|
|
1884
|
+
function ensurePageResident(page) {
|
|
1885
|
+
if (page.residency === "device" && page.physicalPage !== null) {
|
|
1886
|
+
page.lastAccess = ++accessClock;
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
const physicalPage = allocatePhysicalPage(page);
|
|
1890
|
+
page.physicalPage = physicalPage;
|
|
1891
|
+
page.residency = "device";
|
|
1892
|
+
page.lastAccess = ++accessClock;
|
|
1893
|
+
if (page.hostKeys) {
|
|
1894
|
+
keyPages.set(page.hostKeys, pageOffset(physicalPage));
|
|
1895
|
+
page.hostKeys = void 0;
|
|
1896
|
+
}
|
|
1897
|
+
if (page.hostValues) {
|
|
1898
|
+
valuePages.set(page.hostValues, pageOffset(physicalPage));
|
|
1899
|
+
page.hostValues = void 0;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
function allocatePageInternal(layer, logicalPage) {
|
|
1903
|
+
const layerState = layers[layer];
|
|
1904
|
+
const existing = layerState.pages.get(logicalPage);
|
|
1905
|
+
if (existing) {
|
|
1906
|
+
ensurePageResident(existing);
|
|
1907
|
+
return existing;
|
|
1908
|
+
}
|
|
1909
|
+
const physicalPage = allocatePhysicalPage();
|
|
1910
|
+
const page = {
|
|
1911
|
+
pageId: nextPageId++,
|
|
1912
|
+
logicalPage,
|
|
1913
|
+
layer,
|
|
1914
|
+
residency: "device",
|
|
1915
|
+
firstToken: logicalPage * config.pageSize,
|
|
1916
|
+
lastToken: logicalPage * config.pageSize + config.pageSize - 1,
|
|
1917
|
+
physicalPage,
|
|
1918
|
+
lastAccess: ++accessClock
|
|
1919
|
+
};
|
|
1920
|
+
layerState.pages.set(logicalPage, page);
|
|
1921
|
+
return page;
|
|
1922
|
+
}
|
|
1923
|
+
function buildPageTable(layer, logicalPages) {
|
|
1924
|
+
const requiredPages = Array.from(new Set(logicalPages)).sort((a, b) => a - b);
|
|
1925
|
+
const maxLogicalPage = requiredPages[requiredPages.length - 1] ?? 0;
|
|
1926
|
+
const pageTable = new Uint32Array(maxLogicalPage + 1);
|
|
1927
|
+
pageTable.fill(PAGE_TABLE_EMPTY);
|
|
1928
|
+
const layerState = layers[layer];
|
|
1929
|
+
for (const logicalPage of requiredPages) {
|
|
1930
|
+
const page = layerState.pages.get(logicalPage);
|
|
1931
|
+
if (page) {
|
|
1932
|
+
ensurePageResident(page);
|
|
1933
|
+
pageTable[logicalPage] = page.physicalPage ?? PAGE_TABLE_EMPTY;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
return pageTable;
|
|
1937
|
+
}
|
|
1938
|
+
function appendCpu(pages, pageTable, slotMap, vectors) {
|
|
1939
|
+
const out = new Float32Array(pages);
|
|
1940
|
+
const numVecs = vectors.length / config.hiddenDim;
|
|
1941
|
+
for (let v = 0; v < numVecs; v += 1) {
|
|
1942
|
+
const logicalPage = slotMap[v] >>> 16;
|
|
1943
|
+
const inPage = slotMap[v] & 65535;
|
|
1944
|
+
const physicalPage = pageTable[logicalPage];
|
|
1945
|
+
const base = physicalPage * config.pageSize * config.hiddenDim;
|
|
1946
|
+
for (let d = 0; d < config.hiddenDim; d += 1) {
|
|
1947
|
+
out[base + inPage * config.hiddenDim + d] = vectors[v * config.hiddenDim + d];
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return out;
|
|
1951
|
+
}
|
|
1952
|
+
function lookupCpu(pages, pageTable, tokenCount, startToken) {
|
|
1953
|
+
const out = new Float32Array(tokenCount * config.hiddenDim);
|
|
1954
|
+
for (let v = 0; v < tokenCount; v += 1) {
|
|
1955
|
+
const logicalSlot = startToken + v;
|
|
1956
|
+
const logicalPage = Math.floor(logicalSlot / config.pageSize);
|
|
1957
|
+
const inPage = logicalSlot % config.pageSize;
|
|
1958
|
+
const physicalPage = pageTable[logicalPage];
|
|
1959
|
+
const base = physicalPage * config.pageSize * config.hiddenDim;
|
|
1960
|
+
for (let d = 0; d < config.hiddenDim; d += 1) {
|
|
1961
|
+
out[v * config.hiddenDim + d] = pages[base + inPage * config.hiddenDim + d];
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
return out;
|
|
1965
|
+
}
|
|
1966
|
+
return {
|
|
1967
|
+
config,
|
|
1968
|
+
allocatePage(layer, firstToken) {
|
|
1969
|
+
assertLive();
|
|
1970
|
+
validateLayer(layer);
|
|
1971
|
+
if (!Number.isInteger(firstToken) || firstToken < 0) {
|
|
1972
|
+
throw new Error(`PagedKVCache firstToken must be a non-negative integer, got ${firstToken}`);
|
|
1973
|
+
}
|
|
1974
|
+
const logicalPage = Math.floor(firstToken / config.pageSize);
|
|
1975
|
+
return pageSnapshot(allocatePageInternal(layer, logicalPage));
|
|
1976
|
+
},
|
|
1977
|
+
residentPagesForLayer(layer) {
|
|
1978
|
+
assertLive();
|
|
1979
|
+
validateLayer(layer);
|
|
1980
|
+
return Array.from(layers[layer].pages.values()).filter((page) => page.residency === "device").sort((a, b) => a.firstToken - b.firstToken).map((page) => pageSnapshot(page));
|
|
1981
|
+
},
|
|
1982
|
+
evictOldest(count) {
|
|
1983
|
+
assertLive();
|
|
1984
|
+
if (!Number.isInteger(count) || count < 0) {
|
|
1985
|
+
throw new Error(`PagedKVCache evict count must be a non-negative integer, got ${count}`);
|
|
1986
|
+
}
|
|
1987
|
+
return evictOldestInternal(count);
|
|
1988
|
+
},
|
|
1989
|
+
memoryUsage() {
|
|
1990
|
+
assertLive();
|
|
1991
|
+
let devicePages = 0;
|
|
1992
|
+
let hostPages = 0;
|
|
1993
|
+
for (const layer of layers) {
|
|
1994
|
+
for (const page of layer.pages.values()) {
|
|
1995
|
+
if (page.residency === "device") devicePages += 1;
|
|
1996
|
+
if (page.residency === "host") hostPages += 1;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
return {
|
|
2000
|
+
device: devicePages * pageBytes * 2,
|
|
2001
|
+
host: hostPages * pageBytes * 2
|
|
2002
|
+
};
|
|
2003
|
+
},
|
|
2004
|
+
async dispose() {
|
|
2005
|
+
disposed = true;
|
|
2006
|
+
for (const layer of layers) layer.pages.clear();
|
|
2007
|
+
freePhysicalPages.length = 0;
|
|
2008
|
+
},
|
|
2009
|
+
async append(layer, keyVectors, valueVectors = keyVectors, firstToken) {
|
|
2010
|
+
assertLive();
|
|
2011
|
+
validateLayer(layer);
|
|
2012
|
+
if (keyVectors.length !== valueVectors.length) {
|
|
2013
|
+
throw new Error("PagedKVCache append requires key/value vectors with equal length.");
|
|
2014
|
+
}
|
|
2015
|
+
if (keyVectors.length % config.hiddenDim !== 0) {
|
|
2016
|
+
throw new Error(
|
|
2017
|
+
`PagedKVCache append vector length ${keyVectors.length} is not divisible by hiddenDim=${config.hiddenDim}`
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
const tokenCount = keyVectors.length / config.hiddenDim;
|
|
2021
|
+
if (tokenCount === 0) return [];
|
|
2022
|
+
const startToken = firstToken ?? layers[layer].nextToken;
|
|
2023
|
+
if (!Number.isInteger(startToken) || startToken < 0) {
|
|
2024
|
+
throw new Error(`PagedKVCache append firstToken must be non-negative, got ${startToken}`);
|
|
2025
|
+
}
|
|
2026
|
+
const touchedPages = /* @__PURE__ */ new Map();
|
|
2027
|
+
const slotMap = new Uint32Array(tokenCount);
|
|
2028
|
+
const requiredPages = /* @__PURE__ */ new Set();
|
|
2029
|
+
for (let i = 0; i < tokenCount; i += 1) {
|
|
2030
|
+
const token = startToken + i;
|
|
2031
|
+
const logicalPage = Math.floor(token / config.pageSize);
|
|
2032
|
+
const slot = token % config.pageSize;
|
|
2033
|
+
requiredPages.add(logicalPage);
|
|
2034
|
+
slotMap[i] = logicalPage << 16 | slot;
|
|
2035
|
+
}
|
|
2036
|
+
if (requiredPages.size > config.maxResidentPages) {
|
|
2037
|
+
throw new Error(
|
|
2038
|
+
`PagedKVCache append touches ${requiredPages.size} pages but only ${config.maxResidentPages} can be resident.`
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
for (const logicalPage of requiredPages) {
|
|
2042
|
+
const page = allocatePageInternal(layer, logicalPage);
|
|
2043
|
+
touchedPages.set(logicalPage, page);
|
|
2044
|
+
}
|
|
2045
|
+
const pageTable = buildPageTable(layer, touchedPages.keys());
|
|
2046
|
+
if (appendKernel) {
|
|
2047
|
+
keyPages.set(
|
|
2048
|
+
await appendKernel.run(
|
|
2049
|
+
keyPages,
|
|
2050
|
+
pageTable,
|
|
2051
|
+
slotMap,
|
|
2052
|
+
keyVectors,
|
|
2053
|
+
config.pageSize,
|
|
2054
|
+
config.hiddenDim
|
|
2055
|
+
)
|
|
2056
|
+
);
|
|
2057
|
+
valuePages.set(
|
|
2058
|
+
await appendKernel.run(
|
|
2059
|
+
valuePages,
|
|
2060
|
+
pageTable,
|
|
2061
|
+
slotMap,
|
|
2062
|
+
valueVectors,
|
|
2063
|
+
config.pageSize,
|
|
2064
|
+
config.hiddenDim
|
|
2065
|
+
)
|
|
2066
|
+
);
|
|
2067
|
+
} else {
|
|
2068
|
+
keyPages.set(appendCpu(keyPages, pageTable, slotMap, keyVectors));
|
|
2069
|
+
valuePages.set(appendCpu(valuePages, pageTable, slotMap, valueVectors));
|
|
2070
|
+
}
|
|
2071
|
+
for (const page of touchedPages.values()) page.lastAccess = ++accessClock;
|
|
2072
|
+
layers[layer].nextToken = Math.max(layers[layer].nextToken, startToken + tokenCount);
|
|
2073
|
+
return Array.from(touchedPages.values()).sort((a, b) => a.firstToken - b.firstToken).map((page) => pageSnapshot(page));
|
|
2074
|
+
},
|
|
2075
|
+
async lookup(layer, startToken, tokenCount) {
|
|
2076
|
+
assertLive();
|
|
2077
|
+
validateLayer(layer);
|
|
2078
|
+
if (!Number.isInteger(startToken) || startToken < 0) {
|
|
2079
|
+
throw new Error(`PagedKVCache lookup startToken must be non-negative, got ${startToken}`);
|
|
2080
|
+
}
|
|
2081
|
+
if (!Number.isInteger(tokenCount) || tokenCount < 0) {
|
|
2082
|
+
throw new Error(`PagedKVCache lookup tokenCount must be non-negative, got ${tokenCount}`);
|
|
2083
|
+
}
|
|
2084
|
+
if (tokenCount === 0) {
|
|
2085
|
+
return { keys: new Float32Array(), values: new Float32Array() };
|
|
2086
|
+
}
|
|
2087
|
+
const endToken = startToken + tokenCount - 1;
|
|
2088
|
+
const firstLogicalPage = Math.floor(startToken / config.pageSize);
|
|
2089
|
+
const maxLogicalPage = Math.floor(endToken / config.pageSize);
|
|
2090
|
+
const requiredPages = [];
|
|
2091
|
+
for (let logicalPage = firstLogicalPage; logicalPage <= maxLogicalPage; logicalPage += 1) {
|
|
2092
|
+
const page = layers[layer].pages.get(logicalPage);
|
|
2093
|
+
if (!page) {
|
|
2094
|
+
throw new Error(`PagedKVCache lookup misses layer ${layer} logical page ${logicalPage}.`);
|
|
2095
|
+
}
|
|
2096
|
+
requiredPages.push(logicalPage);
|
|
2097
|
+
}
|
|
2098
|
+
if (requiredPages.length > config.maxResidentPages) {
|
|
2099
|
+
throw new Error(
|
|
2100
|
+
`PagedKVCache lookup needs ${requiredPages.length} pages but only ${config.maxResidentPages} can be resident.`
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2103
|
+
for (const logicalPage of requiredPages) {
|
|
2104
|
+
ensurePageResident(layers[layer].pages.get(logicalPage));
|
|
2105
|
+
}
|
|
2106
|
+
const pageTable = buildPageTable(layer, requiredPages);
|
|
2107
|
+
if (lookupKernel) {
|
|
2108
|
+
return {
|
|
2109
|
+
keys: await lookupKernel.run(
|
|
2110
|
+
keyPages,
|
|
2111
|
+
pageTable,
|
|
2112
|
+
tokenCount,
|
|
2113
|
+
startToken,
|
|
2114
|
+
config.pageSize,
|
|
2115
|
+
config.hiddenDim
|
|
2116
|
+
),
|
|
2117
|
+
values: await lookupKernel.run(
|
|
2118
|
+
valuePages,
|
|
2119
|
+
pageTable,
|
|
2120
|
+
tokenCount,
|
|
2121
|
+
startToken,
|
|
2122
|
+
config.pageSize,
|
|
2123
|
+
config.hiddenDim
|
|
2124
|
+
)
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
return {
|
|
2128
|
+
keys: lookupCpu(keyPages, pageTable, tokenCount, startToken),
|
|
2129
|
+
values: lookupCpu(valuePages, pageTable, tokenCount, startToken)
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
function validateConfig(config) {
|
|
2135
|
+
const fields = [
|
|
2136
|
+
["pageSize", config.pageSize],
|
|
2137
|
+
["maxResidentPages", config.maxResidentPages],
|
|
2138
|
+
["hiddenDim", config.hiddenDim],
|
|
2139
|
+
["numHeads", config.numHeads],
|
|
2140
|
+
["numLayers", config.numLayers]
|
|
2141
|
+
];
|
|
2142
|
+
for (const [field, value] of fields) {
|
|
2143
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
2144
|
+
throw new Error(`PagedKVCache config ${String(field)} must be a positive integer.`);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (config.pageSize > 65535) {
|
|
2148
|
+
throw new Error("PagedKVCache pageSize must fit the 16-bit slot packing used by WGSL kernels.");
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
|
|
1450
2152
|
// src/reconstruction/HoloMapRuntime.ts
|
|
1451
2153
|
var HOLOMAP_DEFAULTS = {
|
|
1452
2154
|
inputResolution: { width: 518, height: 378 },
|
|
@@ -1457,8 +2159,14 @@ var HOLOMAP_DEFAULTS = {
|
|
|
1457
2159
|
tileGrid: 4,
|
|
1458
2160
|
cpuOffload: false,
|
|
1459
2161
|
weightStrategy: "distill",
|
|
2162
|
+
reconstructionMode: "preview",
|
|
1460
2163
|
allowCpuFallback: true
|
|
1461
2164
|
};
|
|
2165
|
+
var HOLOMAP_DENSE_PROOF_DEFAULTS = {
|
|
2166
|
+
...HOLOMAP_DEFAULTS,
|
|
2167
|
+
tileGrid: 16,
|
|
2168
|
+
reconstructionMode: "dense-proof"
|
|
2169
|
+
};
|
|
1462
2170
|
var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
1463
2171
|
constructor() {
|
|
1464
2172
|
this.config = { ...HOLOMAP_DEFAULTS };
|
|
@@ -1470,6 +2178,10 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1470
2178
|
this.microEncoder = null;
|
|
1471
2179
|
/** Loaded weight blob (optional; GPU upload wiring follows R3+). */
|
|
1472
2180
|
this.weightBytes = null;
|
|
2181
|
+
this.weightVerified = false;
|
|
2182
|
+
this.weightSource = null;
|
|
2183
|
+
this.streamingKVCache = null;
|
|
2184
|
+
this.streamingKVNextToken = 0;
|
|
1473
2185
|
// ── Sprint-3 performance / determinism state ──
|
|
1474
2186
|
/** Running bounding box (updated incrementally per step). */
|
|
1475
2187
|
this.boundsMin = [0, 0, 0];
|
|
@@ -1522,6 +2234,131 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1522
2234
|
const v = depth[py * width + px];
|
|
1523
2235
|
return Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0.5;
|
|
1524
2236
|
}
|
|
2237
|
+
static sampleMetricDepthNearestUv(depthMeters, width, height, uv) {
|
|
2238
|
+
const px = Math.min(width - 1, Math.max(0, Math.round(uv[0] * (width - 1))));
|
|
2239
|
+
const py = Math.min(height - 1, Math.max(0, Math.round(uv[1] * (height - 1))));
|
|
2240
|
+
const v = depthMeters[py * width + px];
|
|
2241
|
+
return Number.isFinite(v) && v > 0 ? v : void 0;
|
|
2242
|
+
}
|
|
2243
|
+
static hasUsableIntrinsics(intrinsics) {
|
|
2244
|
+
return !!intrinsics && Number.isFinite(intrinsics.width) && Number.isFinite(intrinsics.height) && Number.isFinite(intrinsics.fx) && Number.isFinite(intrinsics.fy) && Number.isFinite(intrinsics.cx) && Number.isFinite(intrinsics.cy) && intrinsics.width > 0 && intrinsics.height > 0 && intrinsics.fx > 0 && intrinsics.fy > 0;
|
|
2245
|
+
}
|
|
2246
|
+
static normalizeQuaternion(q) {
|
|
2247
|
+
const len = Math.hypot(q[0], q[1], q[2], q[3]);
|
|
2248
|
+
if (len <= 1e-12) return [0, 0, 0, 1];
|
|
2249
|
+
return [q[0] / len, q[1] / len, q[2] / len, q[3] / len];
|
|
2250
|
+
}
|
|
2251
|
+
static rotateByQuaternion(v, q) {
|
|
2252
|
+
const [x, y, z, w] = _HoloMapRuntimeImpl.normalizeQuaternion(q);
|
|
2253
|
+
const [vx, vy, vz] = v;
|
|
2254
|
+
const tx = 2 * (y * vz - z * vy);
|
|
2255
|
+
const ty = 2 * (z * vx - x * vz);
|
|
2256
|
+
const tz = 2 * (x * vy - y * vx);
|
|
2257
|
+
return [
|
|
2258
|
+
vx + w * tx + (y * tz - z * ty),
|
|
2259
|
+
vy + w * ty + (z * tx - x * tz),
|
|
2260
|
+
vz + w * tz + (x * ty - y * tx)
|
|
2261
|
+
];
|
|
2262
|
+
}
|
|
2263
|
+
static projectMetricDepthToWorld(uv, depthMeters, intrinsics, pose) {
|
|
2264
|
+
const pixelX = uv[0] * intrinsics.width;
|
|
2265
|
+
const pixelY = uv[1] * intrinsics.height;
|
|
2266
|
+
const local = [
|
|
2267
|
+
(pixelX - intrinsics.cx) * depthMeters / intrinsics.fx,
|
|
2268
|
+
(intrinsics.cy - pixelY) * depthMeters / intrinsics.fy,
|
|
2269
|
+
-depthMeters
|
|
2270
|
+
];
|
|
2271
|
+
if (!pose) return local;
|
|
2272
|
+
const rotated = _HoloMapRuntimeImpl.rotateByQuaternion(local, pose.rotation);
|
|
2273
|
+
return [
|
|
2274
|
+
pose.position[0] + rotated[0],
|
|
2275
|
+
pose.position[1] + rotated[1],
|
|
2276
|
+
pose.position[2] + rotated[2]
|
|
2277
|
+
];
|
|
2278
|
+
}
|
|
2279
|
+
static fitShiftScaleDepth(samples) {
|
|
2280
|
+
const paired = samples.filter((sample) => sample.metricDepthMeters !== void 0).map((sample) => ({
|
|
2281
|
+
x: sample.rawDepthSignal,
|
|
2282
|
+
y: sample.metricDepthMeters
|
|
2283
|
+
}));
|
|
2284
|
+
if (paired.length === 0) return void 0;
|
|
2285
|
+
let meanX = 0;
|
|
2286
|
+
let meanY = 0;
|
|
2287
|
+
for (const sample of paired) {
|
|
2288
|
+
meanX += sample.x;
|
|
2289
|
+
meanY += sample.y;
|
|
2290
|
+
}
|
|
2291
|
+
meanX /= paired.length;
|
|
2292
|
+
meanY /= paired.length;
|
|
2293
|
+
let varianceX = 0;
|
|
2294
|
+
let covariance = 0;
|
|
2295
|
+
for (const sample of paired) {
|
|
2296
|
+
const dx = sample.x - meanX;
|
|
2297
|
+
varianceX += dx * dx;
|
|
2298
|
+
covariance += dx * (sample.y - meanY);
|
|
2299
|
+
}
|
|
2300
|
+
const scale = varianceX > 1e-12 ? covariance / varianceX : 0;
|
|
2301
|
+
const shift = meanY - scale * meanX;
|
|
2302
|
+
let squared = 0;
|
|
2303
|
+
for (const sample of paired) {
|
|
2304
|
+
const err = scale * sample.x + shift - sample.y;
|
|
2305
|
+
squared += err * err;
|
|
2306
|
+
}
|
|
2307
|
+
return {
|
|
2308
|
+
kind: "shift-scale",
|
|
2309
|
+
sampleCount: paired.length,
|
|
2310
|
+
scale,
|
|
2311
|
+
shift,
|
|
2312
|
+
rmseMeters: Math.sqrt(squared / paired.length)
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
static alignedDepthMeters(sample, fit) {
|
|
2316
|
+
if (fit) {
|
|
2317
|
+
const aligned = fit.scale * sample.rawDepthSignal + fit.shift;
|
|
2318
|
+
if (Number.isFinite(aligned) && aligned > 0) return aligned;
|
|
2319
|
+
}
|
|
2320
|
+
return sample.metricDepthMeters;
|
|
2321
|
+
}
|
|
2322
|
+
static buildLoopClosureDescriptor(samples) {
|
|
2323
|
+
if (samples.length === 0) return new Float32Array([0, 0, 0, 0, 0, 0]);
|
|
2324
|
+
let r = 0;
|
|
2325
|
+
let g = 0;
|
|
2326
|
+
let b = 0;
|
|
2327
|
+
let luma = 0;
|
|
2328
|
+
let texture = 0;
|
|
2329
|
+
let depth = 0;
|
|
2330
|
+
let depthCount = 0;
|
|
2331
|
+
for (const sample of samples) {
|
|
2332
|
+
r += sample.meanColor[0] / 255;
|
|
2333
|
+
g += sample.meanColor[1] / 255;
|
|
2334
|
+
b += sample.meanColor[2] / 255;
|
|
2335
|
+
luma += sample.luminance;
|
|
2336
|
+
texture += sample.texture;
|
|
2337
|
+
if (sample.metricDepthMeters !== void 0) {
|
|
2338
|
+
depth += Math.min(1, sample.metricDepthMeters / 10);
|
|
2339
|
+
depthCount += 1;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
const inv = 1 / samples.length;
|
|
2343
|
+
return new Float32Array([
|
|
2344
|
+
r * inv,
|
|
2345
|
+
g * inv,
|
|
2346
|
+
b * inv,
|
|
2347
|
+
luma * inv,
|
|
2348
|
+
texture * inv,
|
|
2349
|
+
depthCount > 0 ? depth / depthCount : 0
|
|
2350
|
+
]);
|
|
2351
|
+
}
|
|
2352
|
+
static descriptorDistance(a, b) {
|
|
2353
|
+
const n = Math.min(a.length, b.length);
|
|
2354
|
+
if (n === 0) return Number.POSITIVE_INFINITY;
|
|
2355
|
+
let squared = 0;
|
|
2356
|
+
for (let i = 0; i < n; i += 1) {
|
|
2357
|
+
const d = (a[i] ?? 0) - (b[i] ?? 0);
|
|
2358
|
+
squared += d * d;
|
|
2359
|
+
}
|
|
2360
|
+
return Math.sqrt(squared / n);
|
|
2361
|
+
}
|
|
1525
2362
|
static computeBounds(steps) {
|
|
1526
2363
|
if (steps.length === 0) {
|
|
1527
2364
|
return {
|
|
@@ -1595,6 +2432,10 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1595
2432
|
}
|
|
1596
2433
|
return _HoloMapRuntimeImpl.computeBounds(this.steps);
|
|
1597
2434
|
}
|
|
2435
|
+
static *retainedPositionChunks(steps, current) {
|
|
2436
|
+
for (const step of steps) yield step.points.positions;
|
|
2437
|
+
yield current;
|
|
2438
|
+
}
|
|
1598
2439
|
static estimatePrincipalAxisRotation(chunks, centroid) {
|
|
1599
2440
|
let xx = 0;
|
|
1600
2441
|
let zz = 0;
|
|
@@ -1668,8 +2509,20 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1668
2509
|
}
|
|
1669
2510
|
}
|
|
1670
2511
|
async init(config) {
|
|
1671
|
-
this.config = {
|
|
2512
|
+
this.config = {
|
|
2513
|
+
...config,
|
|
2514
|
+
reconstructionMode: config.reconstructionMode ?? "preview"
|
|
2515
|
+
};
|
|
2516
|
+
if (this.config.reconstructionMode === "dense-proof") {
|
|
2517
|
+
this.config.tileGrid = Math.max(
|
|
2518
|
+
this.config.tileGrid ?? _HoloMapRuntimeImpl.GRID_N,
|
|
2519
|
+
_HoloMapRuntimeImpl.DENSE_PROOF_GRID_N
|
|
2520
|
+
);
|
|
2521
|
+
}
|
|
1672
2522
|
this.config.tileGrid = _HoloMapRuntimeImpl.normalizeTileGrid(this.config.tileGrid);
|
|
2523
|
+
if (this.config.reconstructionMode === "dense-proof") {
|
|
2524
|
+
_HoloMapRuntimeImpl.assertDenseProofConfig(this.config);
|
|
2525
|
+
}
|
|
1673
2526
|
const allowCpu = this.config.allowCpuFallback !== false;
|
|
1674
2527
|
if (!allowCpu && !isWebGpuEnvironmentPresent()) {
|
|
1675
2528
|
const err = "HoloMap: native reconstruction requires WebGPU (allowCpuFallback=false). Run in a WebGPU-capable browser, or set allowCpuFallback=true for CPU fallback, or use compatibility scene ingest (Marble) for headless benchmarks.";
|
|
@@ -1709,16 +2562,44 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1709
2562
|
verticalProfile: this.config.verticalProfile
|
|
1710
2563
|
});
|
|
1711
2564
|
this.weightBytes = null;
|
|
1712
|
-
|
|
2565
|
+
this.weightVerified = false;
|
|
2566
|
+
this.weightSource = null;
|
|
2567
|
+
const weightUrl = this.config.weightUrl ?? (this.config.weightCid && this.config.localResolver ? `holomap-local://${this.config.weightCid}` : void 0);
|
|
2568
|
+
if (weightUrl) {
|
|
1713
2569
|
const result = await loadHoloMapWeightBlob({
|
|
1714
|
-
weightUrl
|
|
2570
|
+
weightUrl,
|
|
1715
2571
|
weightUrls: this.config.weightUrls,
|
|
1716
|
-
weightCid: this.config.weightCid
|
|
2572
|
+
weightCid: this.config.weightCid,
|
|
2573
|
+
localResolver: this.config.localResolver
|
|
1717
2574
|
});
|
|
1718
2575
|
this.weightBytes = result.bytes;
|
|
2576
|
+
this.weightVerified = result.verified;
|
|
2577
|
+
this.weightSource = result.source;
|
|
2578
|
+
}
|
|
2579
|
+
if (this.config.reconstructionMode === "dense-proof" && (!this.weightBytes || !this.weightVerified)) {
|
|
2580
|
+
throw new Error(
|
|
2581
|
+
"HoloMap dense-proof mode requires verified checkpoint bytes; preview mode is the only mode allowed to fall back to PRNG weights."
|
|
2582
|
+
);
|
|
1719
2583
|
}
|
|
1720
2584
|
this.encoderDevice = await tryCreateHoloMapEncoderDevice();
|
|
1721
2585
|
this.microEncoder = this.encoderDevice ? createHoloMapMicroEncoder(this.encoderDevice) : null;
|
|
2586
|
+
const streamingTokens = Math.max(
|
|
2587
|
+
1,
|
|
2588
|
+
this.config.maxSequenceLength * (this.config.tileGrid ?? _HoloMapRuntimeImpl.GRID_N) ** 2
|
|
2589
|
+
);
|
|
2590
|
+
const streamingPageSize = Math.max(
|
|
2591
|
+
1,
|
|
2592
|
+
Math.min(64, this.config.tileGrid ?? _HoloMapRuntimeImpl.GRID_N)
|
|
2593
|
+
);
|
|
2594
|
+
this.streamingKVCache = createPagedKVCache({
|
|
2595
|
+
pageSize: streamingPageSize,
|
|
2596
|
+
maxResidentPages: Math.max(1, Math.min(256, Math.ceil(streamingTokens / streamingPageSize))),
|
|
2597
|
+
hiddenDim: 3,
|
|
2598
|
+
numHeads: 1,
|
|
2599
|
+
numLayers: 1,
|
|
2600
|
+
device: this.encoderDevice
|
|
2601
|
+
});
|
|
2602
|
+
this.streamingKVNextToken = 0;
|
|
1722
2603
|
this.initialized = true;
|
|
1723
2604
|
logHoloMapEvent(this.runId, "init", {
|
|
1724
2605
|
modelHash: this.config.modelHash,
|
|
@@ -1726,8 +2607,11 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1726
2607
|
allowCpuFallback: allowCpu,
|
|
1727
2608
|
webgpu: isWebGpuEnvironmentPresent(),
|
|
1728
2609
|
microEncoder: this.microEncoder ? "webgpu" : "cpu",
|
|
2610
|
+
reconstructionMode: this.config.reconstructionMode,
|
|
1729
2611
|
tileGrid: this.config.tileGrid,
|
|
1730
2612
|
weightLoadedBytes: this.weightBytes?.byteLength ?? 0,
|
|
2613
|
+
weightVerified: this.weightVerified,
|
|
2614
|
+
weightSource: this.weightSource,
|
|
1731
2615
|
replayFingerprint: this.replayKey
|
|
1732
2616
|
});
|
|
1733
2617
|
}
|
|
@@ -1744,6 +2628,19 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1744
2628
|
}
|
|
1745
2629
|
return tileGrid;
|
|
1746
2630
|
}
|
|
2631
|
+
static assertDenseProofConfig(config) {
|
|
2632
|
+
const missing = [];
|
|
2633
|
+
if (!config.modelHash || config.modelHash === "unset") missing.push("modelHash");
|
|
2634
|
+
if (!config.weightCid) missing.push("weightCid");
|
|
2635
|
+
if (!config.weightUrl && !config.localResolver) missing.push("weightUrl or localResolver");
|
|
2636
|
+
if (missing.length > 0) {
|
|
2637
|
+
throw new Error(
|
|
2638
|
+
`HoloMap dense-proof mode requires ${missing.join(
|
|
2639
|
+
", "
|
|
2640
|
+
)}; preview mode is the only mode allowed to use PRNG/default weights.`
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
1747
2644
|
/**
|
|
1748
2645
|
* Carve `frame` into gridN×gridN tiles. Each tile carries its own
|
|
1749
2646
|
* (rgb, width, height, stride, index) and the mean RGB color over its
|
|
@@ -1839,6 +2736,35 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1839
2736
|
return runHoloMapMicroEncoderCpu(tile, microCfg);
|
|
1840
2737
|
}
|
|
1841
2738
|
}
|
|
2739
|
+
async updateStreamingKVCache(encodedTiles) {
|
|
2740
|
+
if (!this.streamingKVCache || encodedTiles.length === 0) return void 0;
|
|
2741
|
+
const keys = new Float32Array(encodedTiles.length * 3);
|
|
2742
|
+
const values = new Float32Array(encodedTiles.length * 3);
|
|
2743
|
+
for (let i = 0; i < encodedTiles.length; i += 1) {
|
|
2744
|
+
const sample = encodedTiles[i];
|
|
2745
|
+
keys.set(sample.latent, i * 3);
|
|
2746
|
+
values[i * 3] = sample.rawDepthSignal;
|
|
2747
|
+
values[i * 3 + 1] = sample.texture;
|
|
2748
|
+
values[i * 3 + 2] = sample.luminance;
|
|
2749
|
+
}
|
|
2750
|
+
const firstToken = this.streamingKVNextToken;
|
|
2751
|
+
await this.streamingKVCache.append(0, keys, values, firstToken);
|
|
2752
|
+
this.streamingKVNextToken += encodedTiles.length;
|
|
2753
|
+
const retainedTokenCapacity = this.streamingKVCache.config.pageSize * this.streamingKVCache.config.maxResidentPages;
|
|
2754
|
+
const kLen = Math.min(this.streamingKVNextToken, 128, retainedTokenCapacity);
|
|
2755
|
+
const lookupStart = this.streamingKVNextToken - kLen;
|
|
2756
|
+
const lookup = await this.streamingKVCache.lookup(0, lookupStart, kLen);
|
|
2757
|
+
let checksum = 0;
|
|
2758
|
+
for (let i = 0; i < lookup.keys.length; i += 1) checksum += lookup.keys[i] ?? 0;
|
|
2759
|
+
for (let i = 0; i < lookup.values.length; i += 1) checksum += lookup.values[i] ?? 0;
|
|
2760
|
+
return {
|
|
2761
|
+
layer: 0,
|
|
2762
|
+
kLen,
|
|
2763
|
+
cachedPages: this.streamingKVCache.residentPagesForLayer(0).length,
|
|
2764
|
+
lookupChecksum: checksum,
|
|
2765
|
+
memory: this.streamingKVCache.memoryUsage()
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
1842
2768
|
async step(frame) {
|
|
1843
2769
|
if (!this.initialized) {
|
|
1844
2770
|
throw new Error("HoloMapRuntime not initialized. Call init(config) before step(frame).");
|
|
@@ -1857,6 +2783,11 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1857
2783
|
`HoloMapRuntime.step invalid measured depth length: got ${frame.depth.length}, expected ${frame.width * frame.height} (w=${frame.width}, h=${frame.height})`
|
|
1858
2784
|
);
|
|
1859
2785
|
}
|
|
2786
|
+
if (frame.depthMeters && frame.depthMeters.length !== frame.width * frame.height) {
|
|
2787
|
+
throw new Error(
|
|
2788
|
+
`HoloMapRuntime.step invalid metric depth length: got ${frame.depthMeters.length}, expected ${frame.width * frame.height} (w=${frame.width}, h=${frame.height})`
|
|
2789
|
+
);
|
|
2790
|
+
}
|
|
1860
2791
|
if (frame.depthConfidence && frame.depthConfidence.length !== frame.width * frame.height) {
|
|
1861
2792
|
throw new Error(
|
|
1862
2793
|
`HoloMapRuntime.step invalid measured depth confidence length: got ${frame.depthConfidence.length}, expected ${frame.width * frame.height} (w=${frame.width}, h=${frame.height})`
|
|
@@ -1891,12 +2822,19 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1891
2822
|
this.updateBounds(s.points.positions);
|
|
1892
2823
|
}
|
|
1893
2824
|
logHoloMapEvent(this.runId, "step_evict", {
|
|
1894
|
-
frameIndex: evicted.
|
|
2825
|
+
frameIndex: evicted.frameIndex,
|
|
1895
2826
|
evictedPoints,
|
|
1896
2827
|
retainedSteps: this.steps.length
|
|
1897
2828
|
});
|
|
1898
2829
|
}
|
|
1899
|
-
const microCfg = {
|
|
2830
|
+
const microCfg = {
|
|
2831
|
+
seed: this.config.seed,
|
|
2832
|
+
modelHash: this.config.modelHash,
|
|
2833
|
+
// Wire the loaded checkpoint through to the encoder. Previously weightBytes
|
|
2834
|
+
// was fetched + verified in init() then never passed here, so the encoder
|
|
2835
|
+
// always ran on PRNG weights even when a real checkpoint was provided.
|
|
2836
|
+
weightBytes: this.weightBytes
|
|
2837
|
+
};
|
|
1900
2838
|
const configuredGrid = this.config.tileGrid ?? _HoloMapRuntimeImpl.GRID_N;
|
|
1901
2839
|
const gridN = Math.max(1, Math.min(configuredGrid, frame.width, frame.height));
|
|
1902
2840
|
const tiles = _HoloMapRuntimeImpl.tileFrame(frame, gridN);
|
|
@@ -1905,22 +2843,83 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1905
2843
|
const colors = new Uint8Array(numPoints * 3);
|
|
1906
2844
|
const confidence = new Float32Array(numPoints);
|
|
1907
2845
|
const aspect = frame.width / Math.max(1, frame.height);
|
|
2846
|
+
const metricIntrinsics = _HoloMapRuntimeImpl.hasUsableIntrinsics(frame.cameraIntrinsics) ? frame.cameraIntrinsics : void 0;
|
|
2847
|
+
const encodedTiles = [];
|
|
2848
|
+
for (let t = 0; t < numPoints; t += 1) {
|
|
2849
|
+
const sample = tiles[t];
|
|
2850
|
+
const xyz = await this.encodeTile(sample.tile, microCfg);
|
|
2851
|
+
const latentX = xyz[0] ?? 0;
|
|
2852
|
+
const latentY = xyz[1] ?? 0;
|
|
2853
|
+
const latentZ = xyz[2] ?? 0;
|
|
2854
|
+
const depthHint = (sample.luminance - 0.5) * 0.34 + sample.texture * 0.24;
|
|
2855
|
+
encodedTiles.push({
|
|
2856
|
+
...sample,
|
|
2857
|
+
latent: [latentX, latentY, latentZ],
|
|
2858
|
+
rawDepthSignal: depthHint + latentZ * 0.12,
|
|
2859
|
+
metricDepthMeters: frame.depthMeters ? _HoloMapRuntimeImpl.sampleMetricDepthNearestUv(
|
|
2860
|
+
frame.depthMeters,
|
|
2861
|
+
frame.width,
|
|
2862
|
+
frame.height,
|
|
2863
|
+
sample.centerUv
|
|
2864
|
+
) : void 0
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
const streamingKV = await this.updateStreamingKVCache(encodedTiles);
|
|
2868
|
+
const depthAlignment = _HoloMapRuntimeImpl.fitShiftScaleDepth(encodedTiles);
|
|
2869
|
+
const loopDescriptor = _HoloMapRuntimeImpl.buildLoopClosureDescriptor(encodedTiles);
|
|
2870
|
+
const rawDevicePose = frame.devicePose ? {
|
|
2871
|
+
position: [...frame.devicePose.position],
|
|
2872
|
+
rotation: [...frame.devicePose.rotation],
|
|
2873
|
+
confidence: frame.devicePose.confidence
|
|
2874
|
+
} : void 0;
|
|
2875
|
+
let loopCorrectedPose;
|
|
2876
|
+
if (frame.depthMeters && metricIntrinsics) {
|
|
2877
|
+
for (const kf of this.poseHistory) {
|
|
2878
|
+
if (frame.index - kf.frameIndex < _HoloMapRuntimeImpl.LOOP_CLOSURE_MIN_GAP) continue;
|
|
2879
|
+
const descriptorDistance = _HoloMapRuntimeImpl.descriptorDistance(
|
|
2880
|
+
loopDescriptor,
|
|
2881
|
+
kf.descriptor
|
|
2882
|
+
);
|
|
2883
|
+
if (descriptorDistance <= _HoloMapRuntimeImpl.LOOP_CLOSURE_DESCRIPTOR_DISTANCE) {
|
|
2884
|
+
this.lastLoopClosureFrameIdx = frame.index;
|
|
2885
|
+
if (rawDevicePose) {
|
|
2886
|
+
loopCorrectedPose = {
|
|
2887
|
+
...rawDevicePose,
|
|
2888
|
+
position: [...kf.position],
|
|
2889
|
+
confidence: Math.min(1, Math.max(rawDevicePose.confidence, 0.9))
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
break;
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
const metricProjectionPose = loopCorrectedPose ?? rawDevicePose;
|
|
1908
2897
|
let centroidX = 0;
|
|
1909
2898
|
let centroidY = 0;
|
|
1910
2899
|
let centroidZ = 0;
|
|
1911
2900
|
let confidenceSum = 0;
|
|
1912
2901
|
for (let t = 0; t < numPoints; t += 1) {
|
|
1913
|
-
const {
|
|
1914
|
-
const
|
|
1915
|
-
const latentX = xyz[0] ?? 0;
|
|
1916
|
-
const latentY = xyz[1] ?? 0;
|
|
1917
|
-
const latentZ = xyz[2] ?? 0;
|
|
2902
|
+
const { meanColor, centerUv, texture, latent, rawDepthSignal } = encodedTiles[t];
|
|
2903
|
+
const [latentX, latentY, latentZ] = latent;
|
|
1918
2904
|
const planeX = (centerUv[0] - 0.5) * 2 * aspect;
|
|
1919
2905
|
const planeY = (0.5 - centerUv[1]) * 2;
|
|
1920
|
-
|
|
1921
|
-
|
|
2906
|
+
let px = planeX + latentX * 0.08;
|
|
2907
|
+
let py = planeY + latentY * 0.08;
|
|
1922
2908
|
let pz;
|
|
1923
|
-
|
|
2909
|
+
const metricDepth = _HoloMapRuntimeImpl.alignedDepthMeters(encodedTiles[t], depthAlignment);
|
|
2910
|
+
if (metricDepth !== void 0 && metricIntrinsics) {
|
|
2911
|
+
const worldPoint = _HoloMapRuntimeImpl.projectMetricDepthToWorld(
|
|
2912
|
+
centerUv,
|
|
2913
|
+
metricDepth,
|
|
2914
|
+
metricIntrinsics,
|
|
2915
|
+
metricProjectionPose
|
|
2916
|
+
);
|
|
2917
|
+
px = worldPoint[0];
|
|
2918
|
+
py = worldPoint[1];
|
|
2919
|
+
pz = worldPoint[2];
|
|
2920
|
+
} else if (metricDepth !== void 0) {
|
|
2921
|
+
pz = -metricDepth;
|
|
2922
|
+
} else if (frame.depth) {
|
|
1924
2923
|
const measured = _HoloMapRuntimeImpl.sampleDepthNearestUv(
|
|
1925
2924
|
frame.depth,
|
|
1926
2925
|
frame.width,
|
|
@@ -1929,8 +2928,7 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1929
2928
|
);
|
|
1930
2929
|
pz = (0.5 - measured) * _HoloMapRuntimeImpl.DEPTH_Z_SCALE;
|
|
1931
2930
|
} else {
|
|
1932
|
-
|
|
1933
|
-
pz = depthHint + latentZ * 0.12;
|
|
2931
|
+
pz = rawDepthSignal;
|
|
1934
2932
|
}
|
|
1935
2933
|
positions[t * 3] = px;
|
|
1936
2934
|
positions[t * 3 + 1] = py;
|
|
@@ -1966,10 +2964,10 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
1966
2964
|
const meanConfidence = confidenceSum * inv;
|
|
1967
2965
|
const derivedPosition = [poseX, poseY, poseZ];
|
|
1968
2966
|
const poseConfidence = Math.max(0, Math.min(1, meanConfidence));
|
|
1969
|
-
const cameraPose =
|
|
1970
|
-
position: [...
|
|
1971
|
-
rotation: [...
|
|
1972
|
-
confidence:
|
|
2967
|
+
const cameraPose = metricProjectionPose ? {
|
|
2968
|
+
position: [...metricProjectionPose.position],
|
|
2969
|
+
rotation: [...metricProjectionPose.rotation],
|
|
2970
|
+
confidence: metricProjectionPose.confidence
|
|
1973
2971
|
} : {
|
|
1974
2972
|
position: derivedPosition,
|
|
1975
2973
|
rotation: _HoloMapRuntimeImpl.estimatePrincipalAxisRotation([positions], derivedPosition),
|
|
@@ -2016,17 +3014,23 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2016
3014
|
}
|
|
2017
3015
|
this.prevPose = curPose;
|
|
2018
3016
|
this.prevCameraPose = cameraPose;
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
3017
|
+
if (this.lastLoopClosureFrameIdx !== frame.index) {
|
|
3018
|
+
for (const kf of this.poseHistory) {
|
|
3019
|
+
if (frame.index - kf.frameIndex < _HoloMapRuntimeImpl.LOOP_CLOSURE_MIN_GAP) continue;
|
|
3020
|
+
const dx = curPose[0] - kf.position[0];
|
|
3021
|
+
const dy = curPose[1] - kf.position[1];
|
|
3022
|
+
const dz = curPose[2] - kf.position[2];
|
|
3023
|
+
if (Math.sqrt(dx * dx + dy * dy + dz * dz) < _HoloMapRuntimeImpl.LOOP_CLOSURE_RADIUS) {
|
|
3024
|
+
this.lastLoopClosureFrameIdx = frame.index;
|
|
3025
|
+
break;
|
|
3026
|
+
}
|
|
2027
3027
|
}
|
|
2028
3028
|
}
|
|
2029
|
-
this.poseHistory.push({
|
|
3029
|
+
this.poseHistory.push({
|
|
3030
|
+
frameIndex: frame.index,
|
|
3031
|
+
position: curPose,
|
|
3032
|
+
descriptor: loopDescriptor
|
|
3033
|
+
});
|
|
2030
3034
|
if (this.poseHistory.length > _HoloMapRuntimeImpl.POSE_HISTORY_CAP) this.poseHistory.shift();
|
|
2031
3035
|
this.updateBounds(positions);
|
|
2032
3036
|
this.globalPosSum[0] += centroidX;
|
|
@@ -2046,7 +3050,7 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2046
3050
|
const extentY = b.max[1] - b.min[1];
|
|
2047
3051
|
const extentZ = b.max[2] - b.min[2];
|
|
2048
3052
|
const anchorRotation = _HoloMapRuntimeImpl.estimatePrincipalAxisRotation(
|
|
2049
|
-
|
|
3053
|
+
_HoloMapRuntimeImpl.retainedPositionChunks(this.steps, positions),
|
|
2050
3054
|
anchorCenter
|
|
2051
3055
|
);
|
|
2052
3056
|
const anchorDescriptor = new Float32Array([extentX, extentY, extentZ, globalMeanConfidence]);
|
|
@@ -2072,6 +3076,7 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2072
3076
|
colors,
|
|
2073
3077
|
confidence
|
|
2074
3078
|
},
|
|
3079
|
+
...streamingKV ? { streamingKV } : {},
|
|
2075
3080
|
trajectory: {
|
|
2076
3081
|
keyframes: trajectoryKeyframes,
|
|
2077
3082
|
estimatedDriftMeters: this.cumulativeDriftMeters,
|
|
@@ -2087,9 +3092,16 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2087
3092
|
},
|
|
2088
3093
|
anchorDescriptor,
|
|
2089
3094
|
revision: frame.index + 1
|
|
2090
|
-
}
|
|
3095
|
+
},
|
|
3096
|
+
...depthAlignment ? { depthAlignment } : {}
|
|
2091
3097
|
};
|
|
2092
|
-
this.steps.push(
|
|
3098
|
+
this.steps.push({
|
|
3099
|
+
frameIndex: frame.index,
|
|
3100
|
+
points: {
|
|
3101
|
+
positions,
|
|
3102
|
+
confidence
|
|
3103
|
+
}
|
|
3104
|
+
});
|
|
2093
3105
|
this.totalPointCount += numPoints;
|
|
2094
3106
|
const stepMs = performance.now() - stepStartMs;
|
|
2095
3107
|
this.perfMetrics.stepCount += 1;
|
|
@@ -2122,7 +3134,16 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2122
3134
|
throttledCount: this.perfMetrics.throttledCount,
|
|
2123
3135
|
sessionDurationMs: Math.round(performance.now() - this.sessionStartMs)
|
|
2124
3136
|
});
|
|
2125
|
-
|
|
3137
|
+
const reconstruction = {
|
|
3138
|
+
mode: this.config.reconstructionMode ?? "preview",
|
|
3139
|
+
modelHash: this.config.modelHash,
|
|
3140
|
+
tileGrid: this.config.tileGrid ?? _HoloMapRuntimeImpl.GRID_N,
|
|
3141
|
+
weightLoadedBytes: this.weightBytes?.byteLength ?? 0,
|
|
3142
|
+
weightVerified: this.weightVerified,
|
|
3143
|
+
...this.config.weightCid ? { weightCid: this.config.weightCid } : {},
|
|
3144
|
+
...this.weightSource ? { weightSource: this.weightSource } : {}
|
|
3145
|
+
};
|
|
3146
|
+
const manifest = {
|
|
2126
3147
|
version: "1.0.0",
|
|
2127
3148
|
worldId: `holomap-${this.replayKey}`,
|
|
2128
3149
|
displayName: "HoloMap Reconstruction",
|
|
@@ -2144,8 +3165,17 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2144
3165
|
trajectory: "reconstruction.trajectory.json",
|
|
2145
3166
|
anchors: "reconstruction.anchors.json"
|
|
2146
3167
|
},
|
|
2147
|
-
weightStrategy: this.config.weightStrategy ?? "distill"
|
|
3168
|
+
weightStrategy: this.config.weightStrategy ?? "distill",
|
|
3169
|
+
reconstruction
|
|
2148
3170
|
};
|
|
3171
|
+
try {
|
|
3172
|
+
return await anchorReconstructionManifest(manifest, this.config.provenanceAnchorProvider);
|
|
3173
|
+
} catch (error) {
|
|
3174
|
+
logHoloMapEvent(this.runId, "anchor_failed", {
|
|
3175
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
3176
|
+
});
|
|
3177
|
+
return selfAttestReconstructionManifest(manifest);
|
|
3178
|
+
}
|
|
2149
3179
|
}
|
|
2150
3180
|
replayHash() {
|
|
2151
3181
|
return this.replayKey;
|
|
@@ -2160,7 +3190,12 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
|
|
|
2160
3190
|
this.steps.length = 0;
|
|
2161
3191
|
this.microEncoder = null;
|
|
2162
3192
|
this.encoderDevice = null;
|
|
3193
|
+
await this.streamingKVCache?.dispose();
|
|
3194
|
+
this.streamingKVCache = null;
|
|
3195
|
+
this.streamingKVNextToken = 0;
|
|
2163
3196
|
this.weightBytes = null;
|
|
3197
|
+
this.weightVerified = false;
|
|
3198
|
+
this.weightSource = null;
|
|
2164
3199
|
this.totalPointCount = 0;
|
|
2165
3200
|
this.cumulativeDriftMeters = 0;
|
|
2166
3201
|
this.prevPose = null;
|
|
@@ -2190,6 +3225,7 @@ _HoloMapRuntimeImpl.TRAJECTORY_KEYFRAME_CAP = 512;
|
|
|
2190
3225
|
* the monocular estimate's spread (±~0.17), so sensor and estimate paths
|
|
2191
3226
|
* produce geometry in the same coordinate scale. */
|
|
2192
3227
|
_HoloMapRuntimeImpl.DEPTH_Z_SCALE = 0.34;
|
|
3228
|
+
_HoloMapRuntimeImpl.LOOP_CLOSURE_DESCRIPTOR_DISTANCE = 0.015;
|
|
2193
3229
|
/**
|
|
2194
3230
|
* Default number of tiles per axis used to fan the encoder across the frame.
|
|
2195
3231
|
* Total points emitted = tileGrid * tileGrid (one per tile).
|
|
@@ -2199,6 +3235,7 @@ _HoloMapRuntimeImpl.DEPTH_Z_SCALE = 0.34;
|
|
|
2199
3235
|
* for future streaming kLen>1 paths.
|
|
2200
3236
|
*/
|
|
2201
3237
|
_HoloMapRuntimeImpl.GRID_N = 4;
|
|
3238
|
+
_HoloMapRuntimeImpl.DENSE_PROOF_GRID_N = 16;
|
|
2202
3239
|
_HoloMapRuntimeImpl.MAX_GRID_N = 32;
|
|
2203
3240
|
var HoloMapRuntimeImpl = _HoloMapRuntimeImpl;
|
|
2204
3241
|
function createHoloMapRuntime(_config) {
|
|
@@ -2209,6 +3246,6 @@ function createHoloMapRuntime(_config) {
|
|
|
2209
3246
|
return runtime;
|
|
2210
3247
|
}
|
|
2211
3248
|
|
|
2212
|
-
export { BUILD_TIMESTAMP, GIT_COMMIT_SHA, HOLOMAP_DEFAULTS, HOLOSCRIPT_VERSION, assertWeightCid, createHoloMapMicroEncoder, createHoloMapRunId, createHoloMapRuntime, frameToMicroImage, getCachedWeightBlob, getVersionInfo, getVersionString, loadHoloMapWeightBlob, logHoloMapEvent, normalizeWeightCidDigest, putCachedWeightBlob, resetHoloMapTelemetryForTests, runHoloMapMicroEncoderCpu, tryCreateHoloMapEncoderDevice };
|
|
2213
|
-
//# sourceMappingURL=chunk-
|
|
2214
|
-
//# sourceMappingURL=chunk-
|
|
3249
|
+
export { BUILD_TIMESTAMP, GIT_COMMIT_SHA, HOLOMAP_DEFAULTS, HOLOMAP_DENSE_PROOF_DEFAULTS, HOLOSCRIPT_VERSION, anchorReconstructionManifest, assertWeightCid, computeReconstructionManifestDigest, createHoloMapMicroEncoder, createHoloMapRunId, createHoloMapRuntime, createPagedKVCache, deserializeMicroWeights, frameToMicroImage, getCachedWeightBlob, getVersionInfo, getVersionString, loadHoloMapWeightBlob, logHoloMapEvent, mergeAnchoredProvenance, normalizeWeightCidDigest, putCachedWeightBlob, resetHoloMapTelemetryForTests, runHoloMapMicroEncoderCpu, selfAttestReconstructionManifest, serializeMicroWeights, stripAnchoredProvenance, tryCreateHoloMapEncoderDevice };
|
|
3250
|
+
//# sourceMappingURL=chunk-5OUOMBKK.js.map
|
|
3251
|
+
//# sourceMappingURL=chunk-5OUOMBKK.js.map
|