@holoscript/core 6.0.4 → 6.1.2
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/README.md +3 -3
- package/bin/holoscript.cjs +3 -0
- package/dist/GLTFPipeline-SFIORFJU.js +16 -0
- package/dist/GLTFPipeline-VNNDPONV.cjs +37 -0
- package/dist/{HoloScriptPlusParser-BN6KVRCM.js → HoloScriptPlusParser-7FBIFUFC.js} +6 -5
- package/dist/{HoloScriptPlusParser-NC5FE6AL.cjs → HoloScriptPlusParser-A2W7OCN2.cjs} +17 -16
- package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
- package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
- package/dist/{USDZExporter-UWGWNMMD.cjs → USDZExporter-3FWJ25JI.cjs} +344 -16
- package/dist/{USDZExporter-NTMBNTDB.js → USDZExporter-D2HQLQYK.js} +344 -16
- package/dist/agents/index.cjs +19 -0
- package/dist/agents/index.d.ts +100 -0
- package/dist/agents/index.js +17 -0
- package/dist/chunk-22W6NGYN.js +725 -0
- package/dist/{chunk-5OEOHAAW.cjs → chunk-27MPVJVZ.cjs} +64 -28
- package/dist/{chunk-RVYPEYPX.js → chunk-2A7FURVO.js} +44 -8
- package/dist/{chunk-XCWFGZAA.js → chunk-2B7WVIDZ.js} +11 -8
- package/dist/{chunk-NDQNIJEH.js → chunk-2BSMSUCE.js} +250 -24
- package/dist/chunk-2HLIGOKU.cjs +5546 -0
- package/dist/{chunk-EONILVMF.js → chunk-2M2DPHKB.js} +4 -4
- package/dist/{chunk-G7CT3EMP.cjs → chunk-2YSNA2F2.cjs} +319 -47
- package/dist/{chunk-IWI6J7FX.js → chunk-33XCOVE3.js} +5 -5
- package/dist/chunk-3FOKASKO.cjs +348 -0
- package/dist/{chunk-DXJQDCFL.js → chunk-4C57PR42.js} +3 -3
- package/dist/{chunk-MPXBVFHQ.js → chunk-4N4SXXWF.js} +4 -3
- package/dist/chunk-4PDEPEQW.cjs +41 -0
- package/dist/chunk-4R6HPSHJ.js +2176 -0
- package/dist/chunk-4R6SBXDB.js +45 -0
- package/dist/chunk-4SY77NA4.cjs +413 -0
- package/dist/{chunk-YCXFCXDS.js → chunk-4UUKPCY4.js} +668 -110
- package/dist/{chunk-LGGRPKTV.cjs → chunk-52ULD552.cjs} +114 -35
- package/dist/{chunk-L4G4RLXX.js → chunk-5CKA5SXU.js} +438 -22
- package/dist/chunk-5FSKKMR7.cjs +2092 -0
- package/dist/{chunk-FF3Q7ADR.js → chunk-5JEU52DW.js} +5 -3
- package/dist/chunk-5N54COB6.cjs +327 -0
- package/dist/chunk-5S7RKFGR.cjs +446 -0
- package/dist/{chunk-KED34ILP.js → chunk-6ASWLXXN.js} +21 -9
- package/dist/chunk-6CTRH7HT.cjs +1985 -0
- package/dist/{chunk-CAUCGUEA.cjs → chunk-6EX3I5P4.cjs} +6 -6
- package/dist/chunk-6FGQNDR4.js +5731 -0
- package/dist/{chunk-72EQECGT.cjs → chunk-6KMK2UXT.cjs} +122 -46
- package/dist/{chunk-G4VZTCIB.js → chunk-6L4VE27M.js} +33 -23
- package/dist/{chunk-ATSKSYVE.cjs → chunk-6S6TKNEA.cjs} +6478 -1738
- package/dist/chunk-77V4GTCA.js +596 -0
- package/dist/{chunk-ZP4D3CSX.cjs → chunk-7AD52FRS.cjs} +16 -16
- package/dist/chunk-A6KINLZJ.js +236 -0
- package/dist/chunk-AIA52I7T.cjs +543 -0
- package/dist/chunk-AIX25INK.cjs +602 -0
- package/dist/{chunk-B5TCIAPQ.cjs → chunk-AO4I2Z7M.cjs} +17 -18
- package/dist/{chunk-Q5SJOGHQ.cjs → chunk-BPICAGBV.cjs} +324 -199
- package/dist/chunk-BRQJKJGT.cjs +20 -0
- package/dist/{chunk-3FXV5S25.cjs → chunk-C37BHB7N.cjs} +6 -3
- package/dist/{chunk-XUTX5CBW.js → chunk-CBJY23VL.js} +3 -3
- package/dist/chunk-CIWWXYHZ.cjs +50 -0
- package/dist/{chunk-XXINBTZK.cjs → chunk-DIL6DDDN.cjs} +101 -45
- package/dist/chunk-DMXC24WV.js +404 -0
- package/dist/{chunk-PMGODDJA.cjs → chunk-DTGBOSEM.cjs} +12 -12
- package/dist/chunk-E7JP3BS3.cjs +61 -0
- package/dist/{chunk-HJJLD366.js → chunk-EKBKLK7P.js} +3 -3
- package/dist/chunk-EKYL4PE3.cjs +404 -0
- package/dist/{chunk-UPJBDCVF.js → chunk-EMMC5CSQ.js} +12 -8
- package/dist/{chunk-GGHSW2NN.js → chunk-EOBB6A4B.js} +6389 -1718
- package/dist/chunk-EOFNVCM6.js +325 -0
- package/dist/{chunk-FHQVYCH2.js → chunk-ER4GATIU.js} +7 -7
- package/dist/{chunk-N5FTS757.cjs → chunk-EXKSFGSX.cjs} +7 -148
- package/dist/{chunk-LK5IAVH6.cjs → chunk-EXUP2BUM.cjs} +27 -27
- package/dist/chunk-FDSGHPAK.js +130 -0
- package/dist/chunk-FEWUHQNM.cjs +144 -0
- package/dist/{chunk-5TOFIR6L.js → chunk-FGGJQRLZ.js} +5 -142
- package/dist/chunk-FHP6LXJS.js +415 -0
- package/dist/{chunk-7LCYLPW2.cjs → chunk-FJPADH77.cjs} +7 -4
- package/dist/{chunk-T36DDXSF.js → chunk-FXKTYFYA.js} +150 -25
- package/dist/chunk-G2LS3RFO.js +623 -0
- package/dist/chunk-GCMWDSBZ.cjs +729 -0
- package/dist/chunk-GJNCFRJU.cjs +125 -0
- package/dist/{chunk-Q4QX3AET.cjs → chunk-GMP623FG.cjs} +16 -13
- package/dist/{chunk-XD6IYDUX.js → chunk-GN3KDX4W.js} +119 -43
- package/dist/{chunk-QLEAOI3Q.cjs → chunk-GQYKQSTC.cjs} +10 -10
- package/dist/chunk-GTU2Z2WW.cjs +262 -0
- package/dist/chunk-GZG4KA4E.js +529 -0
- package/dist/{chunk-BND3ST2K.cjs → chunk-H3MGK7TX.cjs} +42 -32
- package/dist/{chunk-XRKWN5PL.cjs → chunk-H5DZIHJP.cjs} +14 -18
- package/dist/{chunk-Z34RLXRA.cjs → chunk-HANL7K2Q.cjs} +65 -50
- package/dist/{chunk-3SAK5KFL.cjs → chunk-HCCQLAA4.cjs} +2 -11
- package/dist/{chunk-LXJ4667L.cjs → chunk-HGVXZDSK.cjs} +108 -20
- package/dist/{chunk-3FJCK5XA.js → chunk-HRODTEEO.js} +30 -10
- package/dist/{chunk-HQUEA5R6.cjs → chunk-HZCQO4JM.cjs} +6 -6
- package/dist/{chunk-S565K7NK.js → chunk-I2O7TW6B.js} +12 -8
- package/dist/chunk-IHESJZSW.js +4490 -0
- package/dist/{chunk-FSF7EQVA.cjs → chunk-IRWWS72C.cjs} +63 -22
- package/dist/{chunk-5O6TQC6M.cjs → chunk-IVIA7K75.cjs} +689 -127
- package/dist/chunk-IVY74O6C.js +247 -0
- package/dist/chunk-J32ZJZJH.js +554 -0
- package/dist/chunk-J56PTA46.cjs +639 -0
- package/dist/chunk-JD7CIZ33.js +1949 -0
- package/dist/{chunk-T7LEXZUZ.cjs → chunk-JIYN45TV.cjs} +14 -15
- package/dist/{chunk-FFKU7BTK.cjs → chunk-KHPCJRI3.cjs} +24 -21
- package/dist/chunk-KKFZ3B6J.cjs +557 -0
- package/dist/chunk-KPJL34Y7.cjs +186 -0
- package/dist/{chunk-HE7ULERA.cjs → chunk-KQTPCYTG.cjs} +128 -44
- package/dist/{chunk-OFKWH2IP.js → chunk-KX76JUQY.js} +3 -3
- package/dist/{chunk-33LSUQDD.cjs → chunk-L63H3SQ4.cjs} +43 -31
- package/dist/{chunk-K6EKD26I.js → chunk-LAOCQJ2M.js} +64 -8
- package/dist/chunk-LM2VU56C.cjs +37 -0
- package/dist/chunk-M56JSP4A.js +400 -0
- package/dist/chunk-MBOOR7X4.js +18 -0
- package/dist/{chunk-XWPNTWDN.cjs → chunk-MJVIRCUV.cjs} +31 -27
- package/dist/{chunk-SDAMZIRE.js → chunk-MSMIFMBL.js} +135 -18
- package/dist/{chunk-56IF4NTA.js → chunk-MXFUTKCO.js} +18 -18
- package/dist/{chunk-6UEHYZ7V.cjs → chunk-MXJ5SS53.cjs} +447 -31
- package/dist/chunk-MYY4PMWX.cjs +264 -0
- package/dist/chunk-N75IH2HY.js +258 -0
- package/dist/{chunk-GVUR45UF.cjs → chunk-NG77ATEW.cjs} +7 -6
- package/dist/chunk-NW5G5FBQ.js +215 -0
- package/dist/{chunk-E3FWRT3Z.js → chunk-OEFY723R.js} +28 -13
- package/dist/chunk-OEV5RMZO.cjs +3042 -0
- package/dist/{chunk-X4ZF6CNE.cjs → chunk-OIQYIIO3.cjs} +7 -7
- package/dist/{chunk-2CWOLHTE.js → chunk-OL46QLBJ.js} +3 -11
- package/dist/chunk-OPZ7XDDI.js +487 -0
- package/dist/chunk-OSYNRVOV.cjs +243 -0
- package/dist/{chunk-TEWCN33Y.js → chunk-P7YIA5LN.js} +91 -7
- package/dist/chunk-PGANYCAG.cjs +220 -0
- package/dist/{chunk-CS2EMTGF.js → chunk-QAVXL2IH.js} +62 -21
- package/dist/{chunk-T4NKMBDL.js → chunk-QCCBXSCE.js} +1666 -756
- package/dist/{chunk-F4IULT7N.js → chunk-QPOQ7VPI.js} +16 -13
- package/dist/{chunk-6XSERL6L.js → chunk-QTPMJRGS.js} +3108 -2827
- package/dist/{chunk-F3HH56EB.cjs → chunk-QWNQ523V.cjs} +1730 -823
- package/dist/{chunk-R7MA7QWV.js → chunk-R3IVNY6P.js} +102 -23
- package/dist/chunk-R75BSDH7.cjs +50 -0
- package/dist/chunk-RAXUF5DF.cjs +2196 -0
- package/dist/{chunk-BF2235SI.cjs → chunk-RMHC2VG7.cjs} +2876 -2592
- package/dist/chunk-RUXGBKPS.cjs +4517 -0
- package/dist/{chunk-UERJ3YJV.js → chunk-S5IFXW6E.js} +113 -9
- package/dist/{chunk-27LWW5FU.cjs → chunk-S6YWHCKV.cjs} +5 -5
- package/dist/{chunk-WB4Z63GG.js → chunk-SIEXCILW.js} +3 -3
- package/dist/{chunk-CLYEIWA5.cjs → chunk-SLU6UPJI.cjs} +5 -3
- package/dist/{chunk-LZ266PCM.cjs → chunk-T5J7ZKP3.cjs} +446 -60
- package/dist/chunk-TDCNJHWO.js +341 -0
- package/dist/{chunk-IHOUYQIA.js → chunk-TG7O4WBC.js} +5 -5
- package/dist/chunk-THCK6ECW.js +2085 -0
- package/dist/chunk-TJHVSBP2.js +439 -0
- package/dist/chunk-TK74TR4H.js +5541 -0
- package/dist/{chunk-CDPGV4DN.js → chunk-U4NBQJBY.js} +14 -15
- package/dist/{chunk-NOZZ46QU.js → chunk-UD3DSHZM.js} +10 -14
- package/dist/chunk-UDMYRFDZ.js +3038 -0
- package/dist/{chunk-WDW67DZB.cjs → chunk-UOIGFQXC.cjs} +90 -68
- package/dist/{chunk-BU7VWW2K.js → chunk-URG2SJLK.js} +14 -15
- package/dist/{chunk-EQV4R3EV.cjs → chunk-V73NPPTM.cjs} +152 -35
- package/dist/chunk-VECQYRXL.js +474 -0
- package/dist/chunk-VEXPG4WN.js +1989 -0
- package/dist/{chunk-LDP5OK6G.js → chunk-VMLKSV26.js} +5 -5
- package/dist/{chunk-5BGSECRJ.cjs → chunk-VSK7W3O5.cjs} +47 -27
- package/dist/chunk-VVKVQZI6.js +55 -0
- package/dist/{chunk-YQK5JNFK.js → chunk-W55Z7QIX.js} +103 -15
- package/dist/{chunk-KSGXLT74.cjs → chunk-W6P2GBHH.cjs} +3 -3
- package/dist/{chunk-IBDG74G2.cjs → chunk-W6RW64BB.cjs} +7 -7
- package/dist/chunk-WDT3JTGM.cjs +483 -0
- package/dist/{chunk-HPS76H7Q.js → chunk-WKX5AMOY.js} +3 -3
- package/dist/chunk-WNNE3PO3.js +34 -0
- package/dist/{chunk-XG23EUQX.cjs → chunk-WRLUBRKS.cjs} +538 -312
- package/dist/{chunk-IFNQFCTM.js → chunk-WRNEH5MO.js} +79 -8
- package/dist/{chunk-54FHG2MX.js → chunk-WRWEX5ZF.js} +7 -4
- package/dist/{chunk-KCQ5NDYC.cjs → chunk-X3GJPRVK.cjs} +154 -80
- package/dist/{chunk-7AGYRWKW.cjs → chunk-XFXGA5IW.cjs} +126 -22
- package/dist/{chunk-TQSZUOW5.cjs → chunk-XHIV6326.cjs} +4 -4
- package/dist/chunk-XJAN7CZG.cjs +432 -0
- package/dist/chunk-XL6INWKT.js +121 -0
- package/dist/{chunk-E3UALNFA.js → chunk-XMWZG36H.js} +4 -4
- package/dist/{chunk-BKIGPPVM.js → chunk-XSFNHP2E.js} +6 -3
- package/dist/{chunk-H5Z7NASB.js → chunk-XT6JY5W5.js} +25 -3
- package/dist/chunk-XXZJEFKW.cjs +490 -0
- package/dist/chunk-Y3MWXQSB.cjs +5737 -0
- package/dist/chunk-YF2I3MV3.js +46 -0
- package/dist/{chunk-V3NN3HPP.js → chunk-YIMN575O.js} +437 -52
- package/dist/chunk-YIVFJNYV.js +176 -0
- package/dist/{chunk-MD6KDHVE.cjs → chunk-YKGPCZEE.cjs} +10 -10
- package/dist/chunk-YQELFNJV.js +39 -0
- package/dist/chunk-Z5XMPRNC.cjs +5390 -0
- package/dist/{chunk-3FYZOR7S.cjs → chunk-ZDSYWBIE.cjs} +18 -18
- package/dist/{chunk-6TZPZCOJ.cjs → chunk-ZKSS47EV.cjs} +24 -19
- package/dist/chunk-ZUL5AVTX.cjs +1993 -0
- package/dist/chunk-ZXBZVXDW.js +5386 -0
- package/dist/{chunk-DMG7C4H2.js → chunk-ZZ7RO2UQ.js} +312 -44
- package/dist/cli/holoscript-runner.cjs +200 -204
- package/dist/cli/holoscript-runner.js +144 -148
- package/dist/codebase/index.cjs +1 -1
- package/dist/codebase/index.js +1 -1
- package/dist/compiler/agent-inference.cjs +10 -7
- package/dist/compiler/agent-inference.js +6 -3
- package/dist/compiler/android-xr.cjs +12 -7
- package/dist/compiler/android-xr.js +10 -5
- package/dist/compiler/android.cjs +12 -8
- package/dist/compiler/android.js +10 -6
- package/dist/compiler/ar.cjs +9 -6
- package/dist/compiler/ar.js +7 -4
- package/dist/compiler/babylon.cjs +12 -8
- package/dist/compiler/babylon.js +11 -7
- package/dist/compiler/business-quest.cjs +43 -0
- package/dist/compiler/business-quest.js +4 -0
- package/dist/compiler/coco.cjs +1 -1
- package/dist/compiler/coco.js +1 -1
- package/dist/compiler/context.cjs +25 -0
- package/dist/compiler/context.d.ts +28 -0
- package/dist/compiler/context.js +8 -0
- package/dist/compiler/domain-block-utils.cjs +155 -152
- package/dist/compiler/domain-block-utils.js +7 -4
- package/dist/compiler/dtdl.cjs +10 -7
- package/dist/compiler/dtdl.js +7 -4
- package/dist/compiler/gltf-pipeline.cjs +9 -9
- package/dist/compiler/gltf-pipeline.js +2 -2
- package/dist/compiler/godot.cjs +9 -6
- package/dist/compiler/godot.js +8 -5
- package/dist/compiler/incremental.cjs +12 -7
- package/dist/compiler/incremental.js +7 -2
- package/dist/compiler/index.cjs +3550 -268
- package/dist/compiler/index.d.ts +404 -21
- package/dist/compiler/index.js +3280 -138
- package/dist/compiler/ios.cjs +11 -8
- package/dist/compiler/ios.js +9 -6
- package/dist/compiler/llm-provider-capabilities.cjs +25 -0
- package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
- package/dist/compiler/llm-provider-capabilities.js +8 -0
- package/dist/compiler/multi-layer.cjs +14 -10
- package/dist/compiler/multi-layer.js +13 -9
- package/dist/compiler/nodetoy.cjs +5 -5
- package/dist/compiler/nodetoy.js +2 -2
- package/dist/compiler/openxr.cjs +10 -6
- package/dist/compiler/openxr.js +9 -5
- package/dist/compiler/playcanvas.cjs +10 -7
- package/dist/compiler/playcanvas.js +9 -6
- package/dist/compiler/r3f.cjs +17 -13
- package/dist/compiler/r3f.d.ts +22 -0
- package/dist/compiler/r3f.js +12 -8
- 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 +10 -7
- package/dist/compiler/sdf.js +8 -5
- package/dist/compiler/semantic-scene.cjs +1 -1
- package/dist/compiler/semantic-scene.js +1 -1
- package/dist/compiler/state.cjs +9 -5
- package/dist/compiler/state.js +7 -3
- package/dist/compiler/trait-composition.cjs +11 -7
- package/dist/compiler/trait-composition.js +7 -3
- package/dist/compiler/unity.cjs +10 -6
- package/dist/compiler/unity.js +9 -5
- package/dist/compiler/unreal.cjs +11 -7
- package/dist/compiler/unreal.js +9 -5
- package/dist/compiler/urdf.cjs +20 -13
- package/dist/compiler/urdf.js +8 -5
- package/dist/compiler/usd-physics.cjs +10 -7
- package/dist/compiler/usd-physics.js +7 -4
- package/dist/compiler/visionos.cjs +10 -6
- package/dist/compiler/visionos.js +9 -5
- package/dist/compiler/vrchat.cjs +10 -7
- package/dist/compiler/vrchat.js +8 -5
- package/dist/compiler/vrr.cjs +10 -7
- package/dist/compiler/vrr.js +8 -5
- package/dist/compiler/wasm.cjs +13 -10
- package/dist/compiler/wasm.js +8 -5
- package/dist/compiler/webgpu.cjs +9 -6
- package/dist/compiler/webgpu.js +8 -5
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.cjs +1266 -0
- package/dist/coordinators/index.d.ts +260 -0
- package/dist/coordinators/index.js +1259 -0
- package/dist/debugger.cjs +9 -7
- package/dist/debugger.js +7 -5
- package/dist/entries/interop.cjs +23 -21
- package/dist/entries/interop.js +5 -3
- package/dist/entries/scripting.cjs +18 -18
- package/dist/entries/scripting.js +8 -8
- package/dist/hololand/index.cjs +146 -0
- package/dist/hololand/index.d.ts +70 -0
- package/dist/hololand/index.js +5 -0
- package/dist/index.cjs +20332 -18121
- package/dist/index.d.ts +1477 -40
- package/dist/index.js +19451 -17638
- package/dist/math/tropical-spmv.cjs +45 -0
- package/dist/math/tropical-spmv.js +4 -0
- package/dist/math/vec3.cjs +14 -14
- package/dist/math/vec3.js +2 -2
- package/dist/{ml-dsa-PHCWUBPX.cjs → ml-dsa-FSKBTE3W.cjs} +177 -90
- package/dist/{ml-dsa-WYLJHJO6.js → ml-dsa-Z7JDKW4L.js} +158 -71
- package/dist/paper-0c-spike/index.cjs +150 -0
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/paper-0c-spike/index.js +141 -0
- package/dist/parser.cjs +45 -11
- package/dist/parser.d.ts +11 -0
- package/dist/parser.js +10 -8
- package/dist/{playwright-RL6GY4F7.cjs → playwright-3AT3AKTV.cjs} +1985 -1985
- package/dist/{playwright-5OSAPTNH.js → playwright-VZPDVUEQ.js} +3 -3
- package/dist/reconstruction/index.cjs +153 -0
- package/dist/reconstruction/index.d.ts +105 -0
- package/dist/reconstruction/index.js +8 -0
- package/dist/runtime.cjs +7 -5
- package/dist/runtime.js +6 -4
- package/dist/self-improvement/index.cjs +563 -0
- package/dist/self-improvement/index.js +545 -0
- package/dist/storage/index.cjs +10 -9
- package/dist/storage/index.js +3 -2
- package/dist/testing.cjs +25 -0
- package/dist/testing.d.ts +70 -0
- package/dist/testing.js +4 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.cjs +33 -0
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traitDocs/traitDocs.js +7 -0
- package/dist/traits/botanical-lotus.cjs +41 -0
- package/dist/traits/botanical-lotus.d.ts +172 -0
- package/dist/traits/botanical-lotus.js +4 -0
- package/dist/traits/engines/index.cjs +520 -0
- package/dist/traits/engines/index.js +380 -0
- package/dist/traits/index.cjs +17630 -7881
- package/dist/traits/index.d.ts +197 -0
- package/dist/traits/index.js +16573 -7193
- package/dist/traits/simulation-solver-factory.cjs +13 -0
- package/dist/traits/simulation-solver-factory.d.ts +23 -0
- package/dist/traits/simulation-solver-factory.js +4 -0
- package/dist/traits/webcam-gaze.cjs +35 -0
- package/dist/traits/webcam-gaze.d.ts +17 -0
- package/dist/traits/webcam-gaze.js +4 -0
- package/dist/type-checker.cjs +6 -5
- package/dist/type-checker.js +4 -3
- package/dist/world/index.cjs +947 -0
- package/dist/world/index.d.ts +147 -0
- package/dist/world/index.js +939 -0
- package/dist/world-model/index.cjs +1446 -0
- package/dist/world-model/index.d.ts +119 -0
- package/dist/world-model/index.js +1414 -0
- package/dist/wot/index.cjs +29 -0
- package/dist/wot/index.js +4 -0
- package/package.json +153 -61
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
|
@@ -0,0 +1,1414 @@
|
|
|
1
|
+
import '../chunk-OL46QLBJ.js';
|
|
2
|
+
|
|
3
|
+
// src/world-model/AdversarialTrajectory.ts
|
|
4
|
+
function isCurriculumEligible(trajectory) {
|
|
5
|
+
return trajectory.status !== "invalid" && trajectory.priority.priority > 0;
|
|
6
|
+
}
|
|
7
|
+
function hasReplayEvidence(trajectory) {
|
|
8
|
+
const contract = trajectory.simulationContract;
|
|
9
|
+
const handle = trajectory.replayHandle;
|
|
10
|
+
return contract.contractId.trim().length > 0 && handle.simulationContractId === contract.contractId && handle.replayCommand.trim().length > 0 && (contract.replayDigestMode === "unsigned-observed" || contract.fieldQuantization.length > 0);
|
|
11
|
+
}
|
|
12
|
+
function asTrajectoryId(s) {
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
function asSceneHash(s) {
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
18
|
+
function asCaelReceiptHash(s) {
|
|
19
|
+
return s;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/world-model/HardwareReceiptMetadata.ts
|
|
23
|
+
var HARDWARE_RECEIPT_METADATA_SCHEMA_VERSION = "holoscript.hardware-receipt-metadata.v1";
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function hasText(value) {
|
|
28
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
29
|
+
}
|
|
30
|
+
function requireText(record, key, path, errors) {
|
|
31
|
+
if (!hasText(record[key])) {
|
|
32
|
+
errors.push(`Missing ${path}.${key}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function requireObject(record, key, errors) {
|
|
36
|
+
const value = record[key];
|
|
37
|
+
if (!isRecord(value)) {
|
|
38
|
+
errors.push(`Missing ${key}`);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
function requireArray(record, key, errors) {
|
|
44
|
+
const value = record[key];
|
|
45
|
+
if (!Array.isArray(value)) {
|
|
46
|
+
errors.push(`Missing ${key}`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
function validateConstraints(items, errors) {
|
|
52
|
+
for (const [index, item] of items.entries()) {
|
|
53
|
+
if (!isRecord(item)) {
|
|
54
|
+
errors.push(`constraints[${index}] must be an object`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
requireText(item, "id", `constraints[${index}]`, errors);
|
|
58
|
+
requireText(item, "description", `constraints[${index}]`, errors);
|
|
59
|
+
if (!["string", "number", "boolean"].includes(typeof item.limit)) {
|
|
60
|
+
errors.push(`Missing constraints[${index}].limit`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function validateMeasuredResults(items, errors) {
|
|
65
|
+
if (items.length === 0) {
|
|
66
|
+
errors.push("measuredResults must include at least one measurement");
|
|
67
|
+
}
|
|
68
|
+
for (const [index, item] of items.entries()) {
|
|
69
|
+
if (!isRecord(item)) {
|
|
70
|
+
errors.push(`measuredResults[${index}] must be an object`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
requireText(item, "metric", `measuredResults[${index}]`, errors);
|
|
74
|
+
if (typeof item.value !== "number" || !Number.isFinite(item.value)) {
|
|
75
|
+
errors.push(`Missing measuredResults[${index}].value`);
|
|
76
|
+
}
|
|
77
|
+
requireText(item, "unit", `measuredResults[${index}]`, errors);
|
|
78
|
+
requireText(item, "method", `measuredResults[${index}]`, errors);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function validateReplayInputs(items, errors) {
|
|
82
|
+
if (items.length === 0) {
|
|
83
|
+
errors.push("replayInputs must include at least one replay input");
|
|
84
|
+
}
|
|
85
|
+
for (const [index, item] of items.entries()) {
|
|
86
|
+
if (!isRecord(item)) {
|
|
87
|
+
errors.push(`replayInputs[${index}] must be an object`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
requireText(item, "kind", `replayInputs[${index}]`, errors);
|
|
91
|
+
requireText(item, "uri", `replayInputs[${index}]`, errors);
|
|
92
|
+
requireText(item, "sha256", `replayInputs[${index}]`, errors);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function validatePortableHardwareReceiptMetadata(receipt) {
|
|
96
|
+
const errors = [];
|
|
97
|
+
if (!isRecord(receipt)) {
|
|
98
|
+
return { valid: false, errors: ["Hardware receipt metadata must be an object"] };
|
|
99
|
+
}
|
|
100
|
+
if (receipt.schemaVersion !== HARDWARE_RECEIPT_METADATA_SCHEMA_VERSION) {
|
|
101
|
+
errors.push(
|
|
102
|
+
`schemaVersion must be ${HARDWARE_RECEIPT_METADATA_SCHEMA_VERSION}`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const target = requireObject(receipt, "target", errors);
|
|
106
|
+
if (target) {
|
|
107
|
+
requireText(target, "id", "target", errors);
|
|
108
|
+
requireText(target, "kind", "target", errors);
|
|
109
|
+
requireText(target, "architecture", "target", errors);
|
|
110
|
+
requireText(target, "artifactKind", "target", errors);
|
|
111
|
+
}
|
|
112
|
+
const device = requireObject(receipt, "device", errors);
|
|
113
|
+
if (device) {
|
|
114
|
+
requireText(device, "vendor", "device", errors);
|
|
115
|
+
requireText(device, "model", "device", errors);
|
|
116
|
+
if (device.accelerator !== null && device.accelerator !== void 0) {
|
|
117
|
+
requireText(device, "accelerator", "device", errors);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const runtime = requireObject(receipt, "runtime", errors);
|
|
121
|
+
if (runtime) {
|
|
122
|
+
requireText(runtime, "name", "runtime", errors);
|
|
123
|
+
requireText(runtime, "version", "runtime", errors);
|
|
124
|
+
requireText(runtime, "hostOS", "runtime", errors);
|
|
125
|
+
}
|
|
126
|
+
requireText(receipt, "compilerVersion", "receipt", errors);
|
|
127
|
+
const constraints = requireArray(receipt, "constraints", errors);
|
|
128
|
+
if (constraints) validateConstraints(constraints, errors);
|
|
129
|
+
const measuredResults = requireArray(receipt, "measuredResults", errors);
|
|
130
|
+
if (measuredResults) validateMeasuredResults(measuredResults, errors);
|
|
131
|
+
const replayInputs = requireArray(receipt, "replayInputs", errors);
|
|
132
|
+
if (replayInputs) validateReplayInputs(replayInputs, errors);
|
|
133
|
+
const provenance = requireObject(receipt, "provenance", errors);
|
|
134
|
+
if (provenance) {
|
|
135
|
+
requireText(provenance, "capturedAt", "provenance", errors);
|
|
136
|
+
requireText(provenance, "sourceCompositionHash", "provenance", errors);
|
|
137
|
+
}
|
|
138
|
+
const owner = requireObject(receipt, "owner", errors);
|
|
139
|
+
if (owner) {
|
|
140
|
+
requireText(owner, "agent", "owner", errors);
|
|
141
|
+
}
|
|
142
|
+
return { valid: errors.length === 0, errors };
|
|
143
|
+
}
|
|
144
|
+
function isPortableHardwareReceiptMetadata(receipt) {
|
|
145
|
+
return validatePortableHardwareReceiptMetadata(receipt).valid;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/world-model/AdversarialTrajectoryReport.ts
|
|
149
|
+
function buildAdversarialTrajectoryReport(trajectories, sceneHash, generatedAtMs, topPriorityLimit = 10) {
|
|
150
|
+
for (const t of trajectories) {
|
|
151
|
+
if (t.sceneHash !== sceneHash) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
`buildAdversarialTrajectoryReport: trajectory ${t.id} has sceneHash ${t.sceneHash} but report sceneHash is ${sceneHash}`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const countBy = (status) => trajectories.filter((t) => t.status === status).length;
|
|
158
|
+
const topPriority = [...trajectories].filter((t) => t.status !== "invalid" && t.priority.priority > 0).sort((a, b) => {
|
|
159
|
+
if (a.priority.priority !== b.priority.priority) {
|
|
160
|
+
return b.priority.priority - a.priority.priority;
|
|
161
|
+
}
|
|
162
|
+
return a.priority.tieBreaker - b.priority.tieBreaker;
|
|
163
|
+
}).slice(0, topPriorityLimit).map((t) => t.id);
|
|
164
|
+
return {
|
|
165
|
+
generatedAtMs,
|
|
166
|
+
sceneHash,
|
|
167
|
+
trajectories,
|
|
168
|
+
counts: {
|
|
169
|
+
open: countBy("open"),
|
|
170
|
+
solved: countBy("solved"),
|
|
171
|
+
unresolved: countBy("unresolved"),
|
|
172
|
+
invalid: countBy("invalid"),
|
|
173
|
+
archived: countBy("archived")
|
|
174
|
+
},
|
|
175
|
+
topPriority,
|
|
176
|
+
failureClusters: buildFailureClusters(trajectories),
|
|
177
|
+
scoreSummary: buildScoreSummary(trajectories),
|
|
178
|
+
replaySummary: buildReplaySummary(trajectories)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function serializeReport(report) {
|
|
182
|
+
return JSON.stringify(report, canonicalReplacer);
|
|
183
|
+
}
|
|
184
|
+
function canonicalReplacer(_key, value) {
|
|
185
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
186
|
+
const sorted = {};
|
|
187
|
+
for (const k of Object.keys(value).sort()) {
|
|
188
|
+
sorted[k] = value[k];
|
|
189
|
+
}
|
|
190
|
+
return sorted;
|
|
191
|
+
}
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
function isReportCountsConsistent(report) {
|
|
195
|
+
const re = (status) => report.trajectories.filter((t) => t.status === status).length;
|
|
196
|
+
return report.counts.open === re("open") && report.counts.solved === re("solved") && report.counts.unresolved === re("unresolved") && report.counts.invalid === re("invalid") && report.counts.archived === re("archived");
|
|
197
|
+
}
|
|
198
|
+
function buildFailureClusters(trajectories) {
|
|
199
|
+
const clusters = /* @__PURE__ */ new Map();
|
|
200
|
+
for (const t of trajectories) {
|
|
201
|
+
const dominant = dominantPredicate(t);
|
|
202
|
+
const key = `${t.status}::${dominant ?? "none"}`;
|
|
203
|
+
const existing = clusters.get(key);
|
|
204
|
+
if (existing) {
|
|
205
|
+
clusters.set(key, {
|
|
206
|
+
...existing,
|
|
207
|
+
count: existing.count + 1,
|
|
208
|
+
trajectoryIds: [...existing.trajectoryIds, t.id]
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
clusters.set(key, {
|
|
212
|
+
label: `${t.status}${dominant ? ` (${dominant})` : ""}`,
|
|
213
|
+
status: t.status,
|
|
214
|
+
count: 1,
|
|
215
|
+
trajectoryIds: [t.id],
|
|
216
|
+
dominantPredicate: dominant
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return Array.from(clusters.values()).sort((a, b) => b.count - a.count || a.label.localeCompare(b.label));
|
|
221
|
+
}
|
|
222
|
+
function dominantPredicate(trajectory) {
|
|
223
|
+
const scores = trajectory.predicateScore;
|
|
224
|
+
if (trajectory.status === "invalid") return "invalidity";
|
|
225
|
+
let maxKey = null;
|
|
226
|
+
let maxValue = -Infinity;
|
|
227
|
+
for (const key of ["violation", "novelty", "learnability", "regression"]) {
|
|
228
|
+
if (scores[key] > maxValue) {
|
|
229
|
+
maxValue = scores[key];
|
|
230
|
+
maxKey = key;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return maxKey;
|
|
234
|
+
}
|
|
235
|
+
function buildScoreSummary(trajectories) {
|
|
236
|
+
const keys = ["violation", "novelty", "learnability", "regression", "invalidity"];
|
|
237
|
+
const summary = {};
|
|
238
|
+
for (const key of keys) {
|
|
239
|
+
const values = trajectories.map((t) => t.predicateScore[key]);
|
|
240
|
+
const min = values.length > 0 ? Math.min(...values) : 0;
|
|
241
|
+
const max = values.length > 0 ? Math.max(...values) : 0;
|
|
242
|
+
const avg = values.length > 0 ? values.reduce((a, b) => a + b, 0) / values.length : 0;
|
|
243
|
+
summary[key] = { avg: round4(avg), min: round4(min), max: round4(max) };
|
|
244
|
+
}
|
|
245
|
+
return summary;
|
|
246
|
+
}
|
|
247
|
+
function buildReplaySummary(trajectories) {
|
|
248
|
+
let withEvidence = 0;
|
|
249
|
+
let withoutEvidence = 0;
|
|
250
|
+
for (const t of trajectories) {
|
|
251
|
+
if (t.replayHandle.replayCommand.trim().length > 0 && t.replayHandle.simulationContractId === t.simulationContract.contractId) {
|
|
252
|
+
withEvidence += 1;
|
|
253
|
+
} else {
|
|
254
|
+
withoutEvidence += 1;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return { withEvidence, withoutEvidence };
|
|
258
|
+
}
|
|
259
|
+
function round4(value) {
|
|
260
|
+
return Math.round(value * 1e4) / 1e4;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// src/world-model/PredicateScorer.ts
|
|
264
|
+
function clamp01(x) {
|
|
265
|
+
if (!Number.isFinite(x)) return 0;
|
|
266
|
+
if (x < 0) return 0;
|
|
267
|
+
if (x > 1) return 1;
|
|
268
|
+
return x;
|
|
269
|
+
}
|
|
270
|
+
function actionTypeSet(actions) {
|
|
271
|
+
const s = /* @__PURE__ */ new Set();
|
|
272
|
+
for (const a of actions) s.add(a.type);
|
|
273
|
+
return s;
|
|
274
|
+
}
|
|
275
|
+
function jaccardOverlap(a, b) {
|
|
276
|
+
if (a.size === 0 && b.size === 0) return 0;
|
|
277
|
+
let intersect = 0;
|
|
278
|
+
for (const x of a) if (b.has(x)) intersect += 1;
|
|
279
|
+
const union = a.size + b.size - intersect;
|
|
280
|
+
return union === 0 ? 0 : intersect / union;
|
|
281
|
+
}
|
|
282
|
+
function scoreTrajectory(inputs) {
|
|
283
|
+
const {
|
|
284
|
+
trajectory,
|
|
285
|
+
hardAnchors,
|
|
286
|
+
softAnchors,
|
|
287
|
+
historyActionTypes,
|
|
288
|
+
learnabilityEstimate = 0.5,
|
|
289
|
+
previousStatus
|
|
290
|
+
} = inputs;
|
|
291
|
+
let invalidity = 0;
|
|
292
|
+
for (const anchor of hardAnchors) {
|
|
293
|
+
if (!anchor.evaluate(trajectory)) {
|
|
294
|
+
invalidity = 1;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
let violation = 0;
|
|
299
|
+
for (const anchor of softAnchors) {
|
|
300
|
+
const v = clamp01(anchor.evaluate(trajectory));
|
|
301
|
+
if (v > violation) violation = v;
|
|
302
|
+
}
|
|
303
|
+
const trajActionTypes = actionTypeSet(trajectory.actionTrace);
|
|
304
|
+
const novelty = clamp01(1 - jaccardOverlap(trajActionTypes, historyActionTypes));
|
|
305
|
+
const learnability = clamp01(learnabilityEstimate);
|
|
306
|
+
const regression = previousStatus === "solved" && (violation > 0 || invalidity > 0) ? 1 : 0;
|
|
307
|
+
const predicateScore = {
|
|
308
|
+
violation,
|
|
309
|
+
novelty,
|
|
310
|
+
learnability,
|
|
311
|
+
regression,
|
|
312
|
+
invalidity
|
|
313
|
+
};
|
|
314
|
+
let priority = 0;
|
|
315
|
+
let rationale = "invalid";
|
|
316
|
+
if (invalidity === 0) {
|
|
317
|
+
const base = Math.max(violation, regression);
|
|
318
|
+
const noveltyWeight = 0.5 + 0.5 * novelty;
|
|
319
|
+
const learnWeight = 0.5 + 0.5 * learnability;
|
|
320
|
+
priority = clamp01(base * noveltyWeight * learnWeight);
|
|
321
|
+
rationale = regression > 0 ? `regression detected (violation=${violation.toFixed(2)})` : `violation=${violation.toFixed(2)} \xD7 novelty=${novelty.toFixed(2)} \xD7 learn=${learnability.toFixed(2)}`;
|
|
322
|
+
}
|
|
323
|
+
const tieBreaker = trajectory.actionTrace.length;
|
|
324
|
+
return {
|
|
325
|
+
predicateScore,
|
|
326
|
+
priority: { priority, tieBreaker, rationale }
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// src/world-model/DeterministicFailureScene.ts
|
|
331
|
+
var SCENE_ID = "deterministic-contact-v1";
|
|
332
|
+
var DEFAULT_SEED = 1337;
|
|
333
|
+
var DEFAULT_DISCOVERED_AT_MS = 17e11;
|
|
334
|
+
var STEP_MS = 100;
|
|
335
|
+
var DETERMINISTIC_FAILURE_CONTRACT = {
|
|
336
|
+
contractId: "world-model-deterministic-contact-v1",
|
|
337
|
+
hashMode: "fnv1a",
|
|
338
|
+
adapterFingerprint: "core-world-model-deterministic-scene-v1",
|
|
339
|
+
replayDigestMode: "strict-same-adapter",
|
|
340
|
+
fieldQuantization: [
|
|
341
|
+
{ fieldPattern: "objects.*.center", quantum: 1e-6, units: "m" },
|
|
342
|
+
{ fieldPattern: "camera.position", quantum: 1e-6, units: "m" },
|
|
343
|
+
{ fieldPattern: "camera.lookAt", quantum: 1e-6, units: "m" }
|
|
344
|
+
]
|
|
345
|
+
};
|
|
346
|
+
var DEFAULT_DETERMINISTIC_FAILURE_ACTIONS = [
|
|
347
|
+
{
|
|
348
|
+
type: "place-object",
|
|
349
|
+
object: {
|
|
350
|
+
id: "probe-block",
|
|
351
|
+
kind: "block",
|
|
352
|
+
center: { x: -0.6, y: 0.15, z: 0 },
|
|
353
|
+
halfExtents: { x: 0.15, y: 0.15, z: 0.15 },
|
|
354
|
+
movable: true
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: "move-camera",
|
|
359
|
+
position: { x: 0, y: 1.25, z: 2.2 },
|
|
360
|
+
lookAt: { x: 0, y: 0.2, z: 0 }
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: "move-object",
|
|
364
|
+
objectId: "probe-block",
|
|
365
|
+
center: { x: 0, y: 0.15, z: 0 }
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: "move-object",
|
|
369
|
+
objectId: "probe-block",
|
|
370
|
+
center: { x: 0.55, y: 0.15, z: 0 }
|
|
371
|
+
}
|
|
372
|
+
];
|
|
373
|
+
function stableStringify(value) {
|
|
374
|
+
if (value === null || typeof value !== "object") {
|
|
375
|
+
return JSON.stringify(value);
|
|
376
|
+
}
|
|
377
|
+
if (Array.isArray(value)) {
|
|
378
|
+
return `[${value.map(stableStringify).join(",")}]`;
|
|
379
|
+
}
|
|
380
|
+
const obj = value;
|
|
381
|
+
return `{${Object.keys(obj).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(obj[key])}`).join(",")}}`;
|
|
382
|
+
}
|
|
383
|
+
function hashDeterministicSceneValue(value) {
|
|
384
|
+
const input = stableStringify(value);
|
|
385
|
+
let hash = 2166136261;
|
|
386
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
387
|
+
hash ^= input.charCodeAt(i);
|
|
388
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
389
|
+
}
|
|
390
|
+
return `fnv1a-${hash.toString(16).padStart(8, "0")}`;
|
|
391
|
+
}
|
|
392
|
+
function cloneVec3(v) {
|
|
393
|
+
return { x: v.x, y: v.y, z: v.z };
|
|
394
|
+
}
|
|
395
|
+
function cloneObject(o) {
|
|
396
|
+
return {
|
|
397
|
+
id: o.id,
|
|
398
|
+
kind: o.kind,
|
|
399
|
+
center: cloneVec3(o.center),
|
|
400
|
+
halfExtents: cloneVec3(o.halfExtents),
|
|
401
|
+
movable: o.movable
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function cloneCamera(camera) {
|
|
405
|
+
return {
|
|
406
|
+
position: cloneVec3(camera.position),
|
|
407
|
+
lookAt: cloneVec3(camera.lookAt)
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function sceneHashFor(seed, objects) {
|
|
411
|
+
return asSceneHash(hashDeterministicSceneValue({ sceneId: SCENE_ID, seed, objects }));
|
|
412
|
+
}
|
|
413
|
+
function createDeterministicFailureDiscoveryScene(seed = DEFAULT_SEED) {
|
|
414
|
+
const objects = [
|
|
415
|
+
{
|
|
416
|
+
id: "contact-pillar",
|
|
417
|
+
kind: "obstacle",
|
|
418
|
+
center: { x: 0, y: 0.35, z: 0 },
|
|
419
|
+
halfExtents: { x: 0.16, y: 0.35, z: 0.45 },
|
|
420
|
+
movable: false
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
id: "target-pad",
|
|
424
|
+
kind: "target",
|
|
425
|
+
center: { x: 0.55, y: 0.05, z: 0 },
|
|
426
|
+
halfExtents: { x: 0.32, y: 0.05, z: 0.32 },
|
|
427
|
+
movable: false
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
return {
|
|
431
|
+
sceneId: SCENE_ID,
|
|
432
|
+
seed,
|
|
433
|
+
objects,
|
|
434
|
+
camera: {
|
|
435
|
+
position: { x: -0.25, y: 1.1, z: 2 },
|
|
436
|
+
lookAt: { x: 0, y: 0.2, z: 0 }
|
|
437
|
+
},
|
|
438
|
+
sceneHash: sceneHashFor(seed, objects)
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function overlaps(a, b) {
|
|
442
|
+
return Math.abs(a.center.x - b.center.x) <= a.halfExtents.x + b.halfExtents.x && Math.abs(a.center.y - b.center.y) <= a.halfExtents.y + b.halfExtents.y && Math.abs(a.center.z - b.center.z) <= a.halfExtents.z + b.halfExtents.z;
|
|
443
|
+
}
|
|
444
|
+
function actionPayload(action) {
|
|
445
|
+
switch (action.type) {
|
|
446
|
+
case "place-object":
|
|
447
|
+
return { object: action.object };
|
|
448
|
+
case "move-object":
|
|
449
|
+
return { objectId: action.objectId, center: action.center };
|
|
450
|
+
case "move-camera":
|
|
451
|
+
return { position: action.position, lookAt: action.lookAt };
|
|
452
|
+
case "wait":
|
|
453
|
+
return { durationMs: action.durationMs };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function snapshotObservationPayload(objects, camera, events, contactCount, predicateViolationCount, invalidActionCount) {
|
|
457
|
+
return {
|
|
458
|
+
objects: objects.map((o) => ({
|
|
459
|
+
id: o.id,
|
|
460
|
+
kind: o.kind,
|
|
461
|
+
center: o.center
|
|
462
|
+
})),
|
|
463
|
+
camera,
|
|
464
|
+
eventTypes: events.map((e) => e.type),
|
|
465
|
+
contactCount,
|
|
466
|
+
predicateViolationCount,
|
|
467
|
+
invalidActionCount
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function runDeterministicFailureDiscoveryScene(actions = DEFAULT_DETERMINISTIC_FAILURE_ACTIONS, options = {}) {
|
|
471
|
+
const scene = createDeterministicFailureDiscoveryScene(options.seed ?? DEFAULT_SEED);
|
|
472
|
+
let objects = scene.objects.map(cloneObject);
|
|
473
|
+
let camera = cloneCamera(scene.camera);
|
|
474
|
+
let timestampMs = 0;
|
|
475
|
+
let contactCount = 0;
|
|
476
|
+
let predicateViolationCount = 0;
|
|
477
|
+
let invalidActionCount = 0;
|
|
478
|
+
const events = [];
|
|
479
|
+
const actionTrace = [];
|
|
480
|
+
const observationTrace = [];
|
|
481
|
+
for (let stepIndex = 0; stepIndex < actions.length; stepIndex += 1) {
|
|
482
|
+
const action = actions[stepIndex];
|
|
483
|
+
const stepEvents = [];
|
|
484
|
+
const emit = (type, payload) => {
|
|
485
|
+
const event = { stepIndex, timestampMs, type, payload };
|
|
486
|
+
stepEvents.push(event);
|
|
487
|
+
events.push(event);
|
|
488
|
+
};
|
|
489
|
+
actionTrace.push({
|
|
490
|
+
stepIndex,
|
|
491
|
+
timestampMs,
|
|
492
|
+
type: action.type,
|
|
493
|
+
payload: actionPayload(action)
|
|
494
|
+
});
|
|
495
|
+
if (action.type === "place-object") {
|
|
496
|
+
if (objects.some((o) => o.id === action.object.id)) {
|
|
497
|
+
invalidActionCount += 1;
|
|
498
|
+
emit("invalid_action", {
|
|
499
|
+
reason: "duplicate-object-id",
|
|
500
|
+
objectId: action.object.id
|
|
501
|
+
});
|
|
502
|
+
} else {
|
|
503
|
+
const placed = cloneObject(action.object);
|
|
504
|
+
objects = [...objects, placed];
|
|
505
|
+
emit("object_placed", { objectId: placed.id, center: placed.center });
|
|
506
|
+
}
|
|
507
|
+
} else if (action.type === "move-camera") {
|
|
508
|
+
camera = {
|
|
509
|
+
position: cloneVec3(action.position),
|
|
510
|
+
lookAt: cloneVec3(action.lookAt)
|
|
511
|
+
};
|
|
512
|
+
emit("camera_moved", { position: camera.position, lookAt: camera.lookAt });
|
|
513
|
+
} else if (action.type === "move-object") {
|
|
514
|
+
const object = objects.find((o) => o.id === action.objectId);
|
|
515
|
+
if (!object) {
|
|
516
|
+
invalidActionCount += 1;
|
|
517
|
+
emit("invalid_action", {
|
|
518
|
+
reason: "unknown-object",
|
|
519
|
+
objectId: action.objectId
|
|
520
|
+
});
|
|
521
|
+
} else if (!object.movable) {
|
|
522
|
+
invalidActionCount += 1;
|
|
523
|
+
emit("invalid_action", {
|
|
524
|
+
reason: "object-not-movable",
|
|
525
|
+
objectId: action.objectId
|
|
526
|
+
});
|
|
527
|
+
} else {
|
|
528
|
+
const moved = { ...object, center: cloneVec3(action.center) };
|
|
529
|
+
const obstacle = objects.find((o) => o.kind === "obstacle" && overlaps(moved, o));
|
|
530
|
+
if (obstacle) {
|
|
531
|
+
contactCount += 1;
|
|
532
|
+
predicateViolationCount += 1;
|
|
533
|
+
emit("contact", {
|
|
534
|
+
objectId: object.id,
|
|
535
|
+
otherObjectId: obstacle.id,
|
|
536
|
+
blocked: true
|
|
537
|
+
});
|
|
538
|
+
emit("predicate_violation", {
|
|
539
|
+
predicate: "no-block-obstacle-overlap",
|
|
540
|
+
objectId: object.id,
|
|
541
|
+
otherObjectId: obstacle.id
|
|
542
|
+
});
|
|
543
|
+
} else {
|
|
544
|
+
objects = objects.map((o) => o.id === object.id ? moved : o);
|
|
545
|
+
emit("object_moved", { objectId: moved.id, center: moved.center });
|
|
546
|
+
for (const target of objects.filter((o) => o.kind === "target")) {
|
|
547
|
+
if (overlaps(moved, target)) {
|
|
548
|
+
contactCount += 1;
|
|
549
|
+
emit("target_contact", {
|
|
550
|
+
objectId: moved.id,
|
|
551
|
+
targetId: target.id
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
emit("wait", { durationMs: action.durationMs });
|
|
559
|
+
}
|
|
560
|
+
observationTrace.push({
|
|
561
|
+
stepIndex,
|
|
562
|
+
timestampMs,
|
|
563
|
+
type: "deterministic-scene-snapshot",
|
|
564
|
+
payload: snapshotObservationPayload(
|
|
565
|
+
objects,
|
|
566
|
+
camera,
|
|
567
|
+
stepEvents,
|
|
568
|
+
contactCount,
|
|
569
|
+
predicateViolationCount,
|
|
570
|
+
invalidActionCount
|
|
571
|
+
)
|
|
572
|
+
});
|
|
573
|
+
timestampMs += action.type === "wait" ? action.durationMs : STEP_MS;
|
|
574
|
+
}
|
|
575
|
+
const eventLogHash = hashDeterministicSceneValue({
|
|
576
|
+
sceneHash: scene.sceneHash,
|
|
577
|
+
seed: scene.seed,
|
|
578
|
+
actionTrace,
|
|
579
|
+
observationTrace,
|
|
580
|
+
events
|
|
581
|
+
});
|
|
582
|
+
return {
|
|
583
|
+
sceneId: scene.sceneId,
|
|
584
|
+
seed: scene.seed,
|
|
585
|
+
sceneHash: scene.sceneHash,
|
|
586
|
+
objects,
|
|
587
|
+
camera,
|
|
588
|
+
events,
|
|
589
|
+
actionTrace,
|
|
590
|
+
observationTrace,
|
|
591
|
+
contactCount,
|
|
592
|
+
predicateViolationCount,
|
|
593
|
+
invalidActionCount,
|
|
594
|
+
eventLogHash
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function buildDeterministicFailureTrajectory(actions = DEFAULT_DETERMINISTIC_FAILURE_ACTIONS, options = {}) {
|
|
598
|
+
const result = runDeterministicFailureDiscoveryScene(actions, options);
|
|
599
|
+
const id = asTrajectoryId(
|
|
600
|
+
hashDeterministicSceneValue({
|
|
601
|
+
sceneHash: result.sceneHash,
|
|
602
|
+
seed: result.seed,
|
|
603
|
+
actionTrace: result.actionTrace
|
|
604
|
+
})
|
|
605
|
+
);
|
|
606
|
+
const replayCommand = `holoscript world-model replay --scene ${SCENE_ID} --trajectory ${id} --seed ${result.seed}`;
|
|
607
|
+
const baseline = {
|
|
608
|
+
id,
|
|
609
|
+
sceneHash: result.sceneHash,
|
|
610
|
+
seed: result.seed,
|
|
611
|
+
trustTier: "replayable",
|
|
612
|
+
caelReceiptHash: asCaelReceiptHash(result.eventLogHash),
|
|
613
|
+
simulationContract: DETERMINISTIC_FAILURE_CONTRACT,
|
|
614
|
+
actionTrace: result.actionTrace,
|
|
615
|
+
observationTrace: result.observationTrace,
|
|
616
|
+
predicateScore: {
|
|
617
|
+
violation: 0,
|
|
618
|
+
novelty: 0,
|
|
619
|
+
learnability: 0,
|
|
620
|
+
regression: 0,
|
|
621
|
+
invalidity: 0
|
|
622
|
+
},
|
|
623
|
+
priority: { priority: 0, tieBreaker: 0, rationale: "unscored" },
|
|
624
|
+
replayHandle: {
|
|
625
|
+
trajectoryId: id,
|
|
626
|
+
sceneHash: result.sceneHash,
|
|
627
|
+
simulationContractId: DETERMINISTIC_FAILURE_CONTRACT.contractId,
|
|
628
|
+
seed: result.seed,
|
|
629
|
+
replayCommand
|
|
630
|
+
},
|
|
631
|
+
status: "open",
|
|
632
|
+
discoveredAtMs: options.discoveredAtMs ?? DEFAULT_DISCOVERED_AT_MS,
|
|
633
|
+
lastReplayedAtMs: null
|
|
634
|
+
};
|
|
635
|
+
const collisionAnchor = {
|
|
636
|
+
id: "blocked-contact",
|
|
637
|
+
description: "blocked obstacle contact in deterministic scene",
|
|
638
|
+
evaluate: () => Math.min(1, result.predicateViolationCount)
|
|
639
|
+
};
|
|
640
|
+
const score = scoreTrajectory({
|
|
641
|
+
trajectory: baseline,
|
|
642
|
+
hardAnchors: [
|
|
643
|
+
{
|
|
644
|
+
id: "valid-actions-only",
|
|
645
|
+
description: "all deterministic scene actions reference valid movable objects",
|
|
646
|
+
evaluate: () => result.invalidActionCount === 0
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
softAnchors: [collisionAnchor],
|
|
650
|
+
historyActionTypes: /* @__PURE__ */ new Set(),
|
|
651
|
+
learnabilityEstimate: 0.9
|
|
652
|
+
});
|
|
653
|
+
const status = score.predicateScore.invalidity > 0 ? "invalid" : result.predicateViolationCount > 0 ? "unresolved" : "open";
|
|
654
|
+
return {
|
|
655
|
+
result,
|
|
656
|
+
trajectory: {
|
|
657
|
+
...baseline,
|
|
658
|
+
predicateScore: score.predicateScore,
|
|
659
|
+
priority: score.priority,
|
|
660
|
+
status
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// src/world-model/AdversarialMutator.ts
|
|
666
|
+
var BUILT_IN_PROFILES = [
|
|
667
|
+
{ name: "gentle-perturb", strategy: "perturb-positions", intensity: 0.15 },
|
|
668
|
+
{ name: "strong-perturb", strategy: "perturb-positions", intensity: 0.55 },
|
|
669
|
+
{ name: "skip-one", strategy: "skip-step", intensity: 0.3 },
|
|
670
|
+
{ name: "duplicate-one", strategy: "duplicate-step", intensity: 0.3 },
|
|
671
|
+
{ name: "swap-pair", strategy: "swap-consecutive", intensity: 0.3 },
|
|
672
|
+
{ name: "insert-pause", strategy: "insert-wait", intensity: 0.3 },
|
|
673
|
+
{ name: "push-obstacle", strategy: "push-toward-obstacle", intensity: 0.6 },
|
|
674
|
+
{ name: "camera-drift", strategy: "camera-drift", intensity: 0.5 }
|
|
675
|
+
];
|
|
676
|
+
function makeRng(seed) {
|
|
677
|
+
let state = seed >>> 0 || 1;
|
|
678
|
+
const float = () => {
|
|
679
|
+
state = state * 1664525 + 1013904223 >>> 0;
|
|
680
|
+
return state / 4294967296;
|
|
681
|
+
};
|
|
682
|
+
const int = (min, max) => min + Math.floor(float() * (max - min + 1));
|
|
683
|
+
const bool = (bias = 0.5) => float() < bias;
|
|
684
|
+
return { float, int, bool };
|
|
685
|
+
}
|
|
686
|
+
function clamp(value, min, max) {
|
|
687
|
+
return Math.max(min, Math.min(max, value));
|
|
688
|
+
}
|
|
689
|
+
function jitterPosition(pos, intensity, rng) {
|
|
690
|
+
const scale = intensity * 0.4;
|
|
691
|
+
return {
|
|
692
|
+
x: clamp(pos.x + (rng.float() - 0.5) * 2 * scale, -2, 2),
|
|
693
|
+
y: clamp(pos.y + (rng.float() - 0.5) * 2 * scale, -0.5, 2.5),
|
|
694
|
+
z: clamp(pos.z + (rng.float() - 0.5) * 2 * scale, -2, 2)
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
function mutatePerturbPositions(base, intensity, rng) {
|
|
698
|
+
return base.map((action) => {
|
|
699
|
+
switch (action.type) {
|
|
700
|
+
case "place-object":
|
|
701
|
+
return {
|
|
702
|
+
...action,
|
|
703
|
+
object: {
|
|
704
|
+
...action.object,
|
|
705
|
+
center: jitterPosition(action.object.center, intensity, rng)
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
case "move-object":
|
|
709
|
+
return {
|
|
710
|
+
...action,
|
|
711
|
+
center: jitterPosition(action.center, intensity, rng)
|
|
712
|
+
};
|
|
713
|
+
case "move-camera":
|
|
714
|
+
return {
|
|
715
|
+
...action,
|
|
716
|
+
position: jitterPosition(action.position, intensity, rng),
|
|
717
|
+
lookAt: jitterPosition(action.lookAt, intensity, rng)
|
|
718
|
+
};
|
|
719
|
+
case "wait":
|
|
720
|
+
default:
|
|
721
|
+
return action;
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
function mutateSkipStep(base, _intensity, rng) {
|
|
726
|
+
if (base.length <= 1) return base;
|
|
727
|
+
const idx = rng.int(0, base.length - 1);
|
|
728
|
+
return [...base.slice(0, idx), ...base.slice(idx + 1)];
|
|
729
|
+
}
|
|
730
|
+
function mutateDuplicateStep(base, _intensity, rng) {
|
|
731
|
+
if (base.length === 0) return base;
|
|
732
|
+
const idx = rng.int(0, base.length - 1);
|
|
733
|
+
const dup = base[idx];
|
|
734
|
+
return [...base.slice(0, idx + 1), dup, ...base.slice(idx + 1)];
|
|
735
|
+
}
|
|
736
|
+
function mutateSwapConsecutive(base, _intensity, rng) {
|
|
737
|
+
if (base.length < 2) return base;
|
|
738
|
+
const idx = rng.int(0, base.length - 2);
|
|
739
|
+
const copy = [...base];
|
|
740
|
+
[copy[idx], copy[idx + 1]] = [copy[idx + 1], copy[idx]];
|
|
741
|
+
return copy;
|
|
742
|
+
}
|
|
743
|
+
function mutateInsertWait(base, intensity, rng) {
|
|
744
|
+
const durationMs = Math.round(50 + rng.float() * 400 * (1 + intensity));
|
|
745
|
+
const idx = rng.int(0, base.length);
|
|
746
|
+
const wait = { type: "wait", durationMs };
|
|
747
|
+
return [...base.slice(0, idx), wait, ...base.slice(idx)];
|
|
748
|
+
}
|
|
749
|
+
function mutatePushTowardObstacle(base, intensity, rng) {
|
|
750
|
+
const obstacleCenter = { x: 0, z: 0 };
|
|
751
|
+
return base.map((action) => {
|
|
752
|
+
if (action.type === "move-object" && action.objectId === "probe-block") {
|
|
753
|
+
const toward = {
|
|
754
|
+
x: action.center.x + (obstacleCenter.x - action.center.x) * intensity * (0.5 + rng.float()),
|
|
755
|
+
y: action.center.y,
|
|
756
|
+
z: action.center.z + (obstacleCenter.z - action.center.z) * intensity * (0.5 + rng.float())
|
|
757
|
+
};
|
|
758
|
+
return { ...action, center: toward };
|
|
759
|
+
}
|
|
760
|
+
return action;
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function mutateCameraDrift(base, intensity, rng) {
|
|
764
|
+
return base.map((action) => {
|
|
765
|
+
if (action.type === "move-camera") {
|
|
766
|
+
const drift = {
|
|
767
|
+
x: clamp(action.position.x + (rng.float() - 0.5) * 4 * intensity, -3, 3),
|
|
768
|
+
y: clamp(action.position.y + (rng.float() - 0.5) * 2 * intensity, 0.5, 3),
|
|
769
|
+
z: clamp(action.position.z + (rng.float() - 0.5) * 4 * intensity, -3, 5)
|
|
770
|
+
};
|
|
771
|
+
return { ...action, position: drift };
|
|
772
|
+
}
|
|
773
|
+
return action;
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function applyMutation(base, profile, seed) {
|
|
777
|
+
const rng = makeRng(seed);
|
|
778
|
+
let actions;
|
|
779
|
+
switch (profile.strategy) {
|
|
780
|
+
case "perturb-positions":
|
|
781
|
+
actions = mutatePerturbPositions(base, profile.intensity, rng);
|
|
782
|
+
break;
|
|
783
|
+
case "skip-step":
|
|
784
|
+
actions = mutateSkipStep(base, profile.intensity, rng);
|
|
785
|
+
break;
|
|
786
|
+
case "duplicate-step":
|
|
787
|
+
actions = mutateDuplicateStep(base, profile.intensity, rng);
|
|
788
|
+
break;
|
|
789
|
+
case "swap-consecutive":
|
|
790
|
+
actions = mutateSwapConsecutive(base, profile.intensity, rng);
|
|
791
|
+
break;
|
|
792
|
+
case "insert-wait":
|
|
793
|
+
actions = mutateInsertWait(base, profile.intensity, rng);
|
|
794
|
+
break;
|
|
795
|
+
case "push-toward-obstacle":
|
|
796
|
+
actions = mutatePushTowardObstacle(base, profile.intensity, rng);
|
|
797
|
+
break;
|
|
798
|
+
case "camera-drift":
|
|
799
|
+
actions = mutateCameraDrift(base, profile.intensity, rng);
|
|
800
|
+
break;
|
|
801
|
+
default:
|
|
802
|
+
actions = base;
|
|
803
|
+
}
|
|
804
|
+
return {
|
|
805
|
+
actions,
|
|
806
|
+
profile: profile.name,
|
|
807
|
+
rationale: `${profile.strategy} at intensity ${profile.intensity.toFixed(2)}`
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function buildAdversarialTrajectoryFromResult(result, mutatorName, contract, discoveredAtMs) {
|
|
811
|
+
const id = asTrajectoryId(
|
|
812
|
+
hashDeterministicSceneValue({
|
|
813
|
+
sceneHash: result.sceneHash,
|
|
814
|
+
seed: result.seed,
|
|
815
|
+
actionTrace: result.actionTrace,
|
|
816
|
+
mutator: mutatorName
|
|
817
|
+
})
|
|
818
|
+
);
|
|
819
|
+
const replayCommand = `holoscript world-model replay --scene ${result.sceneId} --trajectory ${id} --seed ${result.seed}`;
|
|
820
|
+
return {
|
|
821
|
+
id,
|
|
822
|
+
sceneHash: asSceneHash(result.sceneHash),
|
|
823
|
+
seed: result.seed,
|
|
824
|
+
trustTier: "replayable",
|
|
825
|
+
caelReceiptHash: asCaelReceiptHash(result.eventLogHash),
|
|
826
|
+
simulationContract: contract,
|
|
827
|
+
actionTrace: result.actionTrace,
|
|
828
|
+
observationTrace: result.observationTrace,
|
|
829
|
+
predicateScore: {
|
|
830
|
+
violation: 0,
|
|
831
|
+
novelty: 0,
|
|
832
|
+
learnability: 0,
|
|
833
|
+
regression: 0,
|
|
834
|
+
invalidity: 0
|
|
835
|
+
},
|
|
836
|
+
priority: { priority: 0, tieBreaker: 0, rationale: "unscored" },
|
|
837
|
+
replayHandle: {
|
|
838
|
+
trajectoryId: id,
|
|
839
|
+
sceneHash: asSceneHash(result.sceneHash),
|
|
840
|
+
simulationContractId: contract.contractId,
|
|
841
|
+
seed: result.seed,
|
|
842
|
+
replayCommand
|
|
843
|
+
},
|
|
844
|
+
status: "open",
|
|
845
|
+
discoveredAtMs,
|
|
846
|
+
lastReplayedAtMs: null
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function makeHardAnchors() {
|
|
850
|
+
return [
|
|
851
|
+
{
|
|
852
|
+
id: "valid-actions-only",
|
|
853
|
+
description: "all deterministic scene actions reference valid movable objects",
|
|
854
|
+
evaluate: (_trajectory) => true
|
|
855
|
+
}
|
|
856
|
+
];
|
|
857
|
+
}
|
|
858
|
+
function makeSoftAnchors(result) {
|
|
859
|
+
return [
|
|
860
|
+
{
|
|
861
|
+
id: "blocked-contact",
|
|
862
|
+
description: "blocked obstacle contact in deterministic scene",
|
|
863
|
+
evaluate: () => Math.min(1, result.predicateViolationCount)
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
id: "target-contact",
|
|
867
|
+
description: "contact with target pad",
|
|
868
|
+
evaluate: () => result.events.some((e) => e.type === "target_contact") ? 0.5 : 0
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
id: "invalid-action-rate",
|
|
872
|
+
description: "proportion of invalid actions in trace",
|
|
873
|
+
evaluate: () => result.actionTrace.length > 0 ? Math.min(1, result.invalidActionCount / result.actionTrace.length) : 0
|
|
874
|
+
}
|
|
875
|
+
];
|
|
876
|
+
}
|
|
877
|
+
function mutateTrace(base, profile, seed) {
|
|
878
|
+
return applyMutation(base, profile, seed);
|
|
879
|
+
}
|
|
880
|
+
function exploreAdversarialTraces(options = {}) {
|
|
881
|
+
const {
|
|
882
|
+
baseActions,
|
|
883
|
+
seed = 1337,
|
|
884
|
+
maxTraces = 16,
|
|
885
|
+
sceneOptions,
|
|
886
|
+
profiles = BUILT_IN_PROFILES,
|
|
887
|
+
learnabilityEstimate = 0.7,
|
|
888
|
+
discoveredAtMs = Date.now()
|
|
889
|
+
} = options;
|
|
890
|
+
const base = baseActions ?? [];
|
|
891
|
+
const contract = DETERMINISTIC_FAILURE_CONTRACT;
|
|
892
|
+
const hardAnchors = makeHardAnchors();
|
|
893
|
+
const historyActionTypes = /* @__PURE__ */ new Set();
|
|
894
|
+
const trajectories = [];
|
|
895
|
+
for (let i = 0; i < maxTraces; i += 1) {
|
|
896
|
+
const profile = profiles[i % profiles.length];
|
|
897
|
+
const traceSeed = seed + i * 7919;
|
|
898
|
+
const mutated = applyMutation(base, profile, traceSeed);
|
|
899
|
+
const result = runDeterministicFailureDiscoveryScene(mutated.actions, sceneOptions);
|
|
900
|
+
const trajectory = buildAdversarialTrajectoryFromResult(
|
|
901
|
+
result,
|
|
902
|
+
profile.name,
|
|
903
|
+
contract,
|
|
904
|
+
discoveredAtMs
|
|
905
|
+
);
|
|
906
|
+
const softAnchors = makeSoftAnchors(result);
|
|
907
|
+
const score = scoreTrajectory({
|
|
908
|
+
trajectory,
|
|
909
|
+
hardAnchors,
|
|
910
|
+
softAnchors,
|
|
911
|
+
historyActionTypes,
|
|
912
|
+
learnabilityEstimate,
|
|
913
|
+
previousStatus: void 0
|
|
914
|
+
});
|
|
915
|
+
const status = score.predicateScore.invalidity > 0 ? "invalid" : result.predicateViolationCount > 0 ? "unresolved" : "open";
|
|
916
|
+
const scored = {
|
|
917
|
+
...trajectory,
|
|
918
|
+
predicateScore: score.predicateScore,
|
|
919
|
+
priority: score.priority,
|
|
920
|
+
status
|
|
921
|
+
};
|
|
922
|
+
trajectories.push(scored);
|
|
923
|
+
for (const a of scored.actionTrace) {
|
|
924
|
+
historyActionTypes.add(a.type);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return trajectories.sort((a, b) => {
|
|
928
|
+
if (a.priority.priority !== b.priority.priority) {
|
|
929
|
+
return b.priority.priority - a.priority.priority;
|
|
930
|
+
}
|
|
931
|
+
return a.priority.tieBreaker - b.priority.tieBreaker;
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// src/world-model/HumanoidRockThrowScene.ts
|
|
936
|
+
var HUMANOID_ROCK_THROW_SCENE_ID = "humanoid-rock-throw-v1";
|
|
937
|
+
var DEFAULT_SEED2 = 4242;
|
|
938
|
+
var DEFAULT_DISCOVERED_AT_MS2 = 17e11;
|
|
939
|
+
var STEP_MS2 = 100;
|
|
940
|
+
var GRAVITY = -9.81;
|
|
941
|
+
var RELEASE_VELOCITY = { x: 5.2, y: 3.4, z: 0 };
|
|
942
|
+
var RELEASE_POSITION = { x: -0.95, y: 1.62, z: 0.02 };
|
|
943
|
+
var HUMANOID_ROCK_THROW_CONTRACT = {
|
|
944
|
+
contractId: "world-model-humanoid-rock-throw-v1",
|
|
945
|
+
hashMode: "fnv1a",
|
|
946
|
+
adapterFingerprint: "core-world-model-humanoid-rock-throw-v1",
|
|
947
|
+
replayDigestMode: "strict-same-adapter",
|
|
948
|
+
fieldQuantization: [
|
|
949
|
+
{ fieldPattern: "rock.position", quantum: 1e-6, units: "m" },
|
|
950
|
+
{ fieldPattern: "hand.position", quantum: 1e-6, units: "m" },
|
|
951
|
+
{ fieldPattern: "release.velocity", quantum: 1e-6, units: "m/s" }
|
|
952
|
+
]
|
|
953
|
+
};
|
|
954
|
+
function addVec3(a, b) {
|
|
955
|
+
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
956
|
+
}
|
|
957
|
+
function scaleVec3(v, scale) {
|
|
958
|
+
return { x: v.x * scale, y: v.y * scale, z: v.z * scale };
|
|
959
|
+
}
|
|
960
|
+
function rockPositionAt(timeSeconds) {
|
|
961
|
+
return addVec3(addVec3(RELEASE_POSITION, scaleVec3(RELEASE_VELOCITY, timeSeconds)), {
|
|
962
|
+
x: 0,
|
|
963
|
+
y: 0.5 * GRAVITY * timeSeconds * timeSeconds,
|
|
964
|
+
z: 0
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
function sceneHashFor2(seed, objects) {
|
|
968
|
+
return asSceneHash(
|
|
969
|
+
hashDeterministicSceneValue({ sceneId: HUMANOID_ROCK_THROW_SCENE_ID, seed, objects })
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
function createHumanoidRockThrowScene(seed = DEFAULT_SEED2) {
|
|
973
|
+
const objects = [
|
|
974
|
+
{ id: "avatar", kind: "avatar", center: { x: -3, y: 1.25, z: 0 } },
|
|
975
|
+
{ id: "right-hand", kind: "hand", center: { x: -2.72, y: 1.22, z: 0.16 } },
|
|
976
|
+
{ id: "rock", kind: "rock", center: { x: -2.35, y: 0.22, z: 0.12 }, radiusM: 0.13, massKg: 1.8 },
|
|
977
|
+
{ id: "target", kind: "target", center: { x: 2.55, y: 0.85, z: 0 }, radiusM: 0.42, massKg: 20 },
|
|
978
|
+
{ id: "stage", kind: "stage", center: { x: 0, y: 0, z: 0 } }
|
|
979
|
+
];
|
|
980
|
+
return {
|
|
981
|
+
sceneId: HUMANOID_ROCK_THROW_SCENE_ID,
|
|
982
|
+
seed,
|
|
983
|
+
objects,
|
|
984
|
+
sceneHash: sceneHashFor2(seed, objects)
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
function makeAction(stepIndex, timestampMs, type, payload) {
|
|
988
|
+
return { stepIndex, timestampMs, type, payload };
|
|
989
|
+
}
|
|
990
|
+
function makeObservation(stepIndex, timestampMs, event) {
|
|
991
|
+
return {
|
|
992
|
+
stepIndex,
|
|
993
|
+
timestampMs,
|
|
994
|
+
type: "humanoid-rock-throw-event",
|
|
995
|
+
payload: {
|
|
996
|
+
eventType: event.type,
|
|
997
|
+
payload: event.payload
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function runHumanoidRockThrowReplay(options = {}) {
|
|
1002
|
+
const scene = createHumanoidRockThrowScene(options.seed ?? DEFAULT_SEED2);
|
|
1003
|
+
const events = [];
|
|
1004
|
+
const actionTrace = [];
|
|
1005
|
+
const observationTrace = [];
|
|
1006
|
+
const emit = (type, payload) => {
|
|
1007
|
+
const stepIndex = events.length;
|
|
1008
|
+
const timestampMs = stepIndex * STEP_MS2;
|
|
1009
|
+
const event = { stepIndex, timestampMs, type, payload };
|
|
1010
|
+
events.push(event);
|
|
1011
|
+
actionTrace.push(makeAction(stepIndex, timestampMs, type, payload));
|
|
1012
|
+
observationTrace.push(makeObservation(stepIndex, timestampMs, event));
|
|
1013
|
+
};
|
|
1014
|
+
emit("scene_loaded", {
|
|
1015
|
+
avatarId: "avatar",
|
|
1016
|
+
rockId: "rock",
|
|
1017
|
+
targetId: "target"
|
|
1018
|
+
});
|
|
1019
|
+
emit("avatar_approached", {
|
|
1020
|
+
avatarId: "avatar",
|
|
1021
|
+
from: { x: -3, y: 1.25, z: 0 },
|
|
1022
|
+
to: { x: -2.35, y: 1.25, z: 0 }
|
|
1023
|
+
});
|
|
1024
|
+
emit("hand_reached", {
|
|
1025
|
+
handId: "right-hand",
|
|
1026
|
+
rockId: "rock",
|
|
1027
|
+
handPosition: { x: -2.35, y: 0.9, z: 0.12 },
|
|
1028
|
+
clearanceM: 0.03
|
|
1029
|
+
});
|
|
1030
|
+
emit("grab_constraint_attached", {
|
|
1031
|
+
handId: "right-hand",
|
|
1032
|
+
rockId: "rock",
|
|
1033
|
+
constraint: "hand-rock-fixed"
|
|
1034
|
+
});
|
|
1035
|
+
emit("lift_pose", {
|
|
1036
|
+
rockId: "rock",
|
|
1037
|
+
rockPosition: { x: -2.15, y: 1.2, z: 0.12 }
|
|
1038
|
+
});
|
|
1039
|
+
emit("windup_pose", {
|
|
1040
|
+
avatarId: "avatar",
|
|
1041
|
+
rockId: "rock",
|
|
1042
|
+
shoulderYawDeg: -38,
|
|
1043
|
+
rockPosition: { x: -1.45, y: 1.55, z: 0.08 }
|
|
1044
|
+
});
|
|
1045
|
+
emit("release", {
|
|
1046
|
+
rockId: "rock",
|
|
1047
|
+
releasePosition: RELEASE_POSITION,
|
|
1048
|
+
releaseVelocity: RELEASE_VELOCITY
|
|
1049
|
+
});
|
|
1050
|
+
for (const t of [0.18, 0.36, 0.54]) {
|
|
1051
|
+
emit("ballistic_sample", {
|
|
1052
|
+
rockId: "rock",
|
|
1053
|
+
timeSeconds: t,
|
|
1054
|
+
rockPosition: rockPositionAt(t),
|
|
1055
|
+
gravity: GRAVITY
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
emit("target_contact", {
|
|
1059
|
+
rockId: "rock",
|
|
1060
|
+
targetId: "target",
|
|
1061
|
+
rockPosition: { x: 2.55, y: 0.85, z: 0 },
|
|
1062
|
+
impulseNs: 8.6
|
|
1063
|
+
});
|
|
1064
|
+
emit("aftermath", {
|
|
1065
|
+
targetId: "target",
|
|
1066
|
+
observedImpact: true,
|
|
1067
|
+
provenancePanel: true
|
|
1068
|
+
});
|
|
1069
|
+
const eventLogHash = hashDeterministicSceneValue({
|
|
1070
|
+
sceneHash: scene.sceneHash,
|
|
1071
|
+
seed: scene.seed,
|
|
1072
|
+
actionTrace,
|
|
1073
|
+
observationTrace,
|
|
1074
|
+
events
|
|
1075
|
+
});
|
|
1076
|
+
return {
|
|
1077
|
+
sceneId: scene.sceneId,
|
|
1078
|
+
seed: scene.seed,
|
|
1079
|
+
sceneHash: scene.sceneHash,
|
|
1080
|
+
objects: scene.objects,
|
|
1081
|
+
events,
|
|
1082
|
+
actionTrace,
|
|
1083
|
+
observationTrace,
|
|
1084
|
+
contactCount: 1,
|
|
1085
|
+
predicateViolationCount: 0,
|
|
1086
|
+
invalidActionCount: 0,
|
|
1087
|
+
eventLogHash
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
function buildHumanoidRockThrowTrajectory(options = {}) {
|
|
1091
|
+
const result = runHumanoidRockThrowReplay(options);
|
|
1092
|
+
const id = asTrajectoryId(
|
|
1093
|
+
hashDeterministicSceneValue({
|
|
1094
|
+
sceneHash: result.sceneHash,
|
|
1095
|
+
seed: result.seed,
|
|
1096
|
+
actionTrace: result.actionTrace
|
|
1097
|
+
})
|
|
1098
|
+
);
|
|
1099
|
+
const replayCommand = `holoscript world-model replay --scene ${HUMANOID_ROCK_THROW_SCENE_ID} --trajectory ${id} --seed ${result.seed}`;
|
|
1100
|
+
const baseline = {
|
|
1101
|
+
id,
|
|
1102
|
+
sceneHash: result.sceneHash,
|
|
1103
|
+
seed: result.seed,
|
|
1104
|
+
trustTier: "replayable",
|
|
1105
|
+
caelReceiptHash: asCaelReceiptHash(result.eventLogHash),
|
|
1106
|
+
simulationContract: HUMANOID_ROCK_THROW_CONTRACT,
|
|
1107
|
+
actionTrace: result.actionTrace,
|
|
1108
|
+
observationTrace: result.observationTrace,
|
|
1109
|
+
predicateScore: {
|
|
1110
|
+
violation: 0,
|
|
1111
|
+
novelty: 0,
|
|
1112
|
+
learnability: 0,
|
|
1113
|
+
regression: 0,
|
|
1114
|
+
invalidity: 0
|
|
1115
|
+
},
|
|
1116
|
+
priority: { priority: 0, tieBreaker: 0, rationale: "unscored" },
|
|
1117
|
+
replayHandle: {
|
|
1118
|
+
trajectoryId: id,
|
|
1119
|
+
sceneHash: result.sceneHash,
|
|
1120
|
+
simulationContractId: HUMANOID_ROCK_THROW_CONTRACT.contractId,
|
|
1121
|
+
seed: result.seed,
|
|
1122
|
+
replayCommand
|
|
1123
|
+
},
|
|
1124
|
+
status: "open",
|
|
1125
|
+
discoveredAtMs: options.discoveredAtMs ?? DEFAULT_DISCOVERED_AT_MS2,
|
|
1126
|
+
lastReplayedAtMs: null
|
|
1127
|
+
};
|
|
1128
|
+
const impactAnchor = {
|
|
1129
|
+
id: "target-impact",
|
|
1130
|
+
description: "rock reaches target contact in deterministic replay",
|
|
1131
|
+
evaluate: () => result.events.some((event) => event.type === "target_contact") ? 0 : 1
|
|
1132
|
+
};
|
|
1133
|
+
const score = scoreTrajectory({
|
|
1134
|
+
trajectory: baseline,
|
|
1135
|
+
hardAnchors: [
|
|
1136
|
+
{
|
|
1137
|
+
id: "valid-replay",
|
|
1138
|
+
description: "humanoid rock throw replay has no invalid actions",
|
|
1139
|
+
evaluate: () => result.invalidActionCount === 0
|
|
1140
|
+
}
|
|
1141
|
+
],
|
|
1142
|
+
softAnchors: [impactAnchor],
|
|
1143
|
+
historyActionTypes: /* @__PURE__ */ new Set(),
|
|
1144
|
+
learnabilityEstimate: 0.7
|
|
1145
|
+
});
|
|
1146
|
+
return {
|
|
1147
|
+
result,
|
|
1148
|
+
trajectory: {
|
|
1149
|
+
...baseline,
|
|
1150
|
+
predicateScore: score.predicateScore,
|
|
1151
|
+
priority: score.priority,
|
|
1152
|
+
status: result.predicateViolationCount > 0 ? "unresolved" : "open"
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// src/world-model/TwoAgentHandoffCatchScene.ts
|
|
1158
|
+
var TWO_AGENT_HANDOFF_CATCH_SCENE_ID = "two-agent-handoff-catch-v1";
|
|
1159
|
+
var DEFAULT_SEED3 = 5151;
|
|
1160
|
+
var DEFAULT_DISCOVERED_AT_MS3 = 17e11;
|
|
1161
|
+
var STEP_MS3 = 100;
|
|
1162
|
+
var GRAVITY2 = -9.81;
|
|
1163
|
+
var RELEASE_POSITION2 = { x: -1.48, y: 1.32, z: 0.08 };
|
|
1164
|
+
var RELEASE_VELOCITY2 = { x: 4.4, y: 1.5, z: 0 };
|
|
1165
|
+
var TWO_AGENT_HANDOFF_CATCH_CONTRACT = {
|
|
1166
|
+
contractId: "world-model-two-agent-handoff-catch-v1",
|
|
1167
|
+
hashMode: "fnv1a",
|
|
1168
|
+
adapterFingerprint: "core-world-model-two-agent-handoff-catch-v1",
|
|
1169
|
+
replayDigestMode: "strict-same-adapter",
|
|
1170
|
+
fieldQuantization: [
|
|
1171
|
+
{ fieldPattern: "tool.position", quantum: 1e-6, units: "m" },
|
|
1172
|
+
{ fieldPattern: "hands.*.position", quantum: 1e-6, units: "m" },
|
|
1173
|
+
{ fieldPattern: "release.velocity", quantum: 1e-6, units: "m/s" },
|
|
1174
|
+
{ fieldPattern: "ownership.ownerId", quantum: 1, units: "symbol" }
|
|
1175
|
+
]
|
|
1176
|
+
};
|
|
1177
|
+
function addVec32(a, b) {
|
|
1178
|
+
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
1179
|
+
}
|
|
1180
|
+
function scaleVec32(v, scale) {
|
|
1181
|
+
return { x: v.x * scale, y: v.y * scale, z: v.z * scale };
|
|
1182
|
+
}
|
|
1183
|
+
function toolPositionAt(timeSeconds) {
|
|
1184
|
+
return addVec32(addVec32(RELEASE_POSITION2, scaleVec32(RELEASE_VELOCITY2, timeSeconds)), {
|
|
1185
|
+
x: 0,
|
|
1186
|
+
y: 0.5 * GRAVITY2 * timeSeconds * timeSeconds,
|
|
1187
|
+
z: 0
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
function sceneHashFor3(seed, objects) {
|
|
1191
|
+
return asSceneHash(
|
|
1192
|
+
hashDeterministicSceneValue({ sceneId: TWO_AGENT_HANDOFF_CATCH_SCENE_ID, seed, objects })
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
function createTwoAgentHandoffCatchScene(seed = DEFAULT_SEED3) {
|
|
1196
|
+
const objects = [
|
|
1197
|
+
{ id: "thrower", kind: "agent", center: { x: -2.2, y: 1.1, z: 0 } },
|
|
1198
|
+
{ id: "catcher", kind: "agent", center: { x: 2.2, y: 1.1, z: 0 } },
|
|
1199
|
+
{
|
|
1200
|
+
id: "thrower-hand",
|
|
1201
|
+
kind: "hand",
|
|
1202
|
+
center: { x: -1.72, y: 1.32, z: 0.08 },
|
|
1203
|
+
ownerId: "thrower"
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
id: "catcher-hand",
|
|
1207
|
+
kind: "hand",
|
|
1208
|
+
center: { x: 1.74, y: 1.28, z: 0.08 },
|
|
1209
|
+
ownerId: "catcher"
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
id: "shared-tool",
|
|
1213
|
+
kind: "tool",
|
|
1214
|
+
center: RELEASE_POSITION2,
|
|
1215
|
+
radiusM: 0.16,
|
|
1216
|
+
ownerId: "thrower",
|
|
1217
|
+
massKg: 0.65
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
id: "catch-volume",
|
|
1221
|
+
kind: "catch-volume",
|
|
1222
|
+
center: { x: 1.74, y: 1.28, z: 0.08 },
|
|
1223
|
+
radiusM: 0.35,
|
|
1224
|
+
ownerId: "catcher"
|
|
1225
|
+
},
|
|
1226
|
+
{ id: "stage", kind: "stage", center: { x: 0, y: 0, z: 0 } }
|
|
1227
|
+
];
|
|
1228
|
+
return {
|
|
1229
|
+
sceneId: TWO_AGENT_HANDOFF_CATCH_SCENE_ID,
|
|
1230
|
+
seed,
|
|
1231
|
+
objects,
|
|
1232
|
+
sceneHash: sceneHashFor3(seed, objects)
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function makeAction2(stepIndex, timestampMs, type, payload) {
|
|
1236
|
+
return { stepIndex, timestampMs, type, payload };
|
|
1237
|
+
}
|
|
1238
|
+
function makeObservation2(stepIndex, timestampMs, event) {
|
|
1239
|
+
return {
|
|
1240
|
+
stepIndex,
|
|
1241
|
+
timestampMs,
|
|
1242
|
+
type: "two-agent-handoff-catch-event",
|
|
1243
|
+
payload: {
|
|
1244
|
+
eventType: event.type,
|
|
1245
|
+
payload: event.payload
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
function runTwoAgentHandoffCatchReplay(options = {}) {
|
|
1250
|
+
const scene = createTwoAgentHandoffCatchScene(options.seed ?? DEFAULT_SEED3);
|
|
1251
|
+
const events = [];
|
|
1252
|
+
const actionTrace = [];
|
|
1253
|
+
const observationTrace = [];
|
|
1254
|
+
let ownerId = "thrower";
|
|
1255
|
+
const emit = (type, payload) => {
|
|
1256
|
+
const stepIndex = events.length;
|
|
1257
|
+
const timestampMs = stepIndex * STEP_MS3;
|
|
1258
|
+
const event = { stepIndex, timestampMs, type, payload };
|
|
1259
|
+
events.push(event);
|
|
1260
|
+
actionTrace.push(makeAction2(stepIndex, timestampMs, type, payload));
|
|
1261
|
+
observationTrace.push(makeObservation2(stepIndex, timestampMs, event));
|
|
1262
|
+
};
|
|
1263
|
+
emit("scene_loaded", {
|
|
1264
|
+
throwerId: "thrower",
|
|
1265
|
+
catcherId: "catcher",
|
|
1266
|
+
toolId: "shared-tool",
|
|
1267
|
+
ownerId
|
|
1268
|
+
});
|
|
1269
|
+
emit("agents_aligned", {
|
|
1270
|
+
throwerHandId: "thrower-hand",
|
|
1271
|
+
catcherHandId: "catcher-hand",
|
|
1272
|
+
toolId: "shared-tool",
|
|
1273
|
+
facing: true
|
|
1274
|
+
});
|
|
1275
|
+
ownerId = null;
|
|
1276
|
+
emit("release_constraint_detached", {
|
|
1277
|
+
toolId: "shared-tool",
|
|
1278
|
+
fromHandId: "thrower-hand",
|
|
1279
|
+
previousOwnerId: "thrower",
|
|
1280
|
+
ownerId,
|
|
1281
|
+
releasePosition: RELEASE_POSITION2,
|
|
1282
|
+
releaseVelocity: RELEASE_VELOCITY2
|
|
1283
|
+
});
|
|
1284
|
+
for (const t of [0.18, 0.36, 0.54]) {
|
|
1285
|
+
emit("ballistic_sample", {
|
|
1286
|
+
toolId: "shared-tool",
|
|
1287
|
+
timeSeconds: t,
|
|
1288
|
+
toolPosition: toolPositionAt(t),
|
|
1289
|
+
gravity: GRAVITY2,
|
|
1290
|
+
ownerId
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
emit("catch_volume_entered", {
|
|
1294
|
+
toolId: "shared-tool",
|
|
1295
|
+
catchVolumeId: "catch-volume",
|
|
1296
|
+
toolPosition: { x: 1.74, y: 1.28, z: 0.08 },
|
|
1297
|
+
clearanceM: 0.04
|
|
1298
|
+
});
|
|
1299
|
+
ownerId = "catcher";
|
|
1300
|
+
emit("catch_constraint_attached", {
|
|
1301
|
+
toolId: "shared-tool",
|
|
1302
|
+
handId: "catcher-hand",
|
|
1303
|
+
constraint: "hand-tool-fixed",
|
|
1304
|
+
ownerId
|
|
1305
|
+
});
|
|
1306
|
+
emit("ownership_transferred", {
|
|
1307
|
+
objectId: "shared-tool",
|
|
1308
|
+
from: "thrower",
|
|
1309
|
+
to: "catcher",
|
|
1310
|
+
transferMode: "release-flight-catch"
|
|
1311
|
+
});
|
|
1312
|
+
emit("receipt_emitted", {
|
|
1313
|
+
objectId: "shared-tool",
|
|
1314
|
+
ownerId,
|
|
1315
|
+
releaseConfirmed: true,
|
|
1316
|
+
catchConfirmed: true,
|
|
1317
|
+
provenancePanel: true
|
|
1318
|
+
});
|
|
1319
|
+
const eventLogHash = hashDeterministicSceneValue({
|
|
1320
|
+
sceneHash: scene.sceneHash,
|
|
1321
|
+
seed: scene.seed,
|
|
1322
|
+
actionTrace,
|
|
1323
|
+
observationTrace,
|
|
1324
|
+
events
|
|
1325
|
+
});
|
|
1326
|
+
return {
|
|
1327
|
+
sceneId: scene.sceneId,
|
|
1328
|
+
seed: scene.seed,
|
|
1329
|
+
sceneHash: scene.sceneHash,
|
|
1330
|
+
objects: scene.objects,
|
|
1331
|
+
events,
|
|
1332
|
+
actionTrace,
|
|
1333
|
+
observationTrace,
|
|
1334
|
+
contactCount: 1,
|
|
1335
|
+
predicateViolationCount: 0,
|
|
1336
|
+
invalidActionCount: 0,
|
|
1337
|
+
eventLogHash
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
function buildTwoAgentHandoffCatchTrajectory(options = {}) {
|
|
1341
|
+
const result = runTwoAgentHandoffCatchReplay(options);
|
|
1342
|
+
const id = asTrajectoryId(
|
|
1343
|
+
hashDeterministicSceneValue({
|
|
1344
|
+
sceneHash: result.sceneHash,
|
|
1345
|
+
seed: result.seed,
|
|
1346
|
+
actionTrace: result.actionTrace
|
|
1347
|
+
})
|
|
1348
|
+
);
|
|
1349
|
+
const replayCommand = `holoscript world-model replay --scene ${TWO_AGENT_HANDOFF_CATCH_SCENE_ID} --trajectory ${id} --seed ${result.seed}`;
|
|
1350
|
+
const baseline = {
|
|
1351
|
+
id,
|
|
1352
|
+
sceneHash: result.sceneHash,
|
|
1353
|
+
seed: result.seed,
|
|
1354
|
+
trustTier: "replayable",
|
|
1355
|
+
caelReceiptHash: asCaelReceiptHash(result.eventLogHash),
|
|
1356
|
+
simulationContract: TWO_AGENT_HANDOFF_CATCH_CONTRACT,
|
|
1357
|
+
actionTrace: result.actionTrace,
|
|
1358
|
+
observationTrace: result.observationTrace,
|
|
1359
|
+
predicateScore: {
|
|
1360
|
+
violation: 0,
|
|
1361
|
+
novelty: 0,
|
|
1362
|
+
learnability: 0,
|
|
1363
|
+
regression: 0,
|
|
1364
|
+
invalidity: 0
|
|
1365
|
+
},
|
|
1366
|
+
priority: { priority: 0, tieBreaker: 0, rationale: "unscored" },
|
|
1367
|
+
replayHandle: {
|
|
1368
|
+
trajectoryId: id,
|
|
1369
|
+
sceneHash: result.sceneHash,
|
|
1370
|
+
simulationContractId: TWO_AGENT_HANDOFF_CATCH_CONTRACT.contractId,
|
|
1371
|
+
seed: result.seed,
|
|
1372
|
+
replayCommand
|
|
1373
|
+
},
|
|
1374
|
+
status: "open",
|
|
1375
|
+
discoveredAtMs: options.discoveredAtMs ?? DEFAULT_DISCOVERED_AT_MS3,
|
|
1376
|
+
lastReplayedAtMs: null
|
|
1377
|
+
};
|
|
1378
|
+
const ownershipAnchor = {
|
|
1379
|
+
id: "ownership-transfer",
|
|
1380
|
+
description: "tool ownership transfers from thrower to catcher",
|
|
1381
|
+
evaluate: () => result.events.some((event) => event.type === "ownership_transferred") ? 0 : 1
|
|
1382
|
+
};
|
|
1383
|
+
const catchAnchor = {
|
|
1384
|
+
id: "catch-constraint",
|
|
1385
|
+
description: "catcher hand receives fixed tool constraint",
|
|
1386
|
+
evaluate: () => result.events.some((event) => event.type === "catch_constraint_attached") ? 0 : 1
|
|
1387
|
+
};
|
|
1388
|
+
const score = scoreTrajectory({
|
|
1389
|
+
trajectory: baseline,
|
|
1390
|
+
hardAnchors: [
|
|
1391
|
+
{
|
|
1392
|
+
id: "valid-handoff-replay",
|
|
1393
|
+
description: "handoff catch replay has no invalid actions",
|
|
1394
|
+
evaluate: () => result.invalidActionCount === 0
|
|
1395
|
+
}
|
|
1396
|
+
],
|
|
1397
|
+
softAnchors: [ownershipAnchor, catchAnchor],
|
|
1398
|
+
historyActionTypes: /* @__PURE__ */ new Set(),
|
|
1399
|
+
learnabilityEstimate: 0.75
|
|
1400
|
+
});
|
|
1401
|
+
return {
|
|
1402
|
+
result,
|
|
1403
|
+
trajectory: {
|
|
1404
|
+
...baseline,
|
|
1405
|
+
predicateScore: score.predicateScore,
|
|
1406
|
+
priority: score.priority,
|
|
1407
|
+
status: result.predicateViolationCount > 0 ? "unresolved" : "open"
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
export { BUILT_IN_PROFILES, DEFAULT_DETERMINISTIC_FAILURE_ACTIONS, DETERMINISTIC_FAILURE_CONTRACT, HARDWARE_RECEIPT_METADATA_SCHEMA_VERSION, HUMANOID_ROCK_THROW_CONTRACT, HUMANOID_ROCK_THROW_SCENE_ID, TWO_AGENT_HANDOFF_CATCH_CONTRACT, TWO_AGENT_HANDOFF_CATCH_SCENE_ID, asCaelReceiptHash, asSceneHash, asTrajectoryId, buildAdversarialTrajectoryReport, buildDeterministicFailureTrajectory, buildHumanoidRockThrowTrajectory, buildTwoAgentHandoffCatchTrajectory, createDeterministicFailureDiscoveryScene, createHumanoidRockThrowScene, createTwoAgentHandoffCatchScene, exploreAdversarialTraces, hasReplayEvidence, hashDeterministicSceneValue, isCurriculumEligible, isPortableHardwareReceiptMetadata, isReportCountsConsistent, mutateTrace, runDeterministicFailureDiscoveryScene, runHumanoidRockThrowReplay, runTwoAgentHandoffCatchReplay, scoreTrajectory, serializeReport, validatePortableHardwareReceiptMetadata };
|
|
1413
|
+
//# sourceMappingURL=index.js.map
|
|
1414
|
+
//# sourceMappingURL=index.js.map
|