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