@holoscript/core 8.0.8 → 8.0.9
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/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-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-WFKVS2K4.cjs → chunk-AUZRKIHQ.cjs} +1101 -55
- 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-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-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-Z6PMDS4G.js → chunk-QDQWKSU3.js} +1090 -53
- 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-UGXHYIWT.cjs → chunk-QUJ3ZB55.cjs} +28 -28
- 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-7X5PNIQJ.js → chunk-X3YFRH6K.js} +27 -25
- 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 +113 -46
- 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
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk356N4NPM_cjs = require('./chunk-356N4NPM.cjs');
|
|
4
|
+
|
|
5
|
+
// src/policy/index.ts
|
|
6
|
+
chunk356N4NPM_cjs.init_jsonLogic();
|
|
7
|
+
|
|
8
|
+
// src/policy/blocklist.ts
|
|
9
|
+
function normalizeText(input) {
|
|
10
|
+
let s = input.normalize("NFKD").toLowerCase();
|
|
11
|
+
s = s.replace(/[̀-ͯ]/g, "");
|
|
12
|
+
const leet = {
|
|
13
|
+
"0": "o",
|
|
14
|
+
"1": "i",
|
|
15
|
+
"3": "e",
|
|
16
|
+
"4": "a",
|
|
17
|
+
"5": "s",
|
|
18
|
+
"7": "t",
|
|
19
|
+
"@": "a",
|
|
20
|
+
$: "s"
|
|
21
|
+
};
|
|
22
|
+
s = s.replace(/[013457@$]/g, (c) => leet[c] ?? c);
|
|
23
|
+
s = s.replace(/[.\-_*|/\\]+/g, "");
|
|
24
|
+
s = s.replace(/\s+/g, " ").trim();
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
var PATTERN_CACHE = /* @__PURE__ */ new Map();
|
|
28
|
+
var MAX_PATTERN_LENGTH = 512;
|
|
29
|
+
function compile(pattern) {
|
|
30
|
+
if (PATTERN_CACHE.has(pattern)) return PATTERN_CACHE.get(pattern) ?? null;
|
|
31
|
+
let re = null;
|
|
32
|
+
if (pattern.length <= MAX_PATTERN_LENGTH) {
|
|
33
|
+
try {
|
|
34
|
+
re = new RegExp(pattern, "i");
|
|
35
|
+
} catch {
|
|
36
|
+
re = null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
PATTERN_CACHE.set(pattern, re);
|
|
40
|
+
return re;
|
|
41
|
+
}
|
|
42
|
+
function termHit(normalized, term) {
|
|
43
|
+
const t = normalizeText(term);
|
|
44
|
+
if (!t) return false;
|
|
45
|
+
return normalized === t || normalized.startsWith(t + " ") || normalized.endsWith(" " + t) || normalized.includes(" " + t + " ");
|
|
46
|
+
}
|
|
47
|
+
function matchBlocklist(text, entries) {
|
|
48
|
+
const normalized = normalizeText(text);
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
let matched = false;
|
|
52
|
+
if (entry.terms) {
|
|
53
|
+
for (const term of entry.terms) {
|
|
54
|
+
if (termHit(normalized, term)) {
|
|
55
|
+
matched = true;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!matched && entry.patterns) {
|
|
61
|
+
for (const pat of entry.patterns) {
|
|
62
|
+
const re = compile(pat);
|
|
63
|
+
if (re && (re.test(text) || re.test(normalized))) {
|
|
64
|
+
matched = true;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!matched) continue;
|
|
70
|
+
const severity = entry.hardStop ? 1 : entry.severity ?? 0.95;
|
|
71
|
+
if (!best || severity > best.severity) {
|
|
72
|
+
best = {
|
|
73
|
+
category: entry.category,
|
|
74
|
+
severity,
|
|
75
|
+
source: "blocklist",
|
|
76
|
+
rationale: `Tier-0 blocklist match: ${entry.id}`,
|
|
77
|
+
entryId: entry.id,
|
|
78
|
+
hardStop: Boolean(entry.hardStop)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return best;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/policy/defaults.ts
|
|
86
|
+
var HARD_STOP_CATEGORIES = ["csam", "sexual_minors", "terrorism"];
|
|
87
|
+
var DEFAULT_BLOCKLIST = [
|
|
88
|
+
// ── Hard-stop categories — detectors supplied by external hash feeds ──────────
|
|
89
|
+
{ id: "hs-csam", category: "csam", hardStop: true, patterns: [] },
|
|
90
|
+
{ id: "hs-sexual-minors", category: "sexual_minors", hardStop: true, patterns: [] },
|
|
91
|
+
{ id: "hs-terrorism", category: "terrorism", hardStop: true, patterns: [] },
|
|
92
|
+
// ── Conservative unambiguous instructional-harm patterns (backstop to Tier-2) ─
|
|
93
|
+
{
|
|
94
|
+
id: "weapons-build-explosive",
|
|
95
|
+
category: "weapons",
|
|
96
|
+
severity: 0.97,
|
|
97
|
+
patterns: ["\\bhow\\s+to\\s+(make|build|construct|assemble)\\s+(a\\s+)?(bomb|explosive|pipe\\s*bomb|ied)\\b"]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "malware-author",
|
|
101
|
+
category: "malware",
|
|
102
|
+
severity: 0.9,
|
|
103
|
+
patterns: ["\\b(write|generate|create)\\s+(me\\s+)?(a\\s+)?(ransomware|keylogger|computer\\s+virus|trojan)\\b"]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "self-harm-method",
|
|
107
|
+
category: "self_harm",
|
|
108
|
+
severity: 0.9,
|
|
109
|
+
patterns: ["\\bhow\\s+(can|do)\\s+i\\s+(kill\\s+myself|end\\s+my\\s+life|commit\\s+suicide)\\b"]
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
function jurisdictionBundle(region) {
|
|
113
|
+
const r = (region || "GLOBAL").toUpperCase();
|
|
114
|
+
switch (r) {
|
|
115
|
+
case "US":
|
|
116
|
+
return { region: "US", aiActTier: "minimal", dsaApplies: false, minAge: 13, disclosureRequired: false };
|
|
117
|
+
case "EU":
|
|
118
|
+
case "DE":
|
|
119
|
+
case "FR":
|
|
120
|
+
case "ES":
|
|
121
|
+
case "IT":
|
|
122
|
+
case "NL":
|
|
123
|
+
case "IE":
|
|
124
|
+
return { region: r, aiActTier: "limited", dsaApplies: true, minAge: 16, disclosureRequired: true };
|
|
125
|
+
case "GB":
|
|
126
|
+
case "UK":
|
|
127
|
+
return { region: "GB", aiActTier: "limited", dsaApplies: false, minAge: 13, disclosureRequired: true };
|
|
128
|
+
// ── Asia-Pacific ──────────────────────────────────────────────────────────
|
|
129
|
+
case "AU":
|
|
130
|
+
return { region: "AU", aiActTier: "minimal", dsaApplies: false, minAge: 13, disclosureRequired: false };
|
|
131
|
+
case "JP":
|
|
132
|
+
return { region: "JP", aiActTier: "minimal", dsaApplies: false, minAge: 13, disclosureRequired: true };
|
|
133
|
+
case "KR":
|
|
134
|
+
return { region: "KR", aiActTier: "limited", dsaApplies: false, minAge: 14, disclosureRequired: true };
|
|
135
|
+
case "SG":
|
|
136
|
+
return { region: "SG", aiActTier: "minimal", dsaApplies: false, minAge: 13, disclosureRequired: true };
|
|
137
|
+
case "IN":
|
|
138
|
+
return { region: "IN", aiActTier: "minimal", dsaApplies: false, minAge: 18, disclosureRequired: false };
|
|
139
|
+
// ── Americas ──────────────────────────────────────────────────────────────
|
|
140
|
+
case "CA":
|
|
141
|
+
return { region: "CA", aiActTier: "limited", dsaApplies: false, minAge: 13, disclosureRequired: true };
|
|
142
|
+
case "BR":
|
|
143
|
+
return { region: "BR", aiActTier: "limited", dsaApplies: true, minAge: 13, disclosureRequired: true };
|
|
144
|
+
case "GLOBAL":
|
|
145
|
+
default:
|
|
146
|
+
return { region: "GLOBAL", aiActTier: "limited", dsaApplies: true, minAge: 16, disclosureRequired: true };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var HARMFUL_FAMILY_CATEGORIES = [
|
|
150
|
+
"sexual",
|
|
151
|
+
"violence",
|
|
152
|
+
"weapons",
|
|
153
|
+
"illegal_goods",
|
|
154
|
+
"hate",
|
|
155
|
+
"harassment",
|
|
156
|
+
"malware",
|
|
157
|
+
"privacy"
|
|
158
|
+
];
|
|
159
|
+
var COMMON_RULES = [
|
|
160
|
+
{
|
|
161
|
+
id: "common-self-harm-escalate",
|
|
162
|
+
description: "Self-harm signals route to human/crisis escalation rather than a silent block.",
|
|
163
|
+
when: { "==": [{ var: "category" }, "self_harm"] },
|
|
164
|
+
action: "escalate",
|
|
165
|
+
category: "self_harm",
|
|
166
|
+
legalBasis: "duty-of-care / crisis-routing",
|
|
167
|
+
priority: 10
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "common-illegal-high-block",
|
|
171
|
+
description: "Clearly-illegal, high-severity instructional content is blocked on every tier (including dev).",
|
|
172
|
+
when: {
|
|
173
|
+
and: [
|
|
174
|
+
{ in: [{ var: "category" }, ["weapons", "illegal_goods"]] },
|
|
175
|
+
{ ">=": [{ var: "severity" }, 0.85] }
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
action: "block",
|
|
179
|
+
legalBasis: "illegal-conduct (universal)",
|
|
180
|
+
priority: 20
|
|
181
|
+
}
|
|
182
|
+
];
|
|
183
|
+
var FAMILY_RULES = [
|
|
184
|
+
{
|
|
185
|
+
id: "family-harmful-category-block",
|
|
186
|
+
description: "Family tier blocks every harmful content category outright, at any severity.",
|
|
187
|
+
when: {
|
|
188
|
+
and: [
|
|
189
|
+
{ "==": [{ var: "tier" }, "family"] },
|
|
190
|
+
{ in: [{ var: "category" }, HARMFUL_FAMILY_CATEGORIES] }
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
action: "block",
|
|
194
|
+
legalBasis: "HoloLand family-safety policy (D.079)",
|
|
195
|
+
aiActArticle: "transparency/minors-protection",
|
|
196
|
+
priority: 5
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: "family-misinformation-flag",
|
|
200
|
+
description: "Family tier flags misinformation for review.",
|
|
201
|
+
when: {
|
|
202
|
+
and: [{ "==": [{ var: "tier" }, "family"] }, { "==": [{ var: "category" }, "misinformation"] }]
|
|
203
|
+
},
|
|
204
|
+
action: "flag",
|
|
205
|
+
category: "misinformation",
|
|
206
|
+
priority: 1
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
var TEEN_RULES = [
|
|
210
|
+
{
|
|
211
|
+
id: "teen-serious-block",
|
|
212
|
+
description: "Teen tier blocks serious-harm categories.",
|
|
213
|
+
when: {
|
|
214
|
+
and: [
|
|
215
|
+
{ "==": [{ var: "tier" }, "teen"] },
|
|
216
|
+
{ in: [{ var: "category" }, ["sexual", "weapons", "illegal_goods", "malware", "hate"]] }
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
action: "block",
|
|
220
|
+
legalBasis: "minor-protection policy",
|
|
221
|
+
priority: 5
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "teen-violence-harassment-flag",
|
|
225
|
+
description: "Teen tier flags violence/harassment above low severity.",
|
|
226
|
+
when: {
|
|
227
|
+
and: [
|
|
228
|
+
{ "==": [{ var: "tier" }, "teen"] },
|
|
229
|
+
{ in: [{ var: "category" }, ["violence", "harassment"]] },
|
|
230
|
+
{ ">=": [{ var: "severity" }, 0.4] }
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
action: "flag",
|
|
234
|
+
priority: 1
|
|
235
|
+
}
|
|
236
|
+
];
|
|
237
|
+
var GENERAL_RULES = [
|
|
238
|
+
{
|
|
239
|
+
id: "general-illegal-block",
|
|
240
|
+
description: "Block clearly illegal categories at moderate+ severity for general/adult tiers.",
|
|
241
|
+
when: {
|
|
242
|
+
and: [
|
|
243
|
+
{ in: [{ var: "tier" }, ["general", "adult"]] },
|
|
244
|
+
{ in: [{ var: "category" }, ["weapons", "illegal_goods", "malware"]] },
|
|
245
|
+
{ ">=": [{ var: "severity" }, 0.5] }
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
action: "block",
|
|
249
|
+
legalBasis: "prohibited-conduct policy",
|
|
250
|
+
priority: 5
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: "general-hate-violence-flag",
|
|
254
|
+
description: "Flag hate/violence/harassment for general tier above moderate severity.",
|
|
255
|
+
when: {
|
|
256
|
+
and: [
|
|
257
|
+
{ "==": [{ var: "tier" }, "general"] },
|
|
258
|
+
{ in: [{ var: "category" }, ["hate", "violence", "harassment"]] },
|
|
259
|
+
{ ">=": [{ var: "severity" }, 0.5] }
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
action: "flag",
|
|
263
|
+
priority: 1
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: "general-sexual-flag",
|
|
267
|
+
description: "General tier flags adult sexual content (allowed on the adult tier).",
|
|
268
|
+
when: {
|
|
269
|
+
and: [{ "==": [{ var: "tier" }, "general"] }, { "==": [{ var: "category" }, "sexual"] }]
|
|
270
|
+
},
|
|
271
|
+
action: "flag",
|
|
272
|
+
priority: 1
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
function defaultRulesForTier(tier) {
|
|
276
|
+
switch (tier) {
|
|
277
|
+
case "family":
|
|
278
|
+
return [...COMMON_RULES, ...FAMILY_RULES];
|
|
279
|
+
case "teen":
|
|
280
|
+
return [...COMMON_RULES, ...TEEN_RULES];
|
|
281
|
+
case "general":
|
|
282
|
+
case "adult":
|
|
283
|
+
return [...COMMON_RULES, ...GENERAL_RULES];
|
|
284
|
+
case "dev":
|
|
285
|
+
default:
|
|
286
|
+
return [...COMMON_RULES];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function buildContentPolicyConfig(opts) {
|
|
290
|
+
const tier = opts.tier;
|
|
291
|
+
const strict = tier === "family" || tier === "teen";
|
|
292
|
+
return {
|
|
293
|
+
tier,
|
|
294
|
+
jurisdiction: jurisdictionBundle(opts.region ?? "GLOBAL"),
|
|
295
|
+
rules: opts.rules ?? defaultRulesForTier(tier),
|
|
296
|
+
blocklist: opts.blocklist ?? DEFAULT_BLOCKLIST,
|
|
297
|
+
hardStopCategories: HARD_STOP_CATEGORIES,
|
|
298
|
+
classifier: opts.classifier,
|
|
299
|
+
llm: opts.llm,
|
|
300
|
+
borderlineThreshold: strict ? 0.2 : 0.4,
|
|
301
|
+
alwaysConsultLlm: strict
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/policy/ContentPolicyGate.ts
|
|
306
|
+
chunk356N4NPM_cjs.init_jsonLogic();
|
|
307
|
+
var ACTION_RANK = { allow: 0, flag: 1, escalate: 2, block: 3 };
|
|
308
|
+
function buildFacts(input, config) {
|
|
309
|
+
const j = config.jurisdiction;
|
|
310
|
+
return {
|
|
311
|
+
text: input.text,
|
|
312
|
+
textLength: input.text.length,
|
|
313
|
+
normalizedText: normalizeText(input.text),
|
|
314
|
+
category: "none",
|
|
315
|
+
severity: 0,
|
|
316
|
+
tier: config.tier,
|
|
317
|
+
region: j.region,
|
|
318
|
+
aiActTier: j.aiActTier ?? null,
|
|
319
|
+
minAge: j.minAge ?? null,
|
|
320
|
+
dsaApplies: Boolean(j.dsaApplies),
|
|
321
|
+
surface: input.surface,
|
|
322
|
+
direction: input.direction ?? "output",
|
|
323
|
+
...input.facts ?? {}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function tierApplies(rule, tier) {
|
|
327
|
+
return !rule.appliesToTiers || rule.appliesToTiers.length === 0 || rule.appliesToTiers.includes(tier);
|
|
328
|
+
}
|
|
329
|
+
function regionApplies(rule, region) {
|
|
330
|
+
if (!rule.appliesToRegions || rule.appliesToRegions.length === 0) return true;
|
|
331
|
+
if (region === "GLOBAL") return true;
|
|
332
|
+
return rule.appliesToRegions.includes(region) || rule.appliesToRegions.includes("GLOBAL");
|
|
333
|
+
}
|
|
334
|
+
function applyRules(rules, facts) {
|
|
335
|
+
let block = null;
|
|
336
|
+
let escalate = null;
|
|
337
|
+
let flag = null;
|
|
338
|
+
let allow = null;
|
|
339
|
+
const higher = (cur, r) => !cur || (r.priority ?? 0) > (cur.priority ?? 0) ? r : cur;
|
|
340
|
+
for (const r of rules) {
|
|
341
|
+
if (!tierApplies(r, facts.tier)) continue;
|
|
342
|
+
if (!regionApplies(r, facts.region)) continue;
|
|
343
|
+
if (!chunk356N4NPM_cjs.matchesRule(r.when, facts)) continue;
|
|
344
|
+
switch (r.action) {
|
|
345
|
+
case "block":
|
|
346
|
+
block = higher(block, r);
|
|
347
|
+
break;
|
|
348
|
+
case "escalate":
|
|
349
|
+
escalate = higher(escalate, r);
|
|
350
|
+
break;
|
|
351
|
+
case "flag":
|
|
352
|
+
flag = higher(flag, r);
|
|
353
|
+
break;
|
|
354
|
+
case "allow":
|
|
355
|
+
allow = higher(allow, r);
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (block) return { action: "block", rule: block };
|
|
360
|
+
if (escalate) return { action: "escalate", rule: escalate };
|
|
361
|
+
if (flag && !allow) return { action: "flag", rule: flag };
|
|
362
|
+
if (allow) return { action: "allow", rule: allow };
|
|
363
|
+
return { action: "allow", rule: null };
|
|
364
|
+
}
|
|
365
|
+
function mergeOutcome(a, b) {
|
|
366
|
+
return ACTION_RANK[b.action] > ACTION_RANK[a.action] ? b : a;
|
|
367
|
+
}
|
|
368
|
+
function statementOfReasons(action, classification, rule, facts) {
|
|
369
|
+
if (action === "allow") return null;
|
|
370
|
+
const parts = [
|
|
371
|
+
`action=${action}`,
|
|
372
|
+
`category=${classification.category}`,
|
|
373
|
+
`severity=${classification.severity.toFixed(2)}`,
|
|
374
|
+
`tier=${facts.tier}`,
|
|
375
|
+
`region=${facts.region}`,
|
|
376
|
+
`surface=${facts.surface}`,
|
|
377
|
+
`direction=${facts.direction}`
|
|
378
|
+
];
|
|
379
|
+
if (rule) {
|
|
380
|
+
parts.push(`rule=${rule.id}`);
|
|
381
|
+
if (rule.legalBasis) parts.push(`basis="${rule.legalBasis}"`);
|
|
382
|
+
if (rule.aiActArticle) parts.push(`aiActArticle=${rule.aiActArticle}`);
|
|
383
|
+
} else {
|
|
384
|
+
parts.push("rule=hard-stop");
|
|
385
|
+
}
|
|
386
|
+
return parts.join(" ");
|
|
387
|
+
}
|
|
388
|
+
function finalize(action, classification, rule, facts, config, decidedAtTier, timestampMs) {
|
|
389
|
+
const j = config.jurisdiction;
|
|
390
|
+
const disclosureRequired = Boolean(j.disclosureRequired) && facts.direction === "output";
|
|
391
|
+
const allowed = action === "allow" || action === "flag";
|
|
392
|
+
let reason;
|
|
393
|
+
switch (action) {
|
|
394
|
+
case "block":
|
|
395
|
+
reason = rule ? `Blocked by policy rule ${rule.id}: ${rule.description}` : `Blocked: hard-stop category "${classification.category}".`;
|
|
396
|
+
break;
|
|
397
|
+
case "escalate":
|
|
398
|
+
reason = `Held for human review${rule ? ` (rule ${rule.id})` : ""}: category "${classification.category}".`;
|
|
399
|
+
break;
|
|
400
|
+
case "flag":
|
|
401
|
+
reason = `Allowed but flagged${rule ? ` (rule ${rule.id})` : ""}: category "${classification.category}".`;
|
|
402
|
+
break;
|
|
403
|
+
default:
|
|
404
|
+
reason = "Allowed: no policy rule matched.";
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
allowed,
|
|
408
|
+
action,
|
|
409
|
+
tier: config.tier,
|
|
410
|
+
category: classification.category,
|
|
411
|
+
severity: classification.severity,
|
|
412
|
+
matchedRuleId: rule?.id ?? null,
|
|
413
|
+
reason,
|
|
414
|
+
classification,
|
|
415
|
+
jurisdiction: j,
|
|
416
|
+
statementOfReasons: statementOfReasons(action, classification, rule, facts),
|
|
417
|
+
disclosureRequired,
|
|
418
|
+
decidedAtTier,
|
|
419
|
+
timestampMs
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function evaluateContentPolicySync(input, config) {
|
|
423
|
+
const timestampMs = Date.now();
|
|
424
|
+
const facts = buildFacts(input, config);
|
|
425
|
+
const hardStops = config.hardStopCategories ?? HARD_STOP_CATEGORIES;
|
|
426
|
+
let classification = { category: "none", severity: 0, source: "none" };
|
|
427
|
+
if (config.blocklist && config.blocklist.length) {
|
|
428
|
+
const hit = matchBlocklist(input.text, config.blocklist);
|
|
429
|
+
if (hit) {
|
|
430
|
+
classification = { category: hit.category, severity: hit.severity, source: "blocklist", rationale: hit.rationale };
|
|
431
|
+
if (hit.hardStop || hardStops.includes(hit.category)) {
|
|
432
|
+
const f = { ...facts, category: hit.category, severity: hit.severity };
|
|
433
|
+
return finalize("block", classification, null, f, config, 0, timestampMs);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const facts1 = { ...facts, category: classification.category, severity: classification.severity };
|
|
438
|
+
const outcome = applyRules(config.rules, facts1);
|
|
439
|
+
const tier = outcome.action === "escalate" ? 3 : outcome.action === "allow" ? -1 : 1;
|
|
440
|
+
return finalize(outcome.action, classification, outcome.rule, facts1, config, tier, timestampMs);
|
|
441
|
+
}
|
|
442
|
+
async function evaluateContentPolicy(input, config) {
|
|
443
|
+
const timestampMs = Date.now();
|
|
444
|
+
const facts0 = buildFacts(input, config);
|
|
445
|
+
const hardStops = config.hardStopCategories ?? HARD_STOP_CATEGORIES;
|
|
446
|
+
let classification = { category: "none", severity: 0, source: "none" };
|
|
447
|
+
if (config.blocklist && config.blocklist.length) {
|
|
448
|
+
const hit = matchBlocklist(input.text, config.blocklist);
|
|
449
|
+
if (hit) {
|
|
450
|
+
classification = { category: hit.category, severity: hit.severity, source: "blocklist", rationale: hit.rationale };
|
|
451
|
+
if (hit.hardStop || hardStops.includes(hit.category)) {
|
|
452
|
+
const f = { ...facts0, category: hit.category, severity: hit.severity };
|
|
453
|
+
return finalize("block", classification, null, f, config, 0, timestampMs);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
let facts = { ...facts0, category: classification.category, severity: classification.severity };
|
|
458
|
+
if (config.classifier) {
|
|
459
|
+
const c = await config.classifier(input.text, facts);
|
|
460
|
+
if (c && c.severity >= classification.severity) {
|
|
461
|
+
classification = c;
|
|
462
|
+
facts = { ...facts, category: c.category, severity: c.severity };
|
|
463
|
+
if (hardStops.includes(c.category)) {
|
|
464
|
+
return finalize("block", classification, null, facts, config, 1, timestampMs);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
let outcome = applyRules(config.rules, facts);
|
|
469
|
+
if (outcome.action === "block") {
|
|
470
|
+
return finalize("block", classification, outcome.rule, facts, config, 1, timestampMs);
|
|
471
|
+
}
|
|
472
|
+
const consultLlm = !!config.llm && (config.alwaysConsultLlm === true || classification.category !== "none" || classification.severity >= (config.borderlineThreshold ?? 0.3));
|
|
473
|
+
if (config.llm && consultLlm) {
|
|
474
|
+
const verdict = await config.llm(input.text, facts);
|
|
475
|
+
if (verdict.flagged && verdict.categories.length > 0) {
|
|
476
|
+
const cat = verdict.categories[0];
|
|
477
|
+
if (verdict.severity >= classification.severity) {
|
|
478
|
+
classification = { category: cat, severity: verdict.severity, source: "llm", rationale: verdict.rationale };
|
|
479
|
+
facts = { ...facts, category: cat, severity: verdict.severity };
|
|
480
|
+
}
|
|
481
|
+
if (hardStops.includes(cat)) {
|
|
482
|
+
return finalize("block", classification, null, facts, config, 2, timestampMs);
|
|
483
|
+
}
|
|
484
|
+
const llmOutcome = applyRules(config.rules, facts);
|
|
485
|
+
outcome = mergeOutcome(outcome, llmOutcome);
|
|
486
|
+
if (outcome.action === "block") {
|
|
487
|
+
return finalize("block", classification, outcome.rule, facts, config, 2, timestampMs);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const decidedAtTier = outcome.action === "allow" ? -1 : outcome.action === "escalate" ? 3 : classification.source === "llm" ? 2 : 1;
|
|
492
|
+
return finalize(outcome.action, classification, outcome.rule, facts, config, decidedAtTier, timestampMs);
|
|
493
|
+
}
|
|
494
|
+
function toAuditEventInput(decision, ctx) {
|
|
495
|
+
const outcome = decision.action === "block" || decision.action === "escalate" ? "denied" : "success";
|
|
496
|
+
return {
|
|
497
|
+
tenantId: ctx.tenantId,
|
|
498
|
+
actorId: ctx.actorId,
|
|
499
|
+
actorType: ctx.actorType ?? "agent",
|
|
500
|
+
action: `content_policy:${decision.action}`,
|
|
501
|
+
resource: "content",
|
|
502
|
+
resourceId: ctx.resourceId,
|
|
503
|
+
outcome,
|
|
504
|
+
clientIp: ctx.clientIp,
|
|
505
|
+
metadata: {
|
|
506
|
+
surface: ctx.surface,
|
|
507
|
+
category: decision.category,
|
|
508
|
+
severity: decision.severity,
|
|
509
|
+
tier: decision.tier,
|
|
510
|
+
region: decision.jurisdiction.region,
|
|
511
|
+
matchedRuleId: decision.matchedRuleId,
|
|
512
|
+
decidedAtTier: decision.decidedAtTier,
|
|
513
|
+
disclosureRequired: decision.disclosureRequired,
|
|
514
|
+
statementOfReasons: decision.statementOfReasons,
|
|
515
|
+
_compliance: "dsa-statement-of-reasons"
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/policy/PolicyPack.ts
|
|
521
|
+
var POLICY_PACK_FRAMEWORK_IDS = [
|
|
522
|
+
"EU_AI_ACT_HIGH_RISK",
|
|
523
|
+
"NIST_AI_RMF",
|
|
524
|
+
"ISO_42001",
|
|
525
|
+
"CFPB_FAIR_LENDING",
|
|
526
|
+
"NYC_LL144",
|
|
527
|
+
"EEOC",
|
|
528
|
+
"COLORADO_SB21_169"
|
|
529
|
+
];
|
|
530
|
+
var POLICY_PACK_COMPILE_TARGETS = [
|
|
531
|
+
"bias_audit_report",
|
|
532
|
+
"model_card",
|
|
533
|
+
"impact_assessment",
|
|
534
|
+
"declaration_of_conformity"
|
|
535
|
+
];
|
|
536
|
+
var POLICY_PACK_AUDIT_STORES = ["append_only", "immutable_ledger", "external_archive"];
|
|
537
|
+
var POLICY_PACK_MONITORING_INTERVALS = [
|
|
538
|
+
"per_deploy",
|
|
539
|
+
"daily",
|
|
540
|
+
"weekly",
|
|
541
|
+
"monthly",
|
|
542
|
+
"quarterly",
|
|
543
|
+
"annual"
|
|
544
|
+
];
|
|
545
|
+
var PolicyPackDeploymentError = class extends Error {
|
|
546
|
+
constructor(evaluation) {
|
|
547
|
+
super(
|
|
548
|
+
`PolicyPack "${evaluation.policyPack}" refused deploy: ` + evaluation.issues.map((issue) => issue.code).join(", ")
|
|
549
|
+
);
|
|
550
|
+
this.evaluation = evaluation;
|
|
551
|
+
this.name = "PolicyPackDeploymentError";
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
var PolicyPackDefinitionError = class extends Error {
|
|
555
|
+
constructor(issues) {
|
|
556
|
+
super(`Invalid PolicyPack: ${issues.map((issue) => issue.message).join("; ")}`);
|
|
557
|
+
this.issues = issues;
|
|
558
|
+
this.name = "PolicyPackDefinitionError";
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
function isPolicyPackFrameworkId(value) {
|
|
562
|
+
return POLICY_PACK_FRAMEWORK_IDS.includes(value);
|
|
563
|
+
}
|
|
564
|
+
function isPolicyPackCompileTarget(value) {
|
|
565
|
+
return POLICY_PACK_COMPILE_TARGETS.includes(value);
|
|
566
|
+
}
|
|
567
|
+
function isAuditStore(value) {
|
|
568
|
+
return POLICY_PACK_AUDIT_STORES.includes(value);
|
|
569
|
+
}
|
|
570
|
+
function isMonitoringInterval(value) {
|
|
571
|
+
return POLICY_PACK_MONITORING_INTERVALS.includes(value);
|
|
572
|
+
}
|
|
573
|
+
function validatePolicyPack(pack) {
|
|
574
|
+
const issues = [];
|
|
575
|
+
if (!pack.name.trim()) {
|
|
576
|
+
issues.push({ code: "invalid_pack", severity: "error", message: "PolicyPack name is required." });
|
|
577
|
+
}
|
|
578
|
+
if (!pack.version.trim()) {
|
|
579
|
+
issues.push({ code: "invalid_pack", severity: "error", message: "PolicyPack version is required." });
|
|
580
|
+
}
|
|
581
|
+
if (!isPolicyPackFrameworkId(pack.frameworkId)) {
|
|
582
|
+
issues.push({
|
|
583
|
+
code: "invalid_framework",
|
|
584
|
+
severity: "error",
|
|
585
|
+
message: `Unknown frameworkId "${pack.frameworkId}".`
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
if (pack.requiredTests.length === 0) {
|
|
589
|
+
issues.push({
|
|
590
|
+
code: "invalid_pack",
|
|
591
|
+
severity: "error",
|
|
592
|
+
message: "PolicyPack requires at least one FairnessSweep test."
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
for (const test of pack.requiredTests) {
|
|
596
|
+
if (!test.id.trim() || !test.protectedAttribute.trim()) {
|
|
597
|
+
issues.push({
|
|
598
|
+
code: "invalid_pack",
|
|
599
|
+
severity: "error",
|
|
600
|
+
message: "Every required FairnessSweep needs id and protectedAttribute.",
|
|
601
|
+
testId: test.id
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
for (const target of pack.requiredCompileTargets) {
|
|
606
|
+
if (!isPolicyPackCompileTarget(target)) {
|
|
607
|
+
issues.push({
|
|
608
|
+
code: "invalid_compile_target",
|
|
609
|
+
severity: "error",
|
|
610
|
+
message: `Unknown policy-pack compile target "${target}".`,
|
|
611
|
+
compileTarget: target
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (pack.requiredCompileTargets.length === 0) {
|
|
616
|
+
issues.push({
|
|
617
|
+
code: "invalid_pack",
|
|
618
|
+
severity: "error",
|
|
619
|
+
message: "PolicyPack requires at least one compliance compile target."
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
if (!Number.isFinite(pack.auditRetention.minDays) || pack.auditRetention.minDays <= 0) {
|
|
623
|
+
issues.push({
|
|
624
|
+
code: "invalid_pack",
|
|
625
|
+
severity: "error",
|
|
626
|
+
message: "auditRetention.minDays must be a positive number."
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
if (!isAuditStore(pack.auditRetention.storage)) {
|
|
630
|
+
issues.push({
|
|
631
|
+
code: "invalid_pack",
|
|
632
|
+
severity: "error",
|
|
633
|
+
message: `Unknown audit retention storage "${pack.auditRetention.storage}".`
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
if (!isMonitoringInterval(pack.monitoringCadence.interval)) {
|
|
637
|
+
issues.push({
|
|
638
|
+
code: "invalid_pack",
|
|
639
|
+
severity: "error",
|
|
640
|
+
message: `Unknown monitoring interval "${pack.monitoringCadence.interval}".`
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
return issues;
|
|
644
|
+
}
|
|
645
|
+
function definePolicyPack(input) {
|
|
646
|
+
const pack = { ...input, type: "PolicyPack" };
|
|
647
|
+
const issues = validatePolicyPack(pack);
|
|
648
|
+
if (issues.some((issue) => issue.severity === "error")) {
|
|
649
|
+
throw new PolicyPackDefinitionError(issues);
|
|
650
|
+
}
|
|
651
|
+
return pack;
|
|
652
|
+
}
|
|
653
|
+
function asRecord(value) {
|
|
654
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
655
|
+
}
|
|
656
|
+
function field(record, ...names) {
|
|
657
|
+
for (const name of names) {
|
|
658
|
+
if (record[name] !== void 0) return record[name];
|
|
659
|
+
}
|
|
660
|
+
return void 0;
|
|
661
|
+
}
|
|
662
|
+
function stringField(record, fallback, ...names) {
|
|
663
|
+
const value = field(record, ...names);
|
|
664
|
+
return typeof value === "string" ? value : fallback;
|
|
665
|
+
}
|
|
666
|
+
function numberField(record, fallback, ...names) {
|
|
667
|
+
const value = field(record, ...names);
|
|
668
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
669
|
+
}
|
|
670
|
+
function booleanField(record, ...names) {
|
|
671
|
+
const value = field(record, ...names);
|
|
672
|
+
return typeof value === "boolean" ? value : void 0;
|
|
673
|
+
}
|
|
674
|
+
function arrayField(value) {
|
|
675
|
+
return Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
676
|
+
}
|
|
677
|
+
function normalizeRequiredFairnessSweep(value, index) {
|
|
678
|
+
const record = asRecord(value);
|
|
679
|
+
const out = {
|
|
680
|
+
id: stringField(record, `fairness_sweep_${index + 1}`, "id", "name"),
|
|
681
|
+
protectedAttribute: stringField(record, "group", "protectedAttribute", "protected_attribute")
|
|
682
|
+
};
|
|
683
|
+
const minSampleSize = numberField(record, Number.NaN, "minSampleSize", "min_sample_size");
|
|
684
|
+
if (Number.isFinite(minSampleSize)) out.minSampleSize = minSampleSize;
|
|
685
|
+
const adverseImpactRatioMin = numberField(
|
|
686
|
+
record,
|
|
687
|
+
Number.NaN,
|
|
688
|
+
"adverseImpactRatioMin",
|
|
689
|
+
"adverse_impact_ratio_min"
|
|
690
|
+
);
|
|
691
|
+
if (Number.isFinite(adverseImpactRatioMin)) out.adverseImpactRatioMin = adverseImpactRatioMin;
|
|
692
|
+
const demographicParityDiffMax = numberField(
|
|
693
|
+
record,
|
|
694
|
+
Number.NaN,
|
|
695
|
+
"demographicParityDiffMax",
|
|
696
|
+
"demographic_parity_diff_max"
|
|
697
|
+
);
|
|
698
|
+
if (Number.isFinite(demographicParityDiffMax)) {
|
|
699
|
+
out.demographicParityDiffMax = demographicParityDiffMax;
|
|
700
|
+
}
|
|
701
|
+
const requireRobustnessReceipt = booleanField(
|
|
702
|
+
record,
|
|
703
|
+
"requireRobustnessReceipt",
|
|
704
|
+
"require_robustness_receipt"
|
|
705
|
+
);
|
|
706
|
+
if (requireRobustnessReceipt !== void 0) out.requireRobustnessReceipt = requireRobustnessReceipt;
|
|
707
|
+
out.config = record;
|
|
708
|
+
return out;
|
|
709
|
+
}
|
|
710
|
+
function normalizeAuditRetention(record) {
|
|
711
|
+
return {
|
|
712
|
+
minDays: numberField(record, 0, "minDays", "min_days"),
|
|
713
|
+
storage: stringField(record, "", "storage"),
|
|
714
|
+
legalHold: booleanField(record, "legalHold", "legal_hold")
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
function normalizeMonitoringCadence(record) {
|
|
718
|
+
const cadence = {
|
|
719
|
+
interval: stringField(record, "", "interval")
|
|
720
|
+
};
|
|
721
|
+
const driftSweepRequired = booleanField(record, "driftSweepRequired", "drift_sweep_required");
|
|
722
|
+
if (driftSweepRequired !== void 0) cadence.driftSweepRequired = driftSweepRequired;
|
|
723
|
+
const alertThreshold = numberField(record, Number.NaN, "alertThreshold", "alert_threshold");
|
|
724
|
+
if (Number.isFinite(alertThreshold)) cadence.alertThreshold = alertThreshold;
|
|
725
|
+
return cadence;
|
|
726
|
+
}
|
|
727
|
+
function policyPackFromSchemaBlock(block) {
|
|
728
|
+
const properties = block.properties ?? {};
|
|
729
|
+
const frameworkId = block.frameworkId ?? stringField(properties, "", "framework_id", "frameworkId");
|
|
730
|
+
const rawTests = block.requiredTests ?? arrayField(field(properties, "required_tests", "requiredTests"));
|
|
731
|
+
const rawTargets = block.requiredCompileTargets ?? arrayField(field(properties, "required_compile_targets", "requiredCompileTargets"));
|
|
732
|
+
const auditRetention = block.auditRetention ?? asRecord(field(properties, "audit_retention", "auditRetention"));
|
|
733
|
+
const monitoringCadence = block.monitoringCadence ?? asRecord(field(properties, "monitoring", "monitoring_cadence", "monitoringCadence"));
|
|
734
|
+
return definePolicyPack({
|
|
735
|
+
name: block.name,
|
|
736
|
+
version: block.version ?? stringField(properties, "1.0.0", "version"),
|
|
737
|
+
frameworkId,
|
|
738
|
+
requiredTests: rawTests.map(normalizeRequiredFairnessSweep),
|
|
739
|
+
requiredCompileTargets: rawTargets.map((target) => String(target)),
|
|
740
|
+
auditRetention: normalizeAuditRetention(auditRetention),
|
|
741
|
+
monitoringCadence: normalizeMonitoringCadence(monitoringCadence),
|
|
742
|
+
metadata: properties
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function evaluatePolicyPackDeployment(pack, evidence) {
|
|
746
|
+
const issues = validatePolicyPack(pack);
|
|
747
|
+
const testEvidence = new Map(evidence.tests.map((test) => [test.id, test]));
|
|
748
|
+
const artifactTargets = new Set(evidence.compileTargets.map((artifact) => artifact.target));
|
|
749
|
+
const missingTests = [];
|
|
750
|
+
const failedTests = [];
|
|
751
|
+
const missingCompileTargets = [];
|
|
752
|
+
for (const required of pack.requiredTests) {
|
|
753
|
+
const observed = testEvidence.get(required.id);
|
|
754
|
+
if (!observed) {
|
|
755
|
+
missingTests.push(required.id);
|
|
756
|
+
issues.push({
|
|
757
|
+
code: "missing_required_test",
|
|
758
|
+
severity: "error",
|
|
759
|
+
message: `Missing required FairnessSweep evidence "${required.id}".`,
|
|
760
|
+
testId: required.id
|
|
761
|
+
});
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
const ratioFloor = required.adverseImpactRatioMin ?? 0.8;
|
|
765
|
+
const ratio = observed.adverseImpactRatio;
|
|
766
|
+
const parityDiff = observed.demographicParityDiff;
|
|
767
|
+
const failed = !observed.passed || required.minSampleSize !== void 0 && (observed.sampleSize ?? 0) < required.minSampleSize || ratio !== void 0 && ratio < ratioFloor || required.demographicParityDiffMax !== void 0 && (parityDiff === void 0 || parityDiff > required.demographicParityDiffMax) || required.requireRobustnessReceipt === true && !observed.robustnessReceiptHash;
|
|
768
|
+
if (failed) {
|
|
769
|
+
failedTests.push(required.id);
|
|
770
|
+
issues.push({
|
|
771
|
+
code: "failed_required_test",
|
|
772
|
+
severity: "error",
|
|
773
|
+
message: `Required FairnessSweep "${required.id}" did not satisfy the policy pack.`,
|
|
774
|
+
testId: required.id
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
for (const target of pack.requiredCompileTargets) {
|
|
779
|
+
if (!artifactTargets.has(target)) {
|
|
780
|
+
missingCompileTargets.push(target);
|
|
781
|
+
issues.push({
|
|
782
|
+
code: "missing_compile_target",
|
|
783
|
+
severity: "error",
|
|
784
|
+
message: `Missing required compliance artifact "${target}".`,
|
|
785
|
+
compileTarget: target
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
if (evidence.auditRetentionAccepted !== true) {
|
|
790
|
+
issues.push({
|
|
791
|
+
code: "audit_retention_not_armed",
|
|
792
|
+
severity: "error",
|
|
793
|
+
message: "Audit retention policy has not been accepted by the deploy gate."
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
if (evidence.monitoringScheduled !== true) {
|
|
797
|
+
issues.push({
|
|
798
|
+
code: "monitoring_not_scheduled",
|
|
799
|
+
severity: "error",
|
|
800
|
+
message: "Monitoring cadence has not been scheduled for the deployment."
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
return {
|
|
804
|
+
allowed: !issues.some((issue) => issue.severity === "error"),
|
|
805
|
+
policyPack: pack.name,
|
|
806
|
+
frameworkId: pack.frameworkId,
|
|
807
|
+
missingTests,
|
|
808
|
+
failedTests,
|
|
809
|
+
missingCompileTargets,
|
|
810
|
+
issues
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function assertPolicyPackDeploymentReady(pack, evidence) {
|
|
814
|
+
const evaluation = evaluatePolicyPackDeployment(pack, evidence);
|
|
815
|
+
if (!evaluation.allowed) {
|
|
816
|
+
throw new PolicyPackDeploymentError(evaluation);
|
|
817
|
+
}
|
|
818
|
+
return evaluation;
|
|
819
|
+
}
|
|
820
|
+
function defaultPolicyPackCompileTargets() {
|
|
821
|
+
return [...POLICY_PACK_COMPILE_TARGETS];
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
exports.DEFAULT_BLOCKLIST = DEFAULT_BLOCKLIST;
|
|
825
|
+
exports.HARD_STOP_CATEGORIES = HARD_STOP_CATEGORIES;
|
|
826
|
+
exports.POLICY_PACK_COMPILE_TARGETS = POLICY_PACK_COMPILE_TARGETS;
|
|
827
|
+
exports.POLICY_PACK_FRAMEWORK_IDS = POLICY_PACK_FRAMEWORK_IDS;
|
|
828
|
+
exports.PolicyPackDefinitionError = PolicyPackDefinitionError;
|
|
829
|
+
exports.PolicyPackDeploymentError = PolicyPackDeploymentError;
|
|
830
|
+
exports.assertPolicyPackDeploymentReady = assertPolicyPackDeploymentReady;
|
|
831
|
+
exports.buildContentPolicyConfig = buildContentPolicyConfig;
|
|
832
|
+
exports.defaultPolicyPackCompileTargets = defaultPolicyPackCompileTargets;
|
|
833
|
+
exports.defaultRulesForTier = defaultRulesForTier;
|
|
834
|
+
exports.definePolicyPack = definePolicyPack;
|
|
835
|
+
exports.evaluateContentPolicy = evaluateContentPolicy;
|
|
836
|
+
exports.evaluateContentPolicySync = evaluateContentPolicySync;
|
|
837
|
+
exports.evaluatePolicyPackDeployment = evaluatePolicyPackDeployment;
|
|
838
|
+
exports.isPolicyPackCompileTarget = isPolicyPackCompileTarget;
|
|
839
|
+
exports.isPolicyPackFrameworkId = isPolicyPackFrameworkId;
|
|
840
|
+
exports.jurisdictionBundle = jurisdictionBundle;
|
|
841
|
+
exports.matchBlocklist = matchBlocklist;
|
|
842
|
+
exports.normalizeText = normalizeText;
|
|
843
|
+
exports.policyPackFromSchemaBlock = policyPackFromSchemaBlock;
|
|
844
|
+
exports.toAuditEventInput = toAuditEventInput;
|
|
845
|
+
exports.validatePolicyPack = validatePolicyPack;
|
|
846
|
+
//# sourceMappingURL=chunk-7VBKRGIZ.cjs.map
|
|
847
|
+
//# sourceMappingURL=chunk-7VBKRGIZ.cjs.map
|