openpond 0.2.70 → 0.2.72
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/dist/app-server.js +1 -1
- package/dist/chunks/{acp-QTA6IU6W.js → acp-7A2UPCG5.js} +1 -1
- package/dist/chunks/{acp-agent-N77HPAYQ.js → acp-agent-AGALGR6V.js} +1 -1
- package/dist/chunks/{actions-command-BZQCUDMD.js → actions-command-AXGXBU75.js} +1 -1
- package/dist/chunks/{app-layer-YQQNLIXA.js → app-layer-DUCNCJ2X.js} +1 -1
- package/dist/chunks/{app-server-evaluations-RRLYWLPK.js → app-server-evaluations-SNWXULKD.js} +1 -1
- package/dist/chunks/{app-server-harness-services-XXM336NU.js → app-server-harness-services-YNMGMKPK.js} +1 -1
- package/dist/chunks/app-server-runtime-BKJ7L6JZ.js +2 -0
- package/dist/chunks/{apps-WG7WY5CB.js → apps-2OWE23BH.js} +1 -1
- package/dist/chunks/{chunk-ZDEIVUUI.js → chunk-27OJ2OLP.js} +1 -1
- package/dist/chunks/{chunk-NSSZ2ZIU.js → chunk-2EAZB2MW.js} +1 -1
- package/dist/chunks/{chunk-DRLP7GIU.js → chunk-2GEZ3ZY7.js} +1 -1
- package/dist/chunks/{chunk-PAYFJHPO.js → chunk-2PVW2XFF.js} +1 -1
- package/dist/chunks/chunk-2Q2AWPP2.js +2 -0
- package/dist/chunks/{chunk-Y2WNZWT2.js → chunk-2Q6FTL4C.js} +1 -1
- package/dist/chunks/{chunk-KP2MYTP5.js → chunk-2QHB5P2K.js} +1 -1
- package/dist/chunks/{chunk-HG2YFMVU.js → chunk-2THZ6GZY.js} +1 -1
- package/dist/chunks/{chunk-DXJC3QW7.js → chunk-3VT2PPKW.js} +1 -1
- package/dist/chunks/{chunk-4BUM6JEC.js → chunk-4JKWCLTQ.js} +1 -1
- package/dist/chunks/{chunk-AQUZCWM3.js → chunk-5TPJ5ECJ.js} +1 -1
- package/dist/chunks/{chunk-RCQYEHHD.js → chunk-5TTQCT3G.js} +1 -1
- package/dist/chunks/{chunk-NMMHXYDJ.js → chunk-5WFKBZCU.js} +1 -1
- package/dist/chunks/{chunk-P4QM63L3.js → chunk-5ZBDHIIE.js} +1 -1
- package/dist/chunks/{chunk-WD4KAKEX.js → chunk-64EDQ7UV.js} +1 -1
- package/dist/chunks/{chunk-KU4TPDPH.js → chunk-6LAGMWJE.js} +1 -1
- package/dist/chunks/{chunk-VJYOKU3C.js → chunk-6OD2FKUS.js} +1 -1
- package/dist/chunks/{chunk-65FJWWXG.js → chunk-6YR5IYHH.js} +1 -1
- package/dist/chunks/{chunk-AUO5DCEU.js → chunk-73COPJ32.js} +1 -1
- package/dist/chunks/{chunk-SSHE6B7Z.js → chunk-AITV76GO.js} +1 -1
- package/dist/chunks/{chunk-PLROXHG2.js → chunk-ATI52WMB.js} +1 -1
- package/dist/chunks/chunk-AWD72O3G.js +2 -0
- package/dist/chunks/{chunk-DKOVZ6R2.js → chunk-BQNU4HZW.js} +1 -1
- package/dist/chunks/{chunk-UANH7U3Y.js → chunk-BTEBZYK3.js} +1 -1
- package/dist/chunks/{chunk-3Z4VM2LF.js → chunk-BUMCJHQP.js} +1 -1
- package/dist/chunks/{chunk-BU6MW65V.js → chunk-BYVE4TMU.js} +1 -1
- package/dist/chunks/{chunk-PNPV2LDE.js → chunk-BZS2PA4O.js} +1 -1
- package/dist/chunks/{chunk-AFYYIJ6K.js → chunk-C7NQPICU.js} +1 -1
- package/dist/chunks/{chunk-EWH64WRR.js → chunk-CAYKEJJY.js} +1 -1
- package/dist/chunks/{chunk-K7KBFM2T.js → chunk-CBD554GZ.js} +1 -1
- package/dist/chunks/{chunk-7RJOCGQ6.js → chunk-CHRED2FK.js} +1 -1
- package/dist/chunks/{chunk-3A2Y7UK3.js → chunk-CQRA5TXF.js} +1 -1
- package/dist/chunks/{chunk-GYYJ47GX.js → chunk-CWE2N3JI.js} +1 -1
- package/dist/chunks/{chunk-ZYLLPRPU.js → chunk-CX4T7I47.js} +1 -1
- package/dist/chunks/{chunk-TAXCMCYZ.js → chunk-CX4U32VO.js} +4 -4
- package/dist/chunks/{chunk-7TM25J6S.js → chunk-DFSQ5HZ7.js} +2 -2
- package/dist/chunks/{chunk-2PXKSAG6.js → chunk-DLOJG7LP.js} +1 -1
- package/dist/chunks/{chunk-BGMAWETL.js → chunk-DNRC6TPJ.js} +1 -1
- package/dist/chunks/{chunk-5FSPDSAO.js → chunk-DUR32LJG.js} +1 -1
- package/dist/chunks/{chunk-FHDH4OUA.js → chunk-EHMA5XS7.js} +1 -1
- package/dist/chunks/{chunk-Z33RVGP6.js → chunk-ENY24ZBB.js} +1 -1
- package/dist/chunks/{chunk-JVNKSU27.js → chunk-F3IEAU7O.js} +1 -1
- package/dist/chunks/{chunk-M4A7G4S5.js → chunk-FOAM3YZQ.js} +1 -1
- package/dist/chunks/{chunk-VJR2GNRY.js → chunk-FVMTQSVW.js} +1 -1
- package/dist/chunks/{chunk-YI6ME6PU.js → chunk-GG6PM7TB.js} +1 -1
- package/dist/chunks/{chunk-DDOIPTOM.js → chunk-GMA365GI.js} +1 -1
- package/dist/chunks/{chunk-KCLMA2IH.js → chunk-GPGXBKXU.js} +1 -1
- package/dist/chunks/{chunk-JVMSN7LH.js → chunk-GR4MJJCE.js} +1 -1
- package/dist/chunks/{chunk-7OFD6TFD.js → chunk-HA762QYM.js} +1 -1
- package/dist/chunks/{chunk-Q7FBVLLB.js → chunk-HBGTHOOB.js} +1 -1
- package/dist/chunks/{chunk-AFH462DO.js → chunk-HT6ILPD6.js} +1 -1
- package/dist/chunks/{chunk-XYZV3FKD.js → chunk-I6KTJ3GH.js} +1 -1
- package/dist/chunks/{chunk-OUJ63LMU.js → chunk-IA6CTX7A.js} +1 -1
- package/dist/chunks/{chunk-XHACK2KR.js → chunk-IUYGQO2K.js} +1 -1
- package/dist/chunks/{chunk-55YD4UTW.js → chunk-IV2HEX3I.js} +1 -1
- package/dist/chunks/{chunk-MOXIGLN2.js → chunk-JALL5NPH.js} +1 -1
- package/dist/chunks/{chunk-U7X5ZLAL.js → chunk-JCHLDNCX.js} +1 -1
- package/dist/chunks/{chunk-7PKDJHT6.js → chunk-JH4RACOB.js} +1 -1
- package/dist/chunks/{chunk-MIFVX5PK.js → chunk-JSDGOQ5U.js} +1 -1
- package/dist/chunks/{chunk-65WRWLUD.js → chunk-JVEIK4RH.js} +1 -1
- package/dist/chunks/{chunk-PPF6EBTQ.js → chunk-K3WM4NEC.js} +1 -1
- package/dist/chunks/{chunk-CCZ276IA.js → chunk-KOIXRLZZ.js} +1 -1
- package/dist/chunks/{chunk-6C6ZCYTL.js → chunk-KRJZ5CW3.js} +1 -1
- package/dist/chunks/{chunk-CUB6PWAJ.js → chunk-KTQWWCP2.js} +6 -6
- package/dist/chunks/{chunk-Y4E5AAI7.js → chunk-KUEVP7WM.js} +1 -1
- package/dist/chunks/{chunk-U7D6Q744.js → chunk-L5L3H6CI.js} +1 -1
- package/dist/chunks/{chunk-VWWKWYSQ.js → chunk-LHTRQAPZ.js} +1 -1
- package/dist/chunks/{chunk-QLGP2OAQ.js → chunk-MLLMLXKG.js} +1 -1
- package/dist/chunks/{chunk-QUNQM2E3.js → chunk-MPEK4ZNY.js} +1 -1
- package/dist/chunks/{chunk-EGP6DF34.js → chunk-MPXOPL7R.js} +2 -2
- package/dist/chunks/{chunk-PHZZBXDO.js → chunk-MQMMJKOZ.js} +1 -1
- package/dist/chunks/{chunk-B66QCXH2.js → chunk-MWPMYCYB.js} +1 -1
- package/dist/chunks/{chunk-5G7BQAUA.js → chunk-N5FT6PTI.js} +1 -1
- package/dist/chunks/{chunk-SDHG6CKU.js → chunk-NDNSLCPE.js} +1 -1
- package/dist/chunks/{chunk-WCNPGKST.js → chunk-O4YHISU2.js} +1 -1
- package/dist/chunks/{chunk-IO5DZUKL.js → chunk-OI4DAZ4U.js} +1 -1
- package/dist/chunks/{chunk-Q73RKX7I.js → chunk-OIIE5GUK.js} +1 -1
- package/dist/chunks/{chunk-N5EAVX4G.js → chunk-OOKHHOIU.js} +1 -1
- package/dist/chunks/{chunk-7OKZCJHS.js → chunk-OXRN2257.js} +1 -1
- package/dist/chunks/{chunk-HES4VP3D.js → chunk-PYPXP5R3.js} +1 -1
- package/dist/chunks/{chunk-ZK3ET5EP.js → chunk-QKBMXL4D.js} +3 -3
- package/dist/chunks/{chunk-YAA7F5LI.js → chunk-QKGNAYSC.js} +1 -1
- package/dist/chunks/{chunk-KDER7R45.js → chunk-RIFWD5XM.js} +1 -1
- package/dist/chunks/{chunk-WZ35ICTE.js → chunk-RWBP2H4M.js} +1 -1
- package/dist/chunks/{chunk-SO4GMSNP.js → chunk-S5ACNR5Y.js} +1 -1
- package/dist/chunks/{chunk-M4ZHFDRJ.js → chunk-SRK4WX7D.js} +1 -1
- package/dist/chunks/{chunk-XY7HFXLH.js → chunk-SVLVIYH2.js} +1 -1
- package/dist/chunks/{chunk-FNGZ4UDZ.js → chunk-T6ML5SCD.js} +1 -1
- package/dist/chunks/{chunk-CO23RRN7.js → chunk-TD5YYA5Z.js} +1 -1
- package/dist/chunks/{chunk-7NCM6GBN.js → chunk-TOWY6Y23.js} +1 -1
- package/dist/chunks/{chunk-OXQ2WFIH.js → chunk-TR5UC5AF.js} +1 -1
- package/dist/chunks/{chunk-JQOVC35K.js → chunk-UCPD526R.js} +1 -1
- package/dist/chunks/{chunk-Y4I6CFZJ.js → chunk-UGDBMRCT.js} +1 -1
- package/dist/chunks/{chunk-E2JB5OCO.js → chunk-UZE3C2SF.js} +1 -1
- package/dist/chunks/{chunk-PACLKDTN.js → chunk-V4VM2R6D.js} +1 -1
- package/dist/chunks/{chunk-XOPHFUUY.js → chunk-VMBWCIGG.js} +1 -1
- package/dist/chunks/{chunk-CIZI6Z7D.js → chunk-VMW23TIZ.js} +1 -1
- package/dist/chunks/{chunk-4G3GTEVS.js → chunk-VSQPWLAG.js} +1 -1
- package/dist/chunks/{chunk-54755JYM.js → chunk-VXFGSFIE.js} +2 -2
- package/dist/chunks/{chunk-R2FYCJL6.js → chunk-W4JBPYGW.js} +1 -1
- package/dist/chunks/{chunk-JZKTBYNB.js → chunk-WMJEQK4G.js} +1 -1
- package/dist/chunks/{chunk-ESYPMD7Q.js → chunk-X2MJFTLS.js} +1 -1
- package/dist/chunks/{chunk-67U7PAMU.js → chunk-X7ZMUWJO.js} +1 -1
- package/dist/chunks/{chunk-WGQ3FMRF.js → chunk-XKDOPNQ5.js} +1 -1
- package/dist/chunks/{chunk-EYTTZ5H4.js → chunk-XLZMSD5K.js} +1 -1
- package/dist/chunks/{chunk-ZIQJDTQB.js → chunk-XTT3K3TR.js} +1 -1
- package/dist/chunks/{chunk-Q7P34B2O.js → chunk-YFHQRDNQ.js} +1 -1
- package/dist/chunks/{chunk-UGFSAG4U.js → chunk-YG3HITOU.js} +1 -1
- package/dist/chunks/{chunk-DWF3FCY4.js → chunk-Z5R4OSGC.js} +1 -1
- package/dist/chunks/{chunk-JT5YQ52I.js → chunk-Z6HWSTEP.js} +1 -1
- package/dist/chunks/{chunk-4PUOWSDE.js → chunk-ZEOYNUHL.js} +1 -1
- package/dist/chunks/{chunk-4KTGYHCE.js → chunk-ZMRP2A7K.js} +1 -1
- package/dist/chunks/{chunk-OL3L3U36.js → chunk-ZSWATWK2.js} +1 -1
- package/dist/chunks/cli-KXU5DNVV.js +2 -0
- package/dist/chunks/{command-5AXJMFYC.js → command-X35I53H3.js} +3 -3
- package/dist/chunks/{configuration-command-5LUNWPOL.js → configuration-command-VJUK34UQ.js} +1 -1
- package/dist/chunks/{connected-app-executor-DHXZE4X3.js → connected-app-executor-JBFJF2H5.js} +1 -1
- package/dist/chunks/{connected-evidence-NWMPICKJ.js → connected-evidence-CQ533AML.js} +1 -1
- package/dist/chunks/{connected-starting-assets-NRVXIKQ2.js → connected-starting-assets-RL5X6LZ7.js} +1 -1
- package/dist/chunks/{continual-UCKQ2QLH.js → continual-PHGIZFF6.js} +1 -1
- package/dist/chunks/{core-commands-ZPBX35M2.js → core-commands-5DYMDWXY.js} +1 -1
- package/dist/chunks/{dataset-preparation-authoring-UUYFWWCT.js → dataset-preparation-authoring-UDSX33YK.js} +1 -1
- package/dist/chunks/{datasets-6K3ZANIV.js → datasets-BW4JFUUU.js} +1 -1
- package/dist/chunks/{desktop-test-57INNJ76.js → desktop-test-RIG4CB2Z.js} +1 -1
- package/dist/chunks/{dist-2MKJC6HN.js → dist-C5XFRP53.js} +1 -1
- package/dist/chunks/{evaluation-coordination-B7CN4R2D.js → evaluation-coordination-6QJ6XTUX.js} +1 -1
- package/dist/chunks/{experiment-improvements-G357VLDB.js → experiment-improvements-2XF63AQ4.js} +1 -1
- package/dist/chunks/{experiments-BHQO26LJ.js → experiments-3S2BVNK6.js} +1 -1
- package/dist/chunks/{experiments-signal-BI6NKETB.js → experiments-signal-IRBHGGW5.js} +1 -1
- package/dist/chunks/{help-UQN5RUPA.js → help-Q2VMJVTR.js} +1 -1
- package/dist/chunks/host-profile-evaluation-tools-5LZQHA32.js +2 -0
- package/dist/chunks/{host-profile-external-dataset-KSEPXY2S.js → host-profile-external-dataset-C6ZPMTX6.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-WDDO6F23.js → hosted-app-server-composition-AYZM2HY6.js} +1 -1
- package/dist/chunks/{hosted-experiment-improvement-VVYXQ65K.js → hosted-experiment-improvement-SMZJYRJ7.js} +1 -1
- package/dist/chunks/hosted-harness-runtime-QWIFAITG.js +2 -0
- package/dist/chunks/{hosted-profile-candidate-PTGQLPZO.js → hosted-profile-candidate-WOMWAE5N.js} +1 -1
- package/dist/chunks/{hosted-profile-compiler-FS5R6CHJ.js → hosted-profile-compiler-NZ2BXN32.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-control-UUEZEMXU.js → hosted-profile-evaluation-control-3ECFFM7E.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-inspection-4F7OEF4T.js → hosted-profile-evaluation-inspection-TM7RKONG.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-preparation-LIJJZDHQ.js → hosted-profile-evaluation-preparation-2MZIRT75.js} +1 -1
- package/dist/chunks/{hosted-tasksets-KCLNMPG5.js → hosted-tasksets-IUK3VWSL.js} +1 -1
- package/dist/chunks/{human-review-PX6DBIFT.js → human-review-PG4WWVWV.js} +1 -1
- package/dist/chunks/{import-2HEYPHPW.js → import-FAZAVZBF.js} +1 -1
- package/dist/chunks/{learning-Y3UKNUGE.js → learning-3XDYMYBE.js} +1 -1
- package/dist/chunks/{learning-LSXBL5DB.js → learning-OR4CYV4B.js} +1 -1
- package/dist/chunks/local-harness-improvement-runtime-OYLTKMJU.js +2 -0
- package/dist/chunks/local-harness-taskset-review-I7YU4RZI.js +2 -0
- package/dist/chunks/{model-projects-6YWVD2TS.js → model-projects-POZRHXTF.js} +1 -1
- package/dist/chunks/{opchat-66BCRKEZ.js → opchat-TCZA6373.js} +1 -1
- package/dist/chunks/{opchat-bounded-chat-KQWXZVFN.js → opchat-bounded-chat-GMYDXLWB.js} +1 -1
- package/dist/chunks/{organizations-IOYWDOCC.js → organizations-PYKGA2P2.js} +1 -1
- package/dist/chunks/{profile-YH6G3ZTD.js → profile-GYYI555I.js} +1 -1
- package/dist/chunks/project-action-payload-FE6M2OXJ.js +2 -0
- package/dist/chunks/{project-agent-RYVMKW2F.js → project-agent-4ISJFMJD.js} +1 -1
- package/dist/chunks/{published-experiment-source-SDXUVPE7.js → published-experiment-source-E2YAJCLM.js} +1 -1
- package/dist/chunks/{refiner-profile-service-56VYLZQJ.js → refiner-profile-service-LKGXD5WJ.js} +1 -1
- package/dist/chunks/{runtime-ISLJIGWC.js → runtime-UDLOZD4Y.js} +2 -2
- package/dist/chunks/{sandbox-command-DI45NRTV.js → sandbox-command-4J6DAY7T.js} +1 -1
- package/dist/chunks/{sandbox-template-T42MDUSR.js → sandbox-template-TSXWJMWG.js} +1 -1
- package/dist/chunks/saved-work-QTEBKVUB.js +2 -0
- package/dist/chunks/{send-turn-YLY3YNEQ.js → send-turn-4MH4WMLW.js} +1 -1
- package/dist/chunks/{setup-D6TY2GWV.js → setup-IVT2FQSE.js} +1 -1
- package/dist/chunks/{src-7RN7BF4W.js → src-DC7N2H7A.js} +111 -113
- package/dist/chunks/{src-LF5X4RNQ.js → src-TOSQX36I.js} +1 -1
- package/dist/chunks/{standalone-experiment-turn-owner-TW5MTWIO.js → standalone-experiment-turn-owner-UYPA6XHW.js} +1 -1
- package/dist/chunks/{store-chat-resources-IRHBW2EC.js → store-chat-resources-QLXKKYYC.js} +1 -1
- package/dist/chunks/{store-continual-support-reviews-3KK42L4I.js → store-continual-support-reviews-4F2BOG3H.js} +1 -1
- package/dist/chunks/{store-conversation-serving-IVURK52V.js → store-conversation-serving-EUD47W6X.js} +1 -1
- package/dist/chunks/{store-create-improve-UTCLBXF2.js → store-create-improve-QUOTNNIM.js} +1 -1
- package/dist/chunks/{store-datasets-4AQOVAQY.js → store-datasets-ZUC7CNVO.js} +1 -1
- package/dist/chunks/{store-evaluation-results-PK2P3IMH.js → store-evaluation-results-LHHPHESK.js} +1 -1
- package/dist/chunks/{store-harness-workspaces-YEXB4IRV.js → store-harness-workspaces-TKX5PZWP.js} +1 -1
- package/dist/chunks/{store-human-review-O4BVHP25.js → store-human-review-7WZWRJ6X.js} +1 -1
- package/dist/chunks/{store-learned-preference-migration-validation-44SVX6YB.js → store-learned-preference-migration-validation-MVNKBR4X.js} +1 -1
- package/dist/chunks/{store-learning-SIUQIY5C.js → store-learning-WLUW2PWE.js} +1 -1
- package/dist/chunks/{store-learning-credentials-BUHR7SN6.js → store-learning-credentials-FDKCEDHK.js} +1 -1
- package/dist/chunks/{store-local-experiments-BHVTKPPE.js → store-local-experiments-HB53QFLL.js} +1 -1
- package/dist/chunks/{store-model-batch-review-RVAYUVK2.js → store-model-batch-review-O3I6GIAA.js} +1 -1
- package/dist/chunks/{store-model-configuration-AYFGMC5D.js → store-model-configuration-CDIGNU6Q.js} +1 -1
- package/dist/chunks/{store-model-project-preparation-5DEIS7TB.js → store-model-project-preparation-QMQ2HMJV.js} +1 -1
- package/dist/chunks/{store-modification-recordings-LCPK6K2T.js → store-modification-recordings-W4VEZKKQ.js} +1 -1
- package/dist/chunks/{store-preference-comparison-5YVIQNVB.js → store-preference-comparison-JKURBESE.js} +1 -1
- package/dist/chunks/{store-sidebar-file-bookmarks-WLMYDA4E.js → store-sidebar-file-bookmarks-KAEDHVVF.js} +1 -1
- package/dist/chunks/{store-sidebar-preferences-AFMYIDWT.js → store-sidebar-preferences-QPBLTHY6.js} +1 -1
- package/dist/chunks/{store-subagents-KFPVSTRO.js → store-subagents-ZELQP3MX.js} +1 -1
- package/dist/chunks/{store-task-inbox-L6IQTY26.js → store-task-inbox-4ZDQR2E7.js} +1 -1
- package/dist/chunks/{store-task-inventory-QWS2C656.js → store-task-inventory-CTIJDLYE.js} +1 -1
- package/dist/chunks/{store-taskset-drafts-EAOOY6CR.js → store-taskset-drafts-FRPBYLTW.js} +1 -1
- package/dist/chunks/{store-training-FYXZU2FE.js → store-training-WQAYUT7B.js} +1 -1
- package/dist/chunks/{store-training-jobs-3N3VKPIY.js → store-training-jobs-O5EHGTH7.js} +1 -1
- package/dist/chunks/{store-training-models-VOFVGPZR.js → store-training-models-YSZMC66T.js} +1 -1
- package/dist/chunks/{taskset-HNDIGYQG.js → taskset-OVYM4QMS.js} +1 -1
- package/dist/chunks/{taskset-packages-WMG5DUBN.js → taskset-packages-FUQWNTSB.js} +1 -1
- package/dist/chunks/{taskset-packages-T6B6HYKZ.js → taskset-packages-GM6IUOTY.js} +1 -1
- package/dist/chunks/{teams-bot-Z5CZLWE4.js → teams-bot-U2M3ORWR.js} +1 -1
- package/dist/chunks/{tool-learning-ZQ6NSJ5K.js → tool-learning-NXVR4YPA.js} +1 -1
- package/dist/chunks/{training-JTYQA7GA.js → training-EQ7G5FDY.js} +1 -1
- package/dist/chunks/training-LQUAL4Y4.js +2 -0
- package/dist/chunks/training-PEZYJ2SN.js +2 -0
- package/dist/chunks/{training-hosted-36SZFS4U.js → training-hosted-XKSUTMLQ.js} +1 -1
- package/dist/chunks/{training-hosted-alphaedit-HSMRDJTD.js → training-hosted-alphaedit-VCOEYLKK.js} +1 -1
- package/dist/chunks/{training-hosted-decision-7JALOU6O.js → training-hosted-decision-IKWWXA56.js} +1 -1
- package/dist/chunks/{training-hosted-engram-SXO75MFG.js → training-hosted-engram-3TOPPVSW.js} +1 -1
- package/dist/chunks/{training-hosted-learning-E2N32YU5.js → training-hosted-learning-UEBGSSNC.js} +1 -1
- package/dist/chunks/{training-hosted-modification-comparison-TXFDJFTG.js → training-hosted-modification-comparison-C6S4JFHW.js} +1 -1
- package/dist/chunks/{training-hosted-neuron-training-J42WK4EH.js → training-hosted-neuron-training-EP2U4PHG.js} +1 -1
- package/dist/chunks/{training-hosted-serving-report-BAEABGJH.js → training-hosted-serving-report-KJMRZJLQ.js} +1 -1
- package/dist/chunks/{training-hosted-steering-T556BUBG.js → training-hosted-steering-I27DV6A2.js} +1 -1
- package/dist/chunks/{training-model-start-P3PXDWNT.js → training-model-start-NWXNGRDC.js} +1 -1
- package/dist/chunks/{workspaces-EK62ANTB.js → workspaces-FVQYJPOS.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/skills/manifest.json +3 -3
- package/dist/skills/openpond-cli/references/experiments-and-training.md +19 -0
- package/dist/web/assets/App-QM6Y2Eod.js +54 -0
- package/dist/web/assets/{AppDialog-x1HU1uLv.js → AppDialog-C8um481a.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-CNIKmqKc.js → AppTerminalPanel-OwNr-bp6.js} +2 -2
- package/dist/web/assets/{AppToastContext-DNWd43HS.js → AppToastContext-BQ4iRFif.js} +1 -1
- package/dist/web/assets/{AppsView-BvOD83Z1.js → AppsView-mk8m_Cra.js} +1 -1
- package/dist/web/assets/{AttachmentTypeIcon-BLdDr3JZ.js → AttachmentTypeIcon-SITPqTtF.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-Ar0FlFKg.js → BrowserSidebar-BghdIKTB.js} +1 -1
- package/dist/web/assets/{CartesianChart-tS7f1HZv.js → CartesianChart-BdRx7q_O.js} +1 -1
- package/dist/web/assets/{ChatTimelineEntry-z7_kur3h.js → ChatTimelineEntry-BBOnAzJB.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-CaiFEKrv.js → CollaborationTabs-Beja-9s5.js} +1 -1
- package/dist/web/assets/{CommandMenu-BpubEqaA.js → CommandMenu-CQtrSUpu.js} +1 -1
- package/dist/web/assets/{CommunityView-TGR4s99l.js → CommunityView-LPTAakS-.js} +1 -1
- package/dist/web/assets/{ComposerAttachments-DPWCjKXz.js → ComposerAttachments-DI-Gr7Zw.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-Drji01_6.js → ComposerCreateImproveStrip-CY5Uw1yc.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-B_oW0cz7.js → ConversationImportsSettings-DFwhKERw.js} +1 -1
- package/dist/web/assets/{DatasetReviewImport-Dr3unJSY.js → DatasetReviewImport-C9xraQk7.js} +1 -1
- package/dist/web/assets/{ExperimentTrainingDataWorkspace-DObvpJAw.js → ExperimentTrainingDataWorkspace-Cx58S6R_.js} +2 -2
- package/dist/web/assets/{FilePagePreview-9kkXbARN.js → FilePagePreview-dlbmR8s8.js} +2 -2
- package/dist/web/assets/{GetStartedView-Dv2b_SlH.js → GetStartedView-BkTV_shK.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-sPaPMc61.js → GettingStartedDialog-DulDLYnr.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-BlwhGxS6.js → HostedModelLearningReview--fXJEOfI.js} +1 -1
- package/dist/web/assets/{HostedModelLearningSettings-B5ahk3je.js → HostedModelLearningSettings-BEb7B_PC.js} +1 -1
- package/dist/web/assets/{HtmlVisual-rGsClq0p.js → HtmlVisual-BS61T2qR.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-Da7AwZWV.js → LabModelVersionDetailPage-CmzUIDbR.js} +1 -1
- package/dist/web/assets/{LabModelWorkspace-DTeYViWH.js → LabModelWorkspace-DoAnQKWk.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BieHbNl6.js → LabSkillSidebar-DJTm7ZQs.js} +1 -1
- package/dist/web/assets/{LabsRoute-D3XqPB0-.js → LabsRoute-DNtBot4a.js} +4 -4
- package/dist/web/assets/{LearningBatchesPage-CCBuf2u4.js → LearningBatchesPage-C_oQjciE.js} +1 -1
- package/dist/web/assets/{MainChatThread-B6BQJfcq.js → MainChatThread-D9e-to8e.js} +2 -2
- package/dist/web/assets/{MainPane-D3fQou29.js → MainPane-mWeD0M-f.js} +6 -6
- package/dist/web/assets/{ModelProjectPageHeader-BZn9Lu_J.js → ModelProjectPageHeader-BecKU_2p.js} +1 -1
- package/dist/web/assets/{NativeSetupTerminal-Bglqab_g.js → NativeSetupTerminal-DO0DN4fH.js} +2 -2
- package/dist/web/assets/{NativeSkillSidebar-pUGRdnV_.js → NativeSkillSidebar-jnxgQASC.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BpHN38MA.js → NewProjectDialog-ByHR4vMf.js} +1 -1
- package/dist/web/assets/{OutputsPage-LunDCQ6w.js → OutputsPage-DZY4BUCy.js} +1 -1
- package/dist/web/assets/{PageChrome-DThEcWAx.js → PageChrome-DjPuwWsn.js} +1 -1
- package/dist/web/assets/{ProjectsPage-vct_TQgL.js → ProjectsPage-DKbwhIM4.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-CgFK7DY0.js → RightChatPanelStack-BARH0XuL.js} +1 -1
- package/dist/web/assets/RightSidebarHomePanel-qKL8dZrN.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-mmaZfybl.js → ScheduledWorkPage-CElrmRz9.js} +1 -1
- package/dist/web/assets/{SettingsView-CJfeRsWR.js → SettingsView-CsFSjE9s.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-CuimAfkv.js → TasksetDraftEditorPrimitives-DJoYkvWq.js} +1 -1
- package/dist/web/assets/{TeamChatView-BcK0lF1b.js → TeamChatView-D9Y4e98Y.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-0pzEvy-C.js → TerminalOverlay-CUO8yZjy.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CcyzFz7l.js → TrainingCreationPanel-_mnLQ1HA.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-DSLZXdLz.js → TrainingDraftPanel-CCqQTHo5.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-BT9pcnCn.js → UsageSettingsSection-CdWq5oYC.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-DRXaK-E6.js +1 -0
- package/dist/web/assets/{WorkspaceDiffPanel-Bbz5qrVA.js → WorkspaceDiffPanel-CdHr8bX6.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-6hXpvMTl.js → WorkspaceEnvironmentMenu-BnUh4dg9.js} +1 -1
- package/dist/web/assets/{WorkspaceFileLocation-BijVemBl.js → WorkspaceFileLocation-VzrSq_Ki.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-BOO0E5i9.js → WorkspaceGitDialogs-nwvQOm9r.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-B_YzK7Do.js → WorkspaceMonacoEditor-m3bCIpZe.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-CFti1fvu.js → WorkspacePdfPreview-u6Iv0qr0.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-DPAhNaV6.js → WorkspacePresentationPreview-CjvTjhUO.js} +1 -1
- package/dist/web/assets/{bot-BE2rL_qv.js → bot-DiDSZBLn.js} +1 -1
- package/dist/web/assets/{chat-resources-Beh5lB36.js → chat-resources-CmBtWC5V.js} +1 -1
- package/dist/web/assets/chevron-down-CqxKXYPf.js +1 -0
- package/dist/web/assets/chevron-right-ClP6ukIq.js +1 -0
- package/dist/web/assets/chevron-up-DY7wpdJ1.js +1 -0
- package/dist/web/assets/{chunk-C3TS766N-j1MK0e3c.js → chunk-C3TS766N-DSA4vs-Y.js} +1 -1
- package/dist/web/assets/{client-BnJhN-14.js → client-_uDCFdg5.js} +1 -1
- package/dist/web/assets/{client-choice-storage-CQ0CNkzG.js → client-choice-storage-CRKZpilL.js} +1 -1
- package/dist/web/assets/{cloud-upload-DFjZE4O4.js → cloud-upload-CWamjPts.js} +1 -1
- package/dist/web/assets/{copy-CGrLUtw5.js → copy-B56YjDkW.js} +1 -1
- package/dist/web/assets/{cssMode-DvRw2fUx.js → cssMode-BuC9qQvo.js} +1 -1
- package/dist/web/assets/{external-link-3ZnEFUXd.js → external-link-BSn21e-y.js} +1 -1
- package/dist/web/assets/{folder-open-i9n8450i.js → folder-open-CaJGWSr2.js} +1 -1
- package/dist/web/assets/{folder-plus-cu8Md_ej.js → folder-plus-eTUep-az.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CwckmC09.js → git-commit-horizontal-Buk_hy6T.js} +1 -1
- package/dist/web/assets/{htmlMode-8VF4Ovtw.js → htmlMode-D7kF2kDL.js} +1 -1
- package/dist/web/assets/{icons-4yRSxBZj.js → icons-B4B5eUyR.js} +1 -1
- package/dist/web/assets/{image-D-umhyyK.js → image--4h1aK2l.js} +1 -1
- package/dist/web/assets/{index-DiVhx1GM.js → index-CCaTs7xt.js} +2 -2
- package/dist/web/assets/{info-Dq2RsPDJ.js → info-DjMTH4sJ.js} +1 -1
- package/dist/web/assets/{jsonMode-CvCYQHkB.js → jsonMode-BVX_7KjE.js} +1 -1
- package/dist/web/assets/loader-circle-DNHvEoaP.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-CjufNNFF.js → lspLanguageFeatures-RBOb-3wX.js} +1 -1
- package/dist/web/assets/{maximize-2-CKY8dua6.js → maximize-2-Cjg-f1xT.js} +1 -1
- package/dist/web/assets/{message-square-CVDgKlKX.js → message-square-oIMQDMc3.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BYAgjZbj.js → monaco.contribution-CIbGU5-C.js} +2 -2
- package/dist/web/assets/{monaco.contribution-PjJ1258q.js → monaco.contribution-CIwt2mTE.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BYY3-y9l.js → monaco.contribution-Dd1cPdSS.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Bh0CKj9i.js → monaco.contribution-KRLNg324.js} +2 -2
- package/dist/web/assets/{monitor-UYe42gew.js → monitor-BWaitd6I.js} +1 -1
- package/dist/web/assets/{paperclip-DrlSVUoz.js → paperclip-FYK6OySO.js} +1 -1
- package/dist/web/assets/{pdf-BMhday2W.js → pdf-DbwlsqZP.js} +1 -1
- package/dist/web/assets/play-DieChKfF.js +1 -0
- package/dist/web/assets/plus-DkfcQyma.js +1 -0
- package/dist/web/assets/{presentation-DcZKqH7w.js → presentation-B6MaAPC7.js} +1 -1
- package/dist/web/assets/{python-CiA01i07.js → python-DRYJxjiM.js} +1 -1
- package/dist/web/assets/{refresh-cw-00D-GDnF.js → refresh-cw-DOVpqCfJ.js} +1 -1
- package/dist/web/assets/{save-CXe7bqR7.js → save-BuyyyR4Q.js} +1 -1
- package/dist/web/assets/{settings-lists-B5J40WM6.js → settings-lists-BeAdxSjx.js} +1 -1
- package/dist/web/assets/square-D0YnIVh6.js +1 -0
- package/dist/web/assets/{square-terminal-DxC7TTds.js → square-terminal-DTOIZy6_.js} +1 -1
- package/dist/web/assets/{submit-issue-command-Dq3TqJLV.js → submit-issue-command-V--K9lVQ.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-BH3Jckfo.js → toggleHighContrast-nNzCoE0h.js} +1 -1
- package/dist/web/assets/training-DZgfVcI-.js +1 -0
- package/dist/web/assets/{training-model-data-B6IZ3x-t.js → training-model-data-CWoTokkb.js} +1 -1
- package/dist/web/assets/{tsMode-DXkj4bqC.js → tsMode-BfVi5_FZ.js} +1 -1
- package/dist/web/assets/{upload-B3KRHVHl.js → upload-C2MnlWjj.js} +1 -1
- package/dist/web/assets/{useAccountSettings-BGRkTRrp.js → useAccountSettings-QwRbZIKu.js} +1 -1
- package/dist/web/assets/{useAgentInventory-D_1AlAZJ.js → useAgentInventory-B7xEgMCA.js} +1 -1
- package/dist/web/assets/{useChatContextSelection-hoMSuUSE.js → useChatContextSelection-O6wo4EqD.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DxTER7Ow.js → useLocalAgentSchedules-DpHnOGoV.js} +1 -1
- package/dist/web/assets/{useQuery-DkPec_9x.js → useQuery-CvZ8bzdW.js} +1 -1
- package/dist/web/assets/{wifi-off-CMzpvbWl.js → wifi-off-B8d12Alh.js} +1 -1
- package/dist/web/assets/{workers-ziY_bTv2.js → workers-sIVKxb8c.js} +1 -1
- package/dist/web/assets/x-BvVvVB-j.js +1 -0
- package/dist/web/assets/{yaml-mSvqVSko.js → yaml-8-aLM3zj.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/command-reference.md +1 -0
- package/package.json +1 -1
- package/dist/chunks/app-server-runtime-B7AMBGQZ.js +0 -2
- package/dist/chunks/chunk-6D3FI2XT.js +0 -2
- package/dist/chunks/chunk-VEBW7NKD.js +0 -2
- package/dist/chunks/cli-ALEEFAJ7.js +0 -2
- package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +0 -2
- package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +0 -2
- package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +0 -2
- package/dist/chunks/local-harness-taskset-review-E5GN5LTR.js +0 -2
- package/dist/chunks/project-action-payload-53OH6WDH.js +0 -2
- package/dist/chunks/saved-work-54I5ZJTC.js +0 -2
- package/dist/chunks/training-5NT2YB2L.js +0 -2
- package/dist/chunks/training-UY6KRG4M.js +0 -2
- package/dist/web/assets/App-CXhxya9x.js +0 -54
- package/dist/web/assets/RightSidebarHomePanel-BJmzUcmy.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-CP-nHAsJ.js +0 -1
- package/dist/web/assets/chevron-down-Bn8yph2O.js +0 -1
- package/dist/web/assets/chevron-right-BU-jUmb2.js +0 -1
- package/dist/web/assets/chevron-up-DacwuDJZ.js +0 -1
- package/dist/web/assets/loader-circle-DBl6qqtR.js +0 -1
- package/dist/web/assets/play-DIqZnaNf.js +0 -1
- package/dist/web/assets/plus-CFNxAPMK.js +0 -1
- package/dist/web/assets/square-DJEaBefe.js +0 -1
- package/dist/web/assets/training-DWfghwfZ.js +0 -1
- package/dist/web/assets/x-omjwMPbJ.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{F as ro,H as ia,J as Le,K as oo,L as so,M as co,N as Qa,U as Ka,X as mo,a as Or,c as Qr,d as Kr,e as k,f as Ga,g as Tt,h as Xr,ha as vo,i as Yr,k as Zr,l as eo,o as to,p as no,t as ao,v as io,z as Ja}from"./chunk-DLOJG7LP.js";import{e as bo,f as Io}from"./chunk-ULTV6INR.js";import{d as lo,e as uo,g as po,l as ho,t as go,x as Xa,z as fo}from"./chunk-XKDOPNQ5.js";import{a as Mt,f as Ya,i as So}from"./chunk-2GEZ3ZY7.js";import{f as Oa,m as ea}from"./chunk-HIQPGYVH.js";import{A as Gr,D as Wa,L as Jr,Q as ye,b as ta,e as cn,f as na,i as h,j as m,k as aa,l as u,m as jt,n as Br,o as Fr,p as dn,q as La,v as Wr,w as j,x as F,y as T}from"./chunk-3VT2PPKW.js";import{a as Lr}from"./chunk-5ZBDHIIE.js";import{b as Vr,l as sn,lc as Nr,oc as $r}from"./chunk-ZEOYNUHL.js";import{Ra as Dr,fb as Ur,v as A,va as zr}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";var wo=e.object({schemaVersion:e.literal("openpond.trainingApiError.v2"),code:e.string().trim().min(1).max(200),message:e.string().trim().min(1).max(5e3),retryable:e.boolean().default(!1),requestId:e.string().trim().min(1).max(500).nullable().default(null),details:e.record(e.string(),e.unknown()).default({})}).strict(),Za=class extends Error{static{d(this,"OpenPondTrainingApiError")}status;code;retryable;requestId;details;constructor(i,n){super(n.message),this.name="OpenPondTrainingApiError",this.status=i,this.code=n.code,this.retryable=n.retryable,this.requestId=n.requestId,this.details=n.details}};function xo(i){let n={};return new Headers(i).forEach((t,a)=>{n[a]=t}),n}d(xo,"headersRecord");function _o(i){let n=i.fetch??fetch,t=i.baseUrl.replace(/\/$/,"");async function a(r,s,o=na){let l=s?.method===void 0||s.method.toUpperCase()==="GET"?3:1;for(let p=1;p<=l;p+=1){let g;try{let S=typeof i.headers=="function"?await i.headers():i.headers??{};g=await n(`${t}${r}`,{...s,headers:{accept:ta,...s?.body?{"content-type":ta}:{},...xo(S),...xo(s?.headers)}})}catch(S){if(p===l||s?.signal?.aborted||!yo(null,S))throw S;await new Promise(b=>setTimeout(b,250*2**(p-1)));continue}let v=await Fr(g,o,"Training API response");if(g.ok)return v;let f=xd(v,g.status);if(p===l||!yo(g.status,f))throw f;await new Promise(S=>setTimeout(S,250*2**(p-1)))}throw new h("training_read_retry_exhausted","Training read retry loop exhausted without a response.")}return d(a,"request"),a}d(_o,"createTrainingRequest");function yo(i,n){return i!==null?i===408||i===429||i>=500:n instanceof Za?n.retryable:n instanceof h?n.code==="invalid_error_response":n instanceof TypeError}d(yo,"trainingReadFailureIsRetryable");function xd(i,n){let t=wo.safeParse(i);return t.success?new Za(n,t.data):new h("invalid_error_response",`Training request failed with HTTP ${n} and an invalid error envelope.`)}d(xd,"trainingApiError");var Ee=e.string().min(1).max(191),ei=e.string().datetime({offset:!0}),ai=e.string().min(1).max(512),ti=e.number().finite().min(0).max(Number.MAX_SAFE_INTEGER),Ho=e.object({status:e.enum(["unavailable","unsupported","permissionDenied","error"]),reason:ai}).strict(),ii=d(i=>e.union([e.object({status:e.literal("available"),value:i}).strict(),Ho]),"metric"),te=ii(ti),ni=ii(e.number().finite().min(0).max(100)),ra=ii(ai),oa=e.union([e.object({status:e.literal("available")}).strict(),Ho]),jo=e.object({index:e.number().int().min(0).max(4294967295),uuid:ra,name:ra,pciBusId:ra,memoryTotalBytes:te,memoryUsedBytes:te,utilizationPercent:ni,memoryUtilizationPercent:ni,temperatureCelsius:te,powerWatts:te,powerLimitWatts:te,graphicsClockMhz:te,memoryClockMhz:te,eccCorrectedErrors:te,eccUncorrectedErrors:te}).strict(),To=e.object({schemaVersion:e.literal(1),collectorVersion:ai,sessionId:e.string().uuid(),sequence:ti.int().min(1),observedAt:ei,monotonicMs:ti.int(),sampleIntervalMs:e.number().int().min(100).max(6e4),scope:e.enum(["container","host","guest","unknown"]),cpu:e.object({logicalCores:te,utilizationPercent:ni,cgroupCpuLimitCores:te,cgroupUsageUsec:te}).strict(),memory:e.object({hostTotalBytes:te,hostAvailableBytes:te,cgroupLimitBytes:te,cgroupCurrentBytes:te}).strict(),driverVersion:ra,gpus:e.array(jo).max(32),capabilities:e.object({cpu:oa,memory:oa,nvml:oa}).strict()}).strict().superRefine((i,n)=>{let t=new Set,a=new Set;i.gpus.forEach((r,s)=>{(t.has(r.index)||r.uuid.status==="available"&&a.has(r.uuid.value))&&n.addIssue({code:"custom",path:["gpus",s],message:"GPU identity must be unique within an observation."}),t.add(r.index),r.uuid.status==="available"&&a.add(r.uuid.value)})}),Mo=e.object({schemaVersion:e.literal(1),teamId:Ee,observedAt:ei,nextCursor:Ee.nullable(),workers:e.array(e.object({workerId:Ee,provider:Ee,state:Ee,jobIds:e.array(Ee).max(128),receivedAt:ei.nullable(),observation:To.nullable(),freshness:e.enum(["missing","fresh","stale"])}).strict()).max(50)}).strict().superRefine((i,n)=>{let t=new Set;i.workers.forEach((a,r)=>{t.has(a.workerId)&&n.addIssue({code:"custom",path:["workers",r,"workerId"],message:"Duplicate worker identity."}),t.add(a.workerId),(a.observation===null!=(a.receivedAt===null)||a.observation===null!=(a.freshness==="missing"))&&n.addIssue({code:"custom",path:["workers",r],message:"Observation, receive time and freshness must describe the same evidence."})})});function Ro(i){return{async hardwareObservations(n){let t=Ee.parse(n.teamId),a=new URLSearchParams;n.workerId!==void 0&&a.set("workerId",Ee.parse(n.workerId)),n.jobId!==void 0&&a.set("jobId",Ee.parse(n.jobId)),n.cursor!==void 0&&a.set("cursor",Ee.parse(n.cursor));let r=e.number().int().min(1).max(50).parse(n.limit??25);a.set("limit",String(r));let s=a.size?`?${a}`:"",o=Mo.parse(await i(`/v1/managed-rl/hardware-observations${s}`,{headers:{"x-openpond-team-id":t}}));if(o.teamId!==t||o.workers.length>r||o.workers.some(c=>n.workerId!==void 0&&c.workerId!==n.workerId||n.jobId!==void 0&&!c.jobIds.includes(n.jobId)||n.cursor!==void 0&&c.workerId<=n.cursor)||o.nextCursor!==null&&o.nextCursor!==o.workers.at(-1)?.workerId)throw new h("hardware_observation_scope_mismatch","Hardware observations do not match the requested workspace, worker or job.");return o}}}d(Ro,"createTrainingHardwareClient");function Go(i){if(!/^(0|[1-9]\d*)(\.\d{1,6})?$/.test(i)||i.length>24)throw new Error("invalid_compute_amount");let[n,t=""]=i.split("."),a=BigInt(n)*1000000n+BigInt(t.padEnd(6,"0"));if(a>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("invalid_compute_amount");return Number(a)}d(Go,"computeUsdMicros");function yd(i){let n=BigInt(Go(i));return`${n/1000000n}.${(n%1000000n).toString().padStart(6,"0")}`}d(yd,"normalizedComputeUsd");var xn=e.string().trim().min(1).max(500),st=e.string().regex(/^[a-f0-9]{64}$/),wd=e.string().regex(/^sha256:[a-f0-9]{64}$/),Et=e.iso.datetime().refine(i=>new Date(i).toISOString()===i),Ii=e.string().regex(/^(0|[1-9]\d*)\.\d{6}$/).max(24).refine(i=>{try{return yd(i)===i}catch{return!1}}),_d=e.enum(["training","steering","engram","decision","alphaedit","selective_neuron_training"]),Jo=Qr.extend({service:e.literal("model_serving")}),Qo=e.object({schemaVersion:e.literal("openpond.managedServingUsageReview.v1"),teamId:xn,modelProjectId:xn,versionHash:st,method:_d,price:Jo,runtimeHash:st,workerImageDigest:wd,providerConfigurationHash:st,idleTimeoutSeconds:e.literal(300),rules:e.object({billableStart:e.literal("provider_allocation"),startupBillable:e.literal(!0),idleBillable:e.literal(!0),explicitStop:e.literal("logical_admission_closed"),postTrainingReuseBillable:e.literal(!1),minimumBillableMillis:e.literal(0),tokenRetailUsd:e.literal("0.000000")}).strict(),nativeControl:e.object({protocol:e.literal("openpond.workerComputeControl.v1"),executionLeaseMillis:e.literal(3e4),stopHeadroomMillis:e.literal(6e4),qualificationHash:st}).strict(),workDeadlineAt:Et,expiresAt:Et,contentHash:st}).strict(),gt=e.object({schemaVersion:e.literal("openpond.managedServingUsageApproval.v1"),reviewHash:st,customerCapUsd:Ii.refine(i=>Go(i)>0).nullable()}).strict(),ft=e.object({schemaVersion:e.literal("openpond.managedServingUsage.v1"),deploymentKey:xn,reviewHash:st,price:Jo,customerCapUsd:Ii.nullable(),fundingState:e.enum(["pending","active","exhausted","closed"]),stopReason:e.enum(["explicit_stop","idle_timeout","credit_exhausted","cap_reached","control_expired","policy_changed","member_cap_reached","native_unavailable","work_deadline"]).nullable(),startedAt:Et.nullable(),lastActivityAt:Et.nullable(),idleExpiresAt:Et.nullable(),billableStoppedAt:Et.nullable(),quantityMillis:e.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),chargedUsd:Ii,reservationId:xn.nullable()}).strict(),vt=e.object({schemaVersion:e.literal("openpond.managedServingUsageReviewResult.v1"),availability:e.enum(["reviewable","unavailable"]),reason:xn.nullable(),review:Qo.nullable(),usage:ft.nullable()}).strict().superRefine((i,n)=>{(i.availability==="reviewable"!=(i.review!==null)||i.availability==="reviewable"!=(i.reason===null))&&n.addIssue({code:"custom",message:"Serving price review availability is inconsistent"})});async function Ft(i,n,t){if(!i)return;let{review:a,usage:r}=vt.parse(i);if(await u(r)!==await u(t?.usage??null))throw new h("managed_serving_usage_mismatch","Serving usage differs from the retained deployment owner.");if(!a)return;let{contentHash:s,...o}=a;if(s!==await u(o)||a.teamId!==n.teamId||a.modelProjectId!==n.modelProjectId||a.versionHash!==n.versionHash||a.method!==n.method||Date.parse(a.expiresAt)>Date.parse(a.workDeadlineAt)||r&&(r.reviewHash!==s||await u(r.price)!==await u(a.price)))throw new h("managed_serving_usage_mismatch","Serving pricing differs from the exact saved Model, runtime or accepted terms.")}d(Ft,"verifyManagedServingUsageBilling");function Ot(i,n){if(i.action==="stop")return!0;let t=i.usageApproval,a=n.usage;return t?!!(a&&a.reviewHash===t.reviewHash&&a.customerCapUsd===t.customerCapUsd):a===void 0}d(Ot,"managedServingUsageApprovalMatches");async function ob(i,n){let t=Qo.parse(i),{contentHash:a,...r}=t;if(a!==await u(r)||Date.parse(t.expiresAt)<=Date.now()||Date.parse(t.workDeadlineAt)<=Date.now())throw new h("managed_serving_review_expired","Refresh the exact Model's serving price before activation.");return gt.parse({schemaVersion:"openpond.managedServingUsageApproval.v1",reviewHash:a,customerCapUsd:k(n)})}d(ob,"createManagedServingUsageApproval");var yn=e.string().trim().min(1).max(500),Qe=e.string().regex(/^[a-f0-9]{64}$/),Ni=e.object({id:yn,revision:e.number().int().positive(),contentHash:Qe}).strict(),B=e.object({schemaVersion:e.literal("openpond.neuronSteeringModel.v1"),modelId:yn,revision:yn,configHash:Qe,weightsHash:Qe,tokenizerHash:Qe,weightIdentity:e.literal("torch_state_dict_sha256_v1"),architecture:e.literal("dense_decoder"),dtype:e.enum(["float32","float16","bfloat16"]),quantization:e.literal("none"),adapter:e.null(),hiddenSize:e.number().int().positive().max(1e6),intermediateSizes:e.array(e.number().int().positive().max(1e7)).min(1).max(512)}).strict(),Hd=e.object({layer:e.number().int().nonnegative().max(511),neuron:e.number().int().nonnegative().max(9999999),dose:e.number().finite()}).strict(),Ko=e.object({phase:e.enum(["prompt_and_decode","prompt_only","decode_only"]),positions:e.enum(["all_non_padding","after_position_zero"])}).strict(),Xo=e.discriminatedUnion("mode",[e.object({mode:e.literal("baseline_prompt_residual_median"),statistic:e.literal("midpoint_median_fp32"),sample:e.literal("non_padding_prompt_after_position_zero")}).strict(),e.object({mode:e.literal("fixed_residual_reference"),calibration:Ni}).strict()]),Yo=e.object({schemaVersion:e.literal("openpond.neuronSteeringProfile.v1"),model:B,hook:e.literal("mlp.down_proj.input"),operation:e.literal("add"),normalization:Xo,tokenScope:Ko,entries:e.array(Hd).min(1).max(64)}).strict().superRefine((i,n)=>{let t=new Set;i.entries.forEach((a,r)=>{let s=`${a.layer}:${a.neuron}`;(t.has(s)||a.layer>=i.model.intermediateSizes.length||a.neuron>=(i.model.intermediateSizes[a.layer]??0))&&n.addIssue({code:"custom",path:["entries",r],message:"Each coordinate must be unique and within this exact dense model."}),t.add(s)})}),$i=Yo.safeExtend({contentHash:Qe});async function jd(i){let n=Yo.parse(i);return{...n,contentHash:await u(n)}}d(jd,"createNeuronSteeringProfile");async function Zo(i,n){let t=$i.parse(i),{contentHash:a,...r}=t;if(a!==await u(r)||n&&await u(t.model)!==await u(B.parse(n)))throw new h("neuron_steering_profile_mismatch","The intervention differs from its exact model or retained payload.");return t}d(Zo,"parseAndVerifyNeuronSteeringProfile");var Td=e.object({schemaVersion:e.literal("openpond.neuronResidualCalibration.v1"),id:yn,revision:e.number().int().positive(),modelHash:Qe,source:e.object({id:yn,contentHash:Qe}).strict(),statistic:e.literal("midpoint_median_fp32"),sample:e.literal("non_padding_prompt_after_position_zero"),layers:e.array(e.object({layer:e.number().int().nonnegative().max(511),median:e.number().finite().positive(),sampleCount:e.number().int().positive()}).strict()).min(1).max(512)}).strict().superRefine((i,n)=>{new Set(i.layers.map(t=>t.layer)).size!==i.layers.length&&n.addIssue({code:"custom",path:["layers"],message:"Calibration layers must be unique."})}),es=Td.safeExtend({contentHash:Qe});async function Si(i,n,t){let a=es.parse(i),{contentHash:r,...s}=a;if(r!==await u(s)||a.modelHash!==await u(B.parse(n))||t&&(t.id!==a.id||t.revision!==a.revision||t.contentHash!==a.contentHash)||a.layers.some(o=>o.layer>=n.intermediateSizes.length))throw new h("neuron_calibration_mismatch","The residual calibration differs from its exact model or immutable reference.");return a}d(Si,"parseAndVerifyNeuronResidualCalibration");var z=e.string().regex(/^[a-f0-9]{64}$/),Bi=e.string().trim().min(1).max(500),Fi=2147483648,jn=e.object({schemaVersion:e.literal("openpond.engramAdapterConfig.v1"),implementation:e.literal("openpond_qwen_engram_paper_v1"),hook:e.literal("self_attn.input"),injectLayers:e.tuple([e.literal(1),e.literal(3),e.literal(7),e.literal(15)]),suffixOrders:e.tuple([e.literal(2),e.literal(3)]),previousOrders:e.tuple([e.literal(3)]),numHashes:e.literal(4),tableSize:e.literal(90007),perHashDim:e.union([e.literal(128),e.literal(256)]),alpha:e.literal(.2),memoryInitStd:e.literal(.02),adapterDtype:e.literal("float32"),projectionInit:e.literal("zeros"),gateInit:e.literal("zeros_no_bias"),boundary:e.literal("incomplete_group_off_v1"),occupancy:e.literal("training_before_lookup_v1"),history:e.literal("request_absolute_positions_v1"),batchSize:e.literal(1)}).strict(),Oi=e.object({learningRate:e.number().finite().positive().max(.001),weightDecay:e.number().finite().min(0).max(.1),maxSteps:e.number().int().min(1).max(128),gradientAccumulationSteps:e.number().int().min(1).max(32),maxSequenceLength:e.number().int().min(2).max(8192),seed:e.number().int().min(0).max(2147483647),maxDurationSeconds:e.number().finite().min(1).max(21600),maxCheckpointBytes:e.number().int().positive().max(Fi)}).strict(),ts=e.object({batch:F,examplesSha256:z,encodingHash:z}).strict(),ns=e.object({id:Bi,contentHash:z}).strict(),Sa=e.object({schemaVersion:e.literal("openpond.engramTrainingRequest.v1"),model:B,data:ts,config:jn,training:Oi,parentArtifact:ns.nullable()}).strict().superRefine((i,n)=>{(i.model.intermediateSizes.length<=15||i.model.dtype!=="bfloat16")&&n.addIssue({code:"custom",path:["model"],message:"This Engram implementation requires the exact compatible BF16 dense base."})}),Md=e.object({schemaVersion:e.literal("openpond.engramSupervisedEncoding.v1"),implementation:e.literal("supervised_trainer.prepare_example.v1"),modelHash:z,tokenizerHash:z,maxSequenceLength:e.number().int().min(2).max(8192),completionOnly:e.literal(!0),enableThinking:e.literal(!1),truncation:e.literal("left_prompt_preserve_final_target_v1")}).strict();async function Rd(i,n){return Md.parse({schemaVersion:"openpond.engramSupervisedEncoding.v1",implementation:"supervised_trainer.prepare_example.v1",modelHash:await u(B.parse(i)),tokenizerHash:i.tokenizerHash,maxSequenceLength:n,completionOnly:!0,enableThinking:!1,truncation:"left_prompt_preserve_final_target_v1"})}d(Rd,"engramSupervisedEncoding");async function Lt(i){let n=Sa.parse(i);if(n.data.encodingHash!==await u(await Rd(n.model,n.training.maxSequenceLength)))throw new h("engram_encoding_mismatch","The Engram request differs from its exact supervised encoder.");return n}d(Lt,"parseAndVerifyEngramTrainingRequest");var Ed=e.object({baseModel:B,adapterConfigHash:z,recipeHash:z,dataHash:z,data:ts,runtimeHash:z,parentArtifactHash:z.nullable()}).strict(),Pd=e.object({name:e.string().regex(/^[A-Za-z0-9_.-]{1,200}$/),shape:e.array(e.number().int().positive().max(1e7)).min(1).max(2),dtype:e.enum(["F32","BOOL"])}).strict(),kd=e.object({schemaVersion:e.literal("openpond.engramAdapterArtifact.v1"),method:e.literal("engram_adapter"),config:jn,pins:Ed,payload:e.object({path:e.literal("adapter.safetensors"),sha256:z,sizeBytes:e.number().int().positive().max(Fi),tensors:e.array(Pd).min(1).max(100)}).strict()}).strict(),as=kd.extend({contentHash:z});function Ad(i,n){let t=jn.parse(i),a=e.number().int().positive().max(1e6).parse(n),r=[];for(let o of["suffix2","suffix3","previous3"])for(let c=0;c<t.numHashes;c++)r.push({name:`shared.embeddings.${o}.${c}.weight`,dtype:"F32",shape:[t.tableSize,t.perHashDim]}),r.push({name:`shared.occupancy.${o}.h${c}`,dtype:"BOOL",shape:[t.tableSize]});let s=3*t.numHashes*t.perHashDim;for(let o of t.injectLayers)r.push({name:`layers.${o}.projection.weight`,dtype:"F32",shape:[a,s]}),r.push({name:`layers.${o}.gate_memory`,dtype:"F32",shape:[s]}),r.push({name:`layers.${o}.gate_hidden`,dtype:"F32",shape:[a]});return r.sort((o,c)=>o.name<c.name?-1:o.name>c.name?1:0)}d(Ad,"engramAdapterTensorInventory");async function is(i,n){let t=as.parse(i),{contentHash:a,...r}=t,s=d(()=>{throw new h("engram_artifact_mismatch","The Engram module differs from its exact configuration, data or parent.")},"fail8");if((a!==await u(r)||t.pins.adapterConfigHash!==await u(t.config)||t.pins.dataHash!==await u(t.pins.data)||new Set(t.payload.tensors.map(o=>o.name)).size!==t.payload.tensors.length||m([...t.payload.tensors].sort((o,c)=>o.name<c.name?-1:o.name>c.name?1:0))!==m(Ad(t.config,t.pins.baseModel.hiddenSize)))&&s(),n){let o=await Lt(n.request);(m(t.config)!==m(o.config)||m(t.pins.baseModel)!==m(o.model)||m(t.pins.data)!==m(o.data)||t.pins.recipeHash!==await u(o.training)||t.pins.runtimeHash!==n.runtimeHash||t.pins.parentArtifactHash!==(o.parentArtifact?.contentHash??null)||t.payload.sizeBytes>o.training.maxCheckpointBytes)&&s()}return t}d(is,"parseAndVerifyEngramAdapterArtifact");var Cd=e.object({path:e.enum(["manifest.json","adapter.safetensors"]),artifactId:Bi,sha256:z,sizeBytes:e.number().int().positive().max(Fi)}).strict(),qd=e.object({schemaVersion:e.literal("openpond.engramTrainingResult.v1"),inputHash:z,modelHash:z,runtimeHash:z,dataHash:z,preparedRowsHash:z,optimizerSteps:e.number().int().min(1).max(128),examplesProcessed:e.number().int().positive().max(4096),targetTokens:e.number().int().positive().max(33554432),forwardTokenWork:e.number().int().positive().max(1e8),durationMs:e.number().finite().nonnegative().max(216e5),meanLoss:e.number().finite().nonnegative(),finalLoss:e.number().finite().nonnegative(),baseWeightsHashBefore:z,baseWeightsHashAfter:z,baseOptimizerParameterCount:e.literal(0),baseGradientParameterCount:e.literal(0),artifact:e.object({id:Bi,contentHash:z,manifest:as,files:e.array(Cd).length(2)}).strict()}).strict(),Li=qd.extend({contentHash:z});async function zd(i,n){let t=await Lt(n.request),a=Li.parse(i),{contentHash:r,...s}=a,o=await is(a.artifact.manifest,n),c=a.artifact.files.find(p=>p.path==="adapter.safetensors"),l=a.artifact.files.find(p=>p.path==="manifest.json");if(r!==await u(s)||a.inputHash!==await u(t)||a.modelHash!==await u(t.model)||a.dataHash!==await u(t.data)||a.runtimeHash!==n.runtimeHash||a.optimizerSteps!==t.training.maxSteps||a.examplesProcessed!==a.optimizerSteps*t.training.gradientAccumulationSteps||a.targetTokens>a.forwardTokenWork||a.durationMs>t.training.maxDurationSeconds*1e3||a.baseWeightsHashBefore!==t.model.weightsHash||a.baseWeightsHashAfter!==a.baseWeightsHashBefore||a.artifact.contentHash!==o.contentHash||!c||!l||l.sizeBytes>262144||l.sha256!==await u(o)||l.sizeBytes!==new TextEncoder().encode(m(o)).byteLength||c.sha256!==o.payload.sha256||c.sizeBytes!==o.payload.sizeBytes||a.artifact.files.some(p=>p.artifactId!==a.artifact.id)||a.artifact.files.reduce((p,g)=>p+g.sizeBytes,0)>t.training.maxCheckpointBytes)throw new h("engram_training_result_mismatch","The Engram training result differs from its exact run, frozen base or committed module.");return a}d(zd,"parseAndVerifyEngramTrainingResult");var me=e.string().trim().min(1).max(240),_e=e.string().regex(/^[a-f0-9]{64}$/),Dd=e.object({schemaVersion:e.literal("openpond.engramModelVersion.v1"),teamId:me,ownerUserId:me,modelProjectId:me,portableProjectId:me,baseModel:T,source:e.object({executionId:me,inputHash:_e,runtimeHash:_e,resultHash:_e}).strict(),artifact:Li.shape.artifact,createdAt:e.iso.datetime()}).strict(),Tn=Dd.extend({contentHash:_e}),rs=e.object({modelProjectId:me,versionHash:_e,artifact:e.object({id:me,contentHash:_e}).strict(),modelHash:_e}).strict();async function bt(i,n={}){let t=Tn.parse(i),{contentHash:a,...r}=t,s=await is(t.artifact.manifest),o=t.artifact.files,c=o.find(p=>p.path==="manifest.json"),l=o.find(p=>p.path==="adapter.safetensors");if(a!==await u(r)||n.teamId&&t.teamId!==n.teamId||n.modelProjectId&&t.modelProjectId!==n.modelProjectId||n.ownerUserId&&t.ownerUserId!==n.ownerUserId||t.baseModel.modelId!==s.pins.baseModel.modelId||t.baseModel.revision!==s.pins.baseModel.revision||t.source.runtimeHash!==s.pins.runtimeHash||t.artifact.contentHash!==s.contentHash||!c||!l||c.sha256!==await u(s)||c.sizeBytes!==new TextEncoder().encode(m(s)).byteLength||l.sha256!==s.payload.sha256||l.sizeBytes!==s.payload.sizeBytes||o.some(p=>p.artifactId!==t.artifact.id))throw new h("engram_model_version_mismatch","The saved Model differs from its exact trained memory module.");return t}d(bt,"parseAndVerifyEngramModelVersion");var os=e.object({teamId:me,operationId:me,executionId:me,resultHash:_e,artifactHash:_e,name:e.string().trim().min(1).max(200),modelProjectId:me.nullable(),expectedModelRevision:e.number().int().nonnegative()}).strict().refine(i=>i.modelProjectId?i.expectedModelRevision>0:i.expectedModelRevision===0,{message:"Retain the exact existing Model revision, or create a new Model."}),Ud=e.object({schemaVersion:e.literal("openpond.engramResultSaveReceipt.v1"),teamId:me,actorId:me,operationId:me,requestHash:_e,model:ye,version:Tn}).strict(),Vd=Ud.extend({contentHash:_e});async function Nd(i,n){let t=os.parse(n),a=Vd.parse(i),{contentHash:r,...s}=a;if(await bt(a.version,{teamId:t.teamId,modelProjectId:a.model.id,ownerUserId:a.actorId}),r!==await u(s)||a.teamId!==t.teamId||a.model.teamId!==t.teamId||a.operationId!==t.operationId||a.requestHash!==await u(t)||a.version.source.executionId!==t.executionId||a.version.source.resultHash!==t.resultHash||a.version.artifact.contentHash!==t.artifactHash||a.model.name!==t.name||a.model.revision!==t.expectedModelRevision+1||t.modelProjectId&&a.model.id!==t.modelProjectId||a.version.portableProjectId!==a.model.portableProjectId)throw new h("engram_model_save_mismatch","The saved Model differs from the original execution, module or Model revision.");return a}d(Nd,"parseAndVerifyEngramResultSaveReceipt");function $d(i){return{async saveEngramResultModel(n){let t=os.parse(n);return Nd(await i(`/v1/training/modification-executions/${encodeURIComponent(t.executionId)}/model`,{method:"POST",body:m(t)}),t)}}}d($d,"createEngramModelClient");var ub=300,Eo=e.string().trim().min(1).max(500),Wt=e.object({id:Eo,provider:Eo,state:e.enum(["requested","provisioning","ready","degraded","deleting","deleted","failed"]),workersMin:e.number().int().nonnegative(),workersMax:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().nonnegative(),workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/).nullable(),endpointRecorded:e.boolean(),activeDeployments:e.number().int().nonnegative(),activeBindings:e.number().int().nonnegative(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),retirementBlocked:e.boolean()}).strict(),Pt=e.string().trim().min(1).max(240),Ke=e.string().regex(/^[a-f0-9]{64}$/),Bd=e.object({id:Pt,contentHash:Ke,payloadSha256:Ke}).strict(),ss=e.object({modelProjectId:Pt,versionHash:Ke}).strict(),Fd=e.object({savedModel:ss.optional(),engram:e.boolean().optional()}).strict(),cs=e.object({schemaVersion:e.literal("openpond.resolvedEngramSelection.v1"),requested:e.enum(["inherit","on","off"]),savedModel:ss,defaultEnabled:e.boolean(),effectiveEnabled:e.boolean(),module:Bd,modelHash:Ke}).strict();function ds(i,n){let t=cs.parse(i),a=Fd.parse(n);if(t.requested!==(a.engram===void 0?"inherit":a.engram?"on":"off")||t.effectiveEnabled!==(a.engram??t.defaultEnabled)||a.savedModel&&m(a.savedModel)!==m(t.savedModel))throw new h("engram_selection_mismatch","The admitted memory module differs from this exact Model or request.");return t}d(ds,"parseAndVerifyResolvedEngramSelection");var Od=e.object({schemaVersion:e.literal("openpond.engramInferenceReceipt.v1"),teamId:Pt,requestId:Pt,requestHash:Ke,selection:cs,poolId:Pt,routingBinding:e.object({id:Pt,revision:e.number().int().positive()}).strict(),runtimeHash:Ke,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),engineGeneration:e.number().int().positive(),cacheNamespace:Ke,completedAt:e.iso.datetime()}).strict(),ms=Od.extend({contentHash:Ke});async function hb(i,n){let t=ms.parse(i),{contentHash:a,...r}=t;if(ds(t.selection,n.options),a!==await u(r)||t.teamId!==n.teamId||t.requestId!==n.requestId||t.requestHash!==n.requestHash||m(t.selection)!==m(n.selection)||t.poolId!==n.poolId||m(t.routingBinding)!==m(n.routingBinding)||t.runtimeHash!==n.runtimeHash||t.workerImageDigest!==n.workerImageDigest||t.engineGeneration!==n.engineGeneration||t.cacheNamespace!==n.cacheNamespace)throw new h("engram_inference_receipt_mismatch","The completed inference differs from its admitted memory module, runtime or cache.");return t}d(hb,"parseAndVerifyEngramInferenceReceipt");var U=e.string().trim().min(1).max(240),Gt=e.string().regex(/^[a-f0-9]{64}$/),Ld=e.object({id:U,revision:e.number().int().positive()}).strict(),ls=e.iso.datetime(),Mn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.engramModelServingControlRequest.v1"),teamId:U,operationId:U,versionHash:Gt,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),defaultEnabled:e.boolean(),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),gb=Mn.omit({operationId:!0}).extend({modelProjectId:U}).strict(),fb=e.object({modelProjectId:U,request:Mn}).strict(),xi=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.engramModelServingControl.v1"),teamId:U,modelProjectId:U,versionHash:Gt,actorId:U,operationId:U,revision:e.number().int().positive(),defaultEnabled:e.boolean(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:U,poolId:U.nullable(),binding:Ld.nullable(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:U.nullable(),updatedAt:ls}).strict(),Wd=e.object({id:U,revision:e.number().int().positive(),modelId:U,poolId:U,versionHash:Gt}).strict(),Gd=e.object({state:e.enum(["qualified","unavailable"]),reason:e.enum(["qualified","runtime_unavailable","module_unavailable","model_mismatch"]),runtimeHash:Gt.nullable()}).strict(),Jd=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.engramModelServing.v1"),teamId:U,modelProjectId:U,observedAt:ls,version:Tn,defaultEnabled:e.boolean(),availability:Gd,control:xi.nullable(),cleanup:e.array(xi).max(100),pools:e.array(Wt).max(100),bindings:e.array(Wd).max(100),lastVerifiedInference:ms.nullable(),state:e.enum(["unavailable","inactive","starting","active","retiring"])}).strict(),us=Jd.extend({contentHash:Gt}).strict(),Qd=e.object({schemaVersion:e.literal("openpond.engramModelServingControlReceipt.v1"),teamId:U,modelProjectId:U,actorId:U,request:Mn,version:Tn,control:xi}).strict(),Kd=Qd.extend({contentHash:Gt}).strict();function ps(i){return i.modelId===`personalized:model:${i.modelProjectId}`&&(!i.binding||i.poolId!==null)&&(i.phase!=="active"||i.desiredState==="active"&&i.poolId!==null&&i.binding!==null&&["pending","shared"].includes(i.capacityState))&&(i.phase!=="stopping"||i.desiredState==="stopped")&&(i.capacityState!=="released"||!i.binding&&i.activeRequests===0&&i.unsettledRequests===0)&&(i.phase!=="stopped"||i.desiredState==="stopped"&&!i.binding&&i.activeRequests===0&&i.unsettledRequests===0&&["shared","released"].includes(i.capacityState))}d(ps,"validControl");function Xd(i){let n=i.control;if(n?.phase==="stopping"||i.cleanup.some(a=>a.phase!=="stopped"||!["shared","released"].includes(a.capacityState)))return"retiring";if(i.availability.state!=="qualified"||n?.phase==="failed")return"unavailable";if(!n||n.desiredState==="stopped")return i.bindings.length?"unavailable":"inactive";let t=n.binding;return n.phase==="active"&&t&&i.bindings.some(a=>a.id===t.id&&a.revision===t.revision&&a.poolId===n.poolId&&i.pools.some(r=>r.id===a.poolId&&r.state==="ready"&&r.endpointRecorded))?"active":n.phase==="starting"?"starting":"unavailable"}d(Xd,"engramModelServingState");async function Yd(i,n){let t=Kd.parse(i),a=Mn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(await bt(t.version,{teamId:a.teamId,modelProjectId:n.modelProjectId}),!Ot(a,o)||r!==await u(s)||m(t.request)!==m(a)||t.teamId!==a.teamId||t.modelProjectId!==n.modelProjectId||n.actorId&&t.actorId!==n.actorId||t.version.contentHash!==a.versionHash||o.teamId!==t.teamId||o.modelProjectId!==t.modelProjectId||o.actorId!==t.actorId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||o.defaultEnabled!==a.defaultEnabled||o.desiredState!==(a.action==="activate"?"active":"stopped")||!ps(o)||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("engram_serving_control_mismatch","The serving receipt differs from the exact memory Model or original command.");return t}d(Yd,"parseAndVerifyEngramModelServingControl");async function Zd(i,n){let t=us.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"engram"},t.control),await bt(t.version,n);function s(){throw new h("engram_model_serving_mismatch","The serving evidence differs from the exact memory Model or retained capacity.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.version.contentHash!==n.versionHash||t.state!==Xd(t)||t.availability.state==="qualified"!=(t.availability.reason==="qualified")||t.availability.state==="qualified"&&t.availability.runtimeHash===null)&&s();for(let l of[t.pools,t.bindings])new Set(l.map(p=>p.id)).size!==l.length&&s();for(let l of[...t.cleanup,...t.control?[t.control]:[]])(l.teamId!==n.teamId||l.modelProjectId!==n.modelProjectId||!ps(l))&&s();(new Set(t.cleanup.map(l=>l.operationId)).size!==t.cleanup.length||t.cleanup.some(l=>l.desiredState!=="stopped"))&&s();let o=t.control;o&&(o.versionHash!==n.versionHash&&!(o.phase==="stopped"&&o.desiredState==="stopped")||o.versionHash===n.versionHash&&o.defaultEnabled!==t.defaultEnabled)&&s(),t.bindings.some(l=>l.versionHash!==n.versionHash||l.modelId!==`personalized:model:${n.modelProjectId}`||!t.pools.some(p=>p.id===l.poolId))&&s(),o?.binding&&!t.bindings.some(l=>l.id===o.binding.id&&l.revision===o.binding.revision&&l.poolId===o.poolId&&l.modelId===o.modelId)&&s(),t.pools.some(l=>l.workersMin>l.workersMax)&&s();let c=t.lastVerifiedInference;if(c){let{contentHash:l,...p}=c;ds(c.selection,{savedModel:c.selection.savedModel,...c.selection.requested==="inherit"?{}:{engram:c.selection.requested==="on"}}),(l!==await u(p)||c.teamId!==n.teamId||c.selection.savedModel.modelProjectId!==n.modelProjectId||c.selection.savedModel.versionHash!==n.versionHash||c.selection.module.id!==t.version.artifact.id||c.selection.module.contentHash!==t.version.artifact.contentHash||c.selection.module.payloadSha256!==t.version.artifact.manifest.payload.sha256||c.selection.modelHash!==await u(t.version.artifact.manifest.pins.baseModel)||t.pools.some(g=>g.id===c.poolId&&g.workerImageDigest!==c.workerImageDigest))&&s()}return t}d(Zd,"parseAndVerifyEngramModelServing");function em(i){return{async controlEngramModelServing(n,t){let a=U.parse(n),r=Mn.parse(t);return Yd(await i(`/v1/training/models/${encodeURIComponent(a)}/serving`,{method:"POST",body:m(r)}),{modelProjectId:a,request:r})}}}d(em,"createEngramModelServingClient");var hs=e.string().trim().min(1).max(240),gs=e.string().regex(/^[a-f0-9]{64}$/),lt=e.object({id:hs,revision:e.number().int().positive(),contentHash:gs}).strict(),Wi=e.object({modelProjectId:hs,versionHash:gs}).strict(),Rn=Wi.extend({publication:lt,profileHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),fs=Rn.extend({variantId:e.string().trim().min(1).max(500)}).strict();function vs(i){let{variantId:n,...t}=fs.parse(i);return t}d(vs,"activationStartingProfileSource");var tt=e.string().trim().min(1).max(500),gn=e.string().regex(/^[a-f0-9]{64}$/),Gi=e.object({id:tt,tokenIds:e.array(e.number().int().nonnegative().max(2147483647)).min(1).max(4096),attentionMask:e.array(e.union([e.literal(0),e.literal(1)])).min(1).max(4096)}).strict().superRefine((i,n)=>{(i.tokenIds.length!==i.attentionMask.length||!i.attentionMask.some(Boolean)||i.attentionMask.at(-1)!==1)&&n.addIssue({code:"custom",message:"Use matching tokens and a nonempty left-padded prompt."});let t=!1;for(let a of i.attentionMask)a?t=!0:t&&n.addIssue({code:"custom",path:["attentionMask"],message:"The reference admits only contiguous left padding."})}),at=e.object({schemaVersion:e.literal("openpond.activationReferenceRequest.v1"),model:B,startingProfile:fs.optional(),prompts:e.array(Gi).min(1).max(8),variants:e.array(e.object({id:tt,profile:e.lazy(()=>$i).nullable()}).strict()).min(1).max(17),capture:e.array(e.object({layer:e.number().int().nonnegative().max(511),neurons:e.array(e.number().int().nonnegative().max(9999999)).min(1).max(64)}).strict()).min(1).max(64),maxNewTokens:e.number().int().nonnegative().max(128),eosTokenIds:e.array(e.number().int().nonnegative().max(2147483647)).max(16),maximumCapturedValues:e.number().int().positive().max(65536),maximumForwardTokenWork:e.number().int().positive().max(1e6),maximumDurationSeconds:e.number().finite().positive().max(300)}).strict().superRefine((i,n)=>{if((new Set(i.prompts.map(a=>a.id)).size!==i.prompts.length||new Set(i.variants.map(a=>a.id)).size!==i.variants.length)&&n.addIssue({code:"custom",message:"Prompt and variant IDs must be unique."}),i.startingProfile){let a=i.variants.find(r=>r.id===i.startingProfile.variantId);(!a?.profile||a.profile.contentHash!==i.startingProfile.profileHash||!i.variants.some(r=>r.profile===null))&&n.addIssue({code:"custom",path:["startingProfile"],message:"Retain the exact saved profile variant and a separate Off control."})}let t=new Set;for(let a of i.capture)for(let r of a.neurons){let s=`${a.layer}:${r}`;(t.has(s)||r>=(i.model.intermediateSizes[a.layer]??0))&&n.addIssue({code:"custom",path:["capture"],message:"Capture coordinates must be unique and inside the model."}),t.add(s)}});async function It(i){let n=at.parse(i);for(let o of n.variants)o.profile&&await Zo(o.profile,n.model);let t=n.capture.reduce((o,c)=>o+c.neurons.length,0),a=n.maxNewTokens,r=n.prompts.reduce((o,c)=>o+c.attentionMask.filter(Boolean).length+a,0)*n.variants.length*t*2,s=n.prompts.reduce((o,c)=>o+n.variants.reduce((l,p)=>l+(a+1)*c.tokenIds.length+a*(a+1)/2+(p.profile?.normalization.mode==="baseline_prompt_residual_median"?c.tokenIds.length:0),0),0);if(r>n.maximumCapturedValues||s>n.maximumForwardTokenWork)throw new h("activation_reference_budget_exceeded","The full requested capture and forward work exceed their declared bounds.");return n}d(It,"parseAndVerifyActivationReferenceRequest");var tm=e.object({promptId:tt,variantId:tt,layer:e.number().int().nonnegative(),neuron:e.number().int().nonnegative(),tokenIndex:e.number().int().nonnegative(),tokenId:e.number().int().nonnegative(),before:e.number().finite(),after:e.number().finite()}).strict(),bs=e.object({promptId:tt,variantId:tt,profileHash:gn.nullable(),generatedTokenIds:e.array(e.number().int().nonnegative()).max(128),forwardTokenWork:e.number().int().positive(),calibration:e.array(e.object({layer:e.number().int().nonnegative(),median:e.number().finite().positive(),sampleCount:e.number().int().positive(),columnNorms:e.array(e.object({neuron:e.number().int().nonnegative(),norm:e.number().finite().positive()}).strict()).max(64)}).strict()).max(64),durationMs:e.number().finite().nonnegative(),captureCount:e.number().int().nonnegative()}).strict(),nm=e.object({schemaVersion:e.literal("openpond.activationReferenceResult.v1"),requestHash:gn,modelHash:gn,runtime:e.object({implementation:e.literal("torch_dense_serial_reference_v1"),implementationHash:gn,torchVersion:tt,device:tt}).strict(),outcomes:e.array(bs).min(1).max(136),captures:e.array(tm).max(32768)}).strict(),xa=nm.extend({contentHash:gn}).strict();async function Ji(i,n){let t=await It(n),a=xa.parse(i),{contentHash:r,...s}=a,o=d(()=>{throw new h("activation_reference_result_mismatch","The inspection differs from its exact prompt, model, intervention or capture bounds.")},"fail8");(r!==await u(s)||a.requestHash!==await u(t)||a.modelHash!==await u(t.model)||a.captures.length*2>t.maximumCapturedValues||a.outcomes.length!==t.prompts.length*t.variants.length||a.outcomes.reduce((f,S)=>f+S.forwardTokenWork,0)>t.maximumForwardTokenWork)&&o();let c=new Set,l=new Map,p=new Set,g=new Map(t.prompts.map(f=>[f.id,f])),v=new Map(t.variants.map(f=>[f.id,f]));for(let f of a.captures){let S=JSON.stringify([f.promptId,f.variantId]),b=JSON.stringify([S,f.layer,f.neuron,f.tokenIndex]);(p.has(b)||!g.has(f.promptId)||!v.has(f.variantId)||!t.capture.some(x=>x.layer===f.layer&&x.neurons.includes(f.neuron)))&&o(),p.add(b),l.set(S,(l.get(S)??0)+1)}for(let f of a.outcomes){let S=JSON.stringify([f.promptId,f.variantId]),b=g.get(f.promptId),x=v.get(f.variantId);(!b||!x||c.has(S)||f.profileHash!==(x?.profile?.contentHash??null)||f.generatedTokenIds.length>t.maxNewTokens||f.captureCount!==(l.get(S)??0))&&o(),c.add(S);let H=b.tokenIds.filter((I,w)=>b.attentionMask[w]===1).concat(f.generatedTokenIds),R=f.generatedTokenIds.length,ee=t.capture.reduce((I,w)=>I+w.neurons.length,0),y=(R+1)*b.tokenIds.length+R*(R+1)/2+(x.profile?.normalization.mode==="baseline_prompt_residual_median"?b.tokenIds.length:0);if((f.captureCount!==H.length*ee||f.forwardTokenWork!==y||x.profile===null&&f.calibration.length!==0)&&o(),(R<t.maxNewTokens&&(!R||!t.eosTokenIds.includes(f.generatedTokenIds[R-1]))||f.generatedTokenIds.slice(0,-1).some(I=>t.eosTokenIds.includes(I)))&&o(),x.profile){let I=new Map;for(let w of x.profile.entries){let P=I.get(w.layer)??new Set;P.add(w.neuron),I.set(w.layer,P)}(f.calibration.length!==I.size||new Set(f.calibration.map(w=>w.layer)).size!==I.size||f.calibration.some(w=>!I.has(w.layer)||w.columnNorms.length!==I.get(w.layer).size||new Set(w.columnNorms.map(P=>P.neuron)).size!==w.columnNorms.length||w.columnNorms.some(P=>!I.get(w.layer).has(P.neuron))||x.profile.normalization.mode==="baseline_prompt_residual_median"&&w.sampleCount!==H.length-R-1))&&o()}a.captures.some(I=>I.promptId===f.promptId&&I.variantId===f.variantId&&H[I.tokenIndex]!==I.tokenId)&&o()}return a}d(Ji,"parseAndVerifyActivationReferenceResult");var Ce=e.string().trim().min(1).max(500),Qi=e.string().regex(/^[a-f0-9]{64}$/),Is=e.object({submissionHash:Qi,source:e.lazy(()=>Ja),baseModel:T,recipe:e.record(e.string(),e.unknown())}).strict(),Ki=e.object({artifact:j,checkpointId:Ce,registryArtifactId:Ce.nullable(),composition:e.enum(["base","residual_append","shared","sequential_merge"]),parent:e.object({jobId:Ce,artifact:j,checkpointId:Ce}).strict().nullable()}).strict(),am=e.object({schemaVersion:e.literal("openpond.trainingModelVersion.v1"),teamId:Ce,modelProjectId:Ce,portableProjectId:Ce,jobId:Ce,request:Is,candidate:Ki.omit({registryArtifactId:!0}),executionReceipt:j,createdAt:e.string().datetime({offset:!0})}).strict(),St=am.extend({contentHash:Qi}).strict();async function Jt(i,n={}){let t=St.parse(i),{contentHash:a,...r}=t;if(a!==await u(r)||n.teamId&&t.teamId!==n.teamId||n.modelProjectId&&t.modelProjectId!==n.modelProjectId||n.jobId&&t.jobId!==n.jobId||t.request.source.modelProject.id!==t.modelProjectId||t.request.source.modelProject.portableProjectId!==t.portableProjectId||t.candidate.composition==="base"!=(t.candidate.parent===null))throw new h("training_model_version_mismatch","The saved Model version differs from its original training result.");return t}d(Jt,"parseAndVerifyTrainingModelVersion");var im=e.object({schemaVersion:e.literal("openpond.trainingResult.v1"),teamId:Ce,name:e.string().min(1).max(500),job:e.lazy(()=>Le),model:e.lazy(()=>ye).nullable(),savedVersion:St.nullable(),request:Is.nullable(),outputs:e.lazy(()=>Ka),candidate:Ki.nullable(),candidateState:e.enum(["not_finished","request_unavailable","qualification_only","not_model_training","cleanup_pending","artifact_pending","retained"])}).strict(),rm=im.extend({contentHash:Qi}).strict();async function om(i,n){let t=rm.parse(i),{contentHash:a,...r}=t;function s(){throw new h("training_result_mismatch","The trained result differs from its producing Job, request or outputs.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==t.job.teamId||t.job.id!==n.jobId||n.teamId&&t.teamId!==n.teamId||t.outputs.outputs.some(g=>g.jobId!==t.job.id)||new Set(t.outputs.outputs.map(g=>g.id)).size!==t.outputs.outputs.length)&&s(),t.model&&(t.model.id!==t.job.modelProjectId||t.model.teamId!==t.teamId||t.model.portableProjectId!==t.job.portableProjectId)&&s();let o=t.request;o&&(o.submissionHash!==t.job.submissionHash||o.source.modelProject.id!==t.job.modelProjectId||o.source.modelProject.portableProjectId!==t.job.portableProjectId||o.source.modelProject.revision!==t.job.sourceProjectRevision)&&s();let c=t.outputs.receipt,l=t.outputs.outputs.filter(g=>g.kind!=="receipt"),p=t.outputs.outputs.filter(g=>g.kind==="receipt");if(c&&(c.jobId!==t.job.id||c.teamId!==t.teamId||c.submissionHash!==t.job.submissionHash||c.outputs.length!==l.length||l.some(g=>!c.outputs.some(v=>v.id===g.id&&v.contentHash===g.contentHash))||new Set(c.outputs.map(g=>g.id)).size!==c.outputs.length)&&s(),c&&o&&c.manifestHash!==o.source.harnessRunManifest.contentHash&&s(),(p.length>1||!c&&p.length||p[0]&&(p[0].id!==`${c.id}:output`||p[0].contentHash!==await u(c)))&&s(),t.candidate!==null!=(t.candidateState==="retained")&&s(),t.candidate){let g=t.candidate,v=t.outputs.outputs.find(f=>f.id===g.artifact.id&&f.contentHash===g.artifact.contentHash);(!o||t.job.state!=="succeeded"||t.job.kind!=="policy_optimize"||t.job.executionMode||!c?.cleanupComplete||!v||v.kind!=="adapter"||v.metadata.checkpointId!==g.checkpointId||g.composition==="base"&&g.parent!==null||g.composition!=="base"&&g.parent===null)&&s();for(let f of[o.source.harnessRunManifest,o.source.harnessRelease,o.source.tasksetRelease,o.source.dataset,...o.source.evidenceSets])c.inputs.some(S=>S.id===f.id&&S.contentHash===f.contentHash)||s()}if(t.savedVersion){let g=await Jt(t.savedVersion,{teamId:t.teamId,modelProjectId:t.job.modelProjectId,jobId:t.job.id}),v=t.candidate;(!o||!v)&&s();let{registryArtifactId:f,...S}=v;(await u(g.request)!==await u(o)||await u(g.candidate)!==await u(S))&&s()}return t}d(om,"parseAndVerifyTrainingResult");function sm(i){return{async result(n,t={}){let a=Ce.parse(n);return om(await i(`/v1/training/jobs/${encodeURIComponent(a)}/result`),{...t,jobId:a})}}}d(sm,"createTrainingResultClient");var pa="bespokelabs/Bespoke-Nimble-9B",fn="e93fabce8fcee46e7e8b45e2d955b8a4f0035917",wn="Qwen/Qwen3.5-9B",ha="c202236235762e1c871ad0ccb60c8ee5ba337b9a",En="a0a0f94d0f65e972bc20d088678ad3d595ff1c42b9c0d78f96034526303f63fc",Xi="a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715",Yi=268435456,Zi=e.string().regex(/^[a-f0-9]{64}$/),cm=e.object({path:e.string().regex(/^[A-Za-z0-9_.-]{1,120}$/),sha256:Zi,sizeBytes:e.number().int().positive().max(25e9)}).strict(),Ss=e.object({schemaVersion:e.literal("openpond.decisionSourceManifest.v1"),repository:e.enum([pa,wn]),revision:e.string().regex(/^[a-f0-9]{40}$/),files:e.array(cm).min(1).max(16)}).strict(),mn=Ss.extend({contentHash:Zi}),xs=e.object({schemaVersion:e.literal("openpond.decisionModelIdentity.v1"),source:T,backbone:e.object({architecture:e.literal("Qwen3_5ForConditionalGeneration"),modelType:e.literal("qwen3_5"),dtype:e.literal("bfloat16"),weightIdentity:e.literal("source_file_manifest_sha256_v1"),source:mn}).strict(),originalAdapter:mn,tokenizer:mn,reference:mn,license:e.object({spdx:e.literal("Apache-2.0"),files:e.array(mn).length(2)}).strict()}).strict(),Qt=xs.extend({contentHash:Zi}),ie=d((i,n,t)=>({path:i,sizeBytes:n,sha256:t}),"file"),dm=[ie("config.json",3126,"d0883072e01861ed0b2d47be3c16c36a8e81c224c7ffaa310c6558fb3f932b05"),ie("model.safetensors.index.json",79657,"26d3539b516be613f39563617cb9d33b3f83d401298125be392c80cefb8f7fe5"),ie("model.safetensors-00001-of-00004.safetensors",5276436216,"db6f444b43d318c92f360a13a25561a6a65b10c0631b8ed305a426dbaa6c380e"),ie("model.safetensors-00002-of-00004.safetensors",5335161512,"31c7d7e2dd5d207840b31cc59083c8f4c4718959149e0358c0364052bb9a0330"),ie("model.safetensors-00003-of-00004.safetensors",5368717440,"7ec36ba3a4176a44c3c0876ad80c56a2f70c84bf008d82e9501df642f17dadec"),ie("model.safetensors-00004-of-00004.safetensors",3325995712,"b62b0c4cd7e44edee103ee8f4fe225f246d5e768e07bfd5f25b63a8aa1fdd0c6")],mm=[ie("adapter_config.json",1296,"4064100b5c7c92b20b6aba8ec08af2e2a956d1fbb06263f814324301b710b3f2"),ie("adapter_model.safetensors",173188512,"ba7e28acb97f973e80fa51f3aa6fc6f75ea4081b89632ed45d8e5f3a1d7bfa6b")],lm=[ie("chat_template.jinja",7756,Xi),ie("tokenizer.json",19989325,"06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523"),ie("tokenizer_config.json",1125,"9cf04fffe3d8c3b85e439fb35c7acad0761ab51c422a8c4256d9f887c3a0be7d")],um=[ie("inference.py",5375,"95c37c0ee94b065858fcca8fe90cfa685ecde8713443c1b0555ed99012f5abfd"),ie("parallel_schema.py",6628,En),ie("requirements.txt",126,"7cfedd0abb35fe0b69677040ae800fa420f6c1d3162584a379785ca239ba04ea"),ie("schema_config.json",15838,"601c6fe561a33cbe9e88ed948503289c61c6f53876255ecb6988428824a57075")],Po=[ie("LICENSE",11544,"bbedc3fda3305820b977265f01b8619d87570a6739de3a5582c3464840f1e57a")];async function ri(i,n,t){let a=Ss.parse({schemaVersion:"openpond.decisionSourceManifest.v1",repository:i,revision:n,files:t});return{...a,contentHash:await u(a)}}d(ri,"sourceManifest");async function pm(){let i=d(t=>ri(pa,fn,t),"release"),n=xs.parse({schemaVersion:"openpond.decisionModelIdentity.v1",source:{schemaVersion:"openpond.baseModelPreference.v1",modelId:pa,revision:fn,tokenizerRevision:fn,chatTemplateHash:Xi,modelAssetId:null,source:"managed"},backbone:{architecture:"Qwen3_5ForConditionalGeneration",modelType:"qwen3_5",dtype:"bfloat16",weightIdentity:"source_file_manifest_sha256_v1",source:await ri(wn,ha,dm)},originalAdapter:await i(mm),tokenizer:await i(lm),reference:await i(um),license:{spdx:"Apache-2.0",files:[await ri(wn,ha,Po),await i(Po)]}});return{...n,contentHash:await u(n)}}d(pm,"decisionModelIdentity");async function Kt(i){let n=Qt.parse(i);if(m(n)!==m(await pm()))throw new h("decision_model_identity_mismatch","The decision Model differs from the exact released adapter, tokenizer or complete backbone source.");return n}d(Kt,"parseAndVerifyDecisionModelIdentity");var Je=e.string().regex(/^[a-f0-9]{64}$/),pn=e.string().min(1).max(2e3).refine(i=>i.trim().length>0),er=e.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,79}$/).refine(i=>!["constructor","prototype"].includes(i)),ys=e.number().int().min(-1e6).max(1e6),yi=e.union([e.string().min(1).max(256),e.boolean(),ys]),Pn=e.object({id:e.string().min(1).max(500),contentHash:Je}).strict(),hm=e.record(e.string().max(256),e.json()).superRefine((i,n)=>{try{A(i,65536)}catch{n.addIssue({code:"custom",message:"Decision state must be bounded finite JSON of at most 64 KiB."})}}),oi={id:er,description:pn},gm=e.discriminatedUnion("type",[e.object({...oi,type:e.literal("choice"),choices:e.array(e.object({value:e.string().min(1).max(256).refine(i=>i.trim().length>0),description:pn}).strict()).min(2).max(26)}).strict(),e.object({...oi,type:e.literal("boolean"),choices:e.tuple([e.object({value:e.literal(!1),description:pn}).strict(),e.object({value:e.literal(!0),description:pn}).strict()])}).strict(),e.object({...oi,type:e.literal("integer_levels"),choices:e.array(e.object({value:ys,description:pn}).strict()).min(2).max(26)}).strict()]).superRefine((i,n)=>{new Set(i.choices.map(t=>t.value)).size!==i.choices.length&&n.addIssue({code:"custom",path:["choices"],message:"Decision choices must be distinct."}),i.type==="integer_levels"&&i.choices.some((t,a)=>a>0&&t.value<=i.choices[a-1].value)&&n.addIssue({code:"custom",path:["choices"],message:"Integer levels must retain strictly increasing authored order."})}),fm=e.array(gm).min(1).max(8).superRefine((i,n)=>{new Set(i.map(t=>t.id)).size!==i.length&&n.addIssue({code:"custom",message:"Decision question names must be distinct."})}),kn=e.object({state:hm,questions:fm}).strict(),vm=kn.extend({id:e.string().min(1).max(500),targets:e.array(e.object({questionId:er,value:yi}).strict()).min(1).max(8)}).superRefine((i,n)=>{(i.targets.length!==i.questions.length||i.questions.some((t,a)=>{let r=i.targets[a];return!r||r.questionId!==t.id||!t.choices.some(s=>s.value===r.value)}))&&n.addIssue({code:"custom",path:["targets"],message:"Targets must match every named question and real choice in authored order."})}),bm=e.array(vm).min(1).max(4096).superRefine((i,n)=>{new Set(i.map(t=>t.id)).size!==i.length&&n.addIssue({code:"custom",message:"Decision example IDs must be distinct."});try{jt(i,8388608,"Decision examples")}catch{n.addIssue({code:"custom",message:"Decision examples exceed the 8 MiB input boundary."})}});async function Rb(i,n){A(i,8388608);let t=bm.parse(i);if(n!==void 0&&Je.parse(n)!==await u(t))throw new h("decision_examples_mismatch","The decision examples differ from the exact reviewed projection digest.");return t}d(Rb,"parseAndVerifyDecisionTrainingExamples");function Eb(i){A(i,131072);let n=kn.parse(i),t=Object.fromEntries(n.questions.map(a=>[a.id,{type:a.type==="boolean"?"boolean":"enum",description:a.description,choices:a.choices.map(r=>a.type==="integer_levels"?String(r.value):r.value),choice_descriptions:Object.fromEntries(a.choices.map(r=>[String(r.value),r.description]))}]));return{context:m(n.state),schema:t}}d(Eb,"decisionReferenceInput");var ya=e.object({schemaVersion:e.literal("openpond.decisionScoringRequest.v1"),model:Qt,artifact:Pn.nullable(),input:kn,limits:e.object({maximumPromptTokens:e.number().int().min(1).max(2048),maximumForwardTokenWork:e.number().int().min(1).max(65536),maximumDurationSeconds:e.number().finite().positive().max(300)}).strict()}).strict();async function tr(i){A(i,131072);let n=ya.parse(i);return await Kt(n.model),n}d(tr,"parseAndVerifyDecisionScoringRequest");var Im=e.object({questionId:er,promptTokenCount:e.number().int().min(1).max(2048),candidates:e.array(e.object({value:yi,code:e.string().regex(/^[A-Z]$/),tokenId:e.number().int().min(0).max(248319),logit:e.number().finite(),probability:e.number().finite().min(0).max(1)}).strict()).min(2).max(26),prediction:yi,expectedLevel:e.number().finite().min(-1e6).max(1e6).nullable()}).strict(),Sm=e.object({schemaVersion:e.literal("openpond.decisionScoringResult.v1"),requestHash:Je,modelHash:Je,runtimeHash:Je,preparedRowsHash:Je,artifact:Pn.nullable(),temperature:e.literal(1),distributions:e.array(Im).min(1).max(8),forwardTokenWork:e.number().int().positive().max(65536),durationMs:e.number().finite().nonnegative().max(3e5)}).strict(),nr=Sm.extend({contentHash:Je});async function ws(i,n){A(i,131072);let t=await tr(n.request),a=nr.parse(i),{contentHash:r,...s}=a,o=d(()=>{throw new h("decision_score_mismatch","The decision distributions differ from the exact request, complete T1 candidate scores or runtime.")},"fail8");(r!==await u(s)||a.requestHash!==await u(t)||a.modelHash!==await u(t.model)||a.runtimeHash!==Je.parse(n.runtimeHash)||m(a.artifact)!==m(t.artifact)||a.distributions.length!==t.input.questions.length||a.forwardTokenWork>t.limits.maximumForwardTokenWork||a.durationMs>t.limits.maximumDurationSeconds*1e3)&&o();let c=0;for(let[l,p]of t.input.questions.entries()){let g=a.distributions[l];(g.questionId!==p.id||g.candidates.length!==p.choices.length||g.promptTokenCount>t.limits.maximumPromptTokens||new Set(g.candidates.map(H=>H.tokenId)).size!==g.candidates.length)&&o();let v=Math.max(...g.candidates.map(H=>H.logit)),f=g.candidates.map(H=>Math.exp(H.logit-v)),S=f.reduce((H,R)=>H+R,0),b=0,x=0;for(let[H,R]of g.candidates.entries())(R.value!==p.choices[H].value||R.code!==String.fromCharCode(65+H)||Math.abs(R.probability-f[H]/S)>1e-8)&&o(),R.logit>g.candidates[b].logit&&(b=H),p.type==="integer_levels"&&(x+=p.choices[H].value*R.probability);(Math.abs(g.candidates.reduce((H,R)=>H+R.probability,0)-1)>1e-8||g.prediction!==p.choices[b].value||(p.type==="integer_levels"?g.expectedLevel===null||Math.abs(g.expectedLevel-x)>1e-8:g.expectedLevel!==null))&&o(),c+=g.promptTokenCount}return a.forwardTokenWork<c&&o(),a}d(ws,"parseAndVerifyDecisionScoringResult");var Ae=e.string().regex(/^[a-f0-9]{64}$/),wi=["o_proj","down_proj","k_proj","gate_proj","in_proj_b","in_proj_z","in_proj_a","out_proj","q_proj","in_proj_qkv","v_proj","up_proj"],_s=e.object({base_model_name_or_path:e.literal(wn),revision:e.literal(ha),peft_type:e.literal("LORA"),peft_version:e.literal("0.21.0"),task_type:e.literal("CAUSAL_LM"),r:e.literal(16),lora_alpha:e.literal(32),lora_dropout:e.literal(.05),bias:e.literal("none"),inference_mode:e.literal(!0),fan_in_fan_out:e.literal(!1),use_dora:e.literal(!1),use_rslora:e.literal(!1),modules_to_save:e.null(),target_modules:e.array(e.enum(wi)).length(12)}).strict().superRefine((i,n)=>{m(i.target_modules)!==m(wi)&&n.addIssue({code:"custom",path:["target_modules"],message:"The adapter must retain the exact released hybrid target modules."})});function kb(){return _s.parse({base_model_name_or_path:wn,revision:ha,peft_type:"LORA",peft_version:"0.21.0",task_type:"CAUSAL_LM",r:16,lora_alpha:32,lora_dropout:.05,bias:"none",inference_mode:!0,fan_in_fan_out:!1,use_dora:!1,use_rslora:!1,modules_to_save:null,target_modules:[...wi]})}d(kb,"decisionAdapterConfig");var Hs=e.object({schemaVersion:e.literal("openpond.decisionArtifactContract.v1"),task:e.literal("schema_candidate_classification_v1"),modelHash:Ae,tokenizerHash:Ae,promptCodeSha256:e.literal(En),stateEncoding:e.literal("canonical_json_utf8_v1"),integerLevels:e.literal("decimal_enum_strings_v1"),objective:e.literal("candidate_cross_entropy_v1"),labelsOutsidePrompt:e.literal(!0),temperature:e.literal(1),maximumPromptTokens:e.literal(2048),enableThinking:e.literal(!1),truncation:e.literal(!1)}).strict();async function xm(i){let n=await Kt(i);return Hs.parse({schemaVersion:"openpond.decisionArtifactContract.v1",task:"schema_candidate_classification_v1",modelHash:await u(n),tokenizerHash:n.tokenizer.contentHash,promptCodeSha256:En,stateEncoding:"canonical_json_utf8_v1",integerLevels:"decimal_enum_strings_v1",objective:"candidate_cross_entropy_v1",labelsOutsidePrompt:!0,temperature:1,maximumPromptTokens:2048,enableThinking:!1,truncation:!1})}d(xm,"decisionArtifactContract");var ym=e.object({name:e.string().regex(/^[A-Za-z0-9_.]{1,200}$/),shape:e.tuple([e.number().int().positive().max(12288),e.number().int().positive().max(12288)]),dtype:e.literal("F32")}).strict();function wm(){let i=[];for(let n=0;n<32;n++){let t=[["mlp.down_proj",12288,4096],["mlp.gate_proj",4096,12288],["mlp.up_proj",4096,12288],...n%4===3?[["self_attn.q_proj",4096,8192],["self_attn.k_proj",4096,1024],["self_attn.v_proj",4096,1024],["self_attn.o_proj",4096,4096]]:[["linear_attn.in_proj_a",4096,32],["linear_attn.in_proj_b",4096,32],["linear_attn.in_proj_qkv",4096,8192],["linear_attn.in_proj_z",4096,4096],["linear_attn.out_proj",4096,4096]]];for(let[a,r,s]of t){let o=`base_model.model.model.language_model.layers.${n}.${a}`;i.push({name:`${o}.lora_A.weight`,shape:[16,r],dtype:"F32"}),i.push({name:`${o}.lora_B.weight`,shape:[s,16],dtype:"F32"})}}return i.sort((n,t)=>n.name<t.name?-1:n.name>t.name?1:0)}d(wm,"decisionAdapterTensorInventory");var _m=e.object({schemaVersion:e.literal("openpond.decisionAdapterArtifact.v1"),method:e.literal("decision_model"),model:Qt,adapterConfig:_s,contract:Hs,pins:e.object({inputHash:Ae,recipeHash:Ae,dataHash:Ae,runtimeHash:Ae,parentArtifactHash:Ae.nullable()}).strict(),payload:e.object({path:e.literal("adapter_model.safetensors"),sha256:Ae,sizeBytes:e.number().int().positive().max(Yi),tensors:e.array(ym).length(496)}).strict()}).strict(),js=_m.extend({contentHash:Ae});async function Ts(i,n){let t=js.parse(i),{contentHash:a,...r}=t;await Kt(t.model);let s=d(()=>{throw new h("decision_artifact_mismatch","The decision artifact differs from its exact hybrid module, source, recipe or data.")},"fail8");return(a!==await u(r)||m(t.contract)!==m(await xm(t.model))||m(t.payload.tensors)!==m(wm())||t.payload.sizeBytes<t.payload.tensors.reduce((o,c)=>o+c.shape[0]*c.shape[1]*4,0))&&s(),n&&(m(t.model)!==m(n.model)||t.pins.inputHash!==n.inputHash||t.pins.recipeHash!==n.recipeHash||t.pins.dataHash!==n.dataHash||t.pins.runtimeHash!==n.runtimeHash||t.pins.parentArtifactHash!==n.parentArtifactHash)&&s(),t}d(Ts,"parseAndVerifyDecisionAdapterArtifact");var Hm=e.object({path:e.enum(["manifest.json","adapter_model.safetensors","adapter_config.json","decision_contract.json"]),artifactId:e.string().min(1).max(500),sha256:Ae,sizeBytes:e.number().int().positive().max(Yi)}).strict(),ne=e.string().regex(/^[a-f0-9]{64}$/),Ms=e.object({learningRate:e.number().finite().positive().max(.001),weightDecay:e.number().finite().min(0).max(.1),maxSteps:e.number().int().min(1).max(4096),gradientAccumulationSteps:e.number().int().min(1).max(64),maximumPromptTokens:e.number().int().min(1).max(2048),seed:e.number().int().min(0).max(2147483647),maxDurationSeconds:e.number().finite().min(1).max(21600),maxCheckpointBytes:e.number().int().min(173113345).max(Yi)}).strict(),jm=e.object({batch:F,examplesSha256:ne,encodingHash:ne}).strict(),Tm=e.object({schemaVersion:e.literal("openpond.decisionSupervisedEncoding.v1"),implementation:e.literal("nimble_reference_candidate_logits_v1"),modelHash:ne,tokenizerHash:ne,promptCodeSha256:e.literal(En),maximumPromptTokens:e.number().int().min(1).max(2048),stateEncoding:e.literal("canonical_json_utf8_v1"),integerLevels:e.literal("decimal_enum_strings_v1"),labelsOutsidePrompt:e.literal(!0),objective:e.literal("candidate_cross_entropy_v1"),temperature:e.literal(1),enableThinking:e.literal(!1),truncation:e.literal(!1),microBatchSize:e.literal(1)}).strict();async function Mm(i,n){let t=await Kt(i);return Tm.parse({schemaVersion:"openpond.decisionSupervisedEncoding.v1",implementation:"nimble_reference_candidate_logits_v1",modelHash:await u(t),tokenizerHash:t.tokenizer.contentHash,promptCodeSha256:En,maximumPromptTokens:n,stateEncoding:"canonical_json_utf8_v1",integerLevels:"decimal_enum_strings_v1",labelsOutsidePrompt:!0,objective:"candidate_cross_entropy_v1",temperature:1,enableThinking:!1,truncation:!1,microBatchSize:1})}d(Mm,"decisionSupervisedEncoding");var ar=e.object({schemaVersion:e.literal("openpond.decisionTrainingRequest.v1"),model:Qt,data:jm,training:Ms,parentArtifact:Pn.nullable()}).strict();async function ir(i){A(i,131072);let n=ar.parse(i);if(n.data.encodingHash!==await u(await Mm(n.model,n.training.maximumPromptTokens)))throw new h("decision_encoding_mismatch","The decision request differs from its exact candidate-only supervised encoder.");return n}d(ir,"parseAndVerifyDecisionTrainingRequest");var Rm=e.object({schemaVersion:e.literal("openpond.decisionTrainingResult.v1"),inputHash:ne,modelHash:ne,runtimeHash:ne,dataHash:ne,preparedRowsHash:ne,initialAdapterSourceHash:ne,optimizerSteps:e.number().int().min(1).max(4096),examplesProcessed:e.number().int().min(1).max(262144),questionRowsProcessed:e.number().int().min(1).max(262144),targetTokens:e.number().int().min(1).max(262144),forwardTokenWork:e.number().int().positive().max(536870912),durationMs:e.number().finite().nonnegative().max(216e5),meanLoss:e.number().finite().nonnegative(),finalLoss:e.number().finite().nonnegative(),trainableParameterCount:e.literal(43278336),baseOptimizerParameterCount:e.literal(0),baseGradientParameterCount:e.literal(0),frozenBackboneState:e.object({algorithm:e.literal("torch_state_dict_sha256_v1"),sourceManifestHash:ne,before:ne,after:ne}).strict(),artifact:e.object({id:e.string().min(1).max(500),contentHash:ne,manifest:js,files:e.array(Hm).length(4)}).strict()}).strict(),rr=Rm.extend({contentHash:ne});async function Em(i,n){A(i,524288);let t=await ir(n.request),a=rr.parse(i),{contentHash:r,...s}=a,o=await Ts(a.artifact.manifest,{model:t.model,inputHash:await u(t),recipeHash:await u(t.training),dataHash:await u(t.data),runtimeHash:ne.parse(n.runtimeHash),parentArtifactHash:t.parentArtifact?.contentHash??null}),c=d(()=>{throw new h("decision_training_result_mismatch","The decision result differs from its exact run, frozen backbone evidence or committed artifact.")},"fail8");(r!==await u(s)||a.inputHash!==o.pins.inputHash||a.modelHash!==await u(t.model)||a.runtimeHash!==n.runtimeHash||a.dataHash!==o.pins.dataHash||a.initialAdapterSourceHash!==(t.parentArtifact?.contentHash??t.model.originalAdapter.contentHash)||a.optimizerSteps!==t.training.maxSteps||a.questionRowsProcessed!==a.optimizerSteps*t.training.gradientAccumulationSteps||a.examplesProcessed>a.questionRowsProcessed||a.targetTokens!==a.questionRowsProcessed||a.forwardTokenWork<a.questionRowsProcessed||a.forwardTokenWork>a.questionRowsProcessed*t.training.maximumPromptTokens||a.durationMs>t.training.maxDurationSeconds*1e3||a.frozenBackboneState.sourceManifestHash!==t.model.backbone.source.contentHash||a.frozenBackboneState.before!==a.frozenBackboneState.after||a.artifact.contentHash!==o.contentHash||new Set(a.artifact.files.map(p=>p.path)).size!==4||a.artifact.files.some(p=>p.artifactId!==a.artifact.id)||a.artifact.files.reduce((p,g)=>p+g.sizeBytes,0)>t.training.maxCheckpointBytes)&&c();let l=a.artifact.files.find(p=>p.path==="adapter_model.safetensors");(!l||l.sha256!==o.payload.sha256||l.sizeBytes!==o.payload.sizeBytes)&&c();for(let[p,g]of[["manifest.json",o],["adapter_config.json",o.adapterConfig],["decision_contract.json",o.contract]]){let v=a.artifact.files.find(f=>f.path===p);(!v||v.sha256!==await u(g)||v.sizeBytes!==aa(g)||v.sizeBytes>262144)&&c()}return m(t.model)!==m(o.model)&&c(),a}d(Em,"parseAndVerifyDecisionTrainingResult");var ko=e.string().regex(/^[a-f0-9]{64}$/),fe=e.string().max(100),or=e.object({modelProjectId:e.string().min(1).max(240),versionHash:ko,artifact:Pn,modelHash:ko}).strict(),Pm=e.object({learningRate:fe,weightDecay:fe,maxSteps:fe,gradientAccumulationSteps:fe,maximumPromptTokens:fe,seed:fe,maxDurationSeconds:fe,maxCheckpointBytes:fe}).strict(),km=e.object({maximumPromptTokens:fe,maximumForwardTokenWork:fe,maximumDurationSeconds:fe}).strict(),Am=e.object({id:e.string().max(80),type:e.enum(["choice","boolean","integer_levels"]),description:e.string().max(2e3),choices:e.array(e.object({value:e.string().max(256),description:e.string().max(2e3)}).strict()).max(26)}).strict(),Ao={baseModel:T.nullable(),name:e.string().max(500),maximumSpendUsd:fe,parentArtifact:Pn.nullable(),startingDecision:or.optional()},zt=e.discriminatedUnion("mode",[e.object({...Ao,mode:e.literal("train"),batch:F.nullable(),training:Pm}).strict(),e.object({...Ao,mode:e.literal("score"),stateJson:e.string().max(131072),questions:e.array(Am).max(8),limits:km}).strict()]);function Cm(){return T.parse({schemaVersion:"openpond.baseModelPreference.v1",modelId:pa,revision:fn,tokenizerRevision:fn,chatTemplateHash:Xi,modelAssetId:null,source:"managed"})}d(Cm,"decisionSourcePreference");var Ie=e.string().trim().min(1).max(240),Xe=e.string().regex(/^[a-f0-9]{64}$/),qm=e.object({schemaVersion:e.literal("openpond.decisionModelVersion.v1"),teamId:Ie,ownerUserId:Ie,modelProjectId:Ie,portableProjectId:Ie,baseModel:T,request:ar,source:e.object({executionId:Ie,inputHash:Xe,runtimeHash:Xe,resultHash:Xe}).strict(),artifact:rr.shape.artifact,createdAt:e.iso.datetime()}).strict(),Xt=qm.extend({contentHash:Xe});async function Fe(i,n={}){A(i,524288);let t=Xt.parse(i),{contentHash:a,...r}=t,s=await ir(t.request),o=await Ts(t.artifact.manifest,{model:s.model,inputHash:await u(s),recipeHash:await u(s.training),dataHash:await u(s.data),runtimeHash:t.source.runtimeHash,parentArtifactHash:s.parentArtifact?.contentHash??null});function c(){throw new h("decision_model_version_mismatch","The saved decision Model differs from its exact trained source, runtime or committed artifact.")}d(c,"fail8"),(a!==await u(r)||n.teamId!==void 0&&t.teamId!==n.teamId||n.modelProjectId!==void 0&&t.modelProjectId!==n.modelProjectId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||n.versionHash!==void 0&&t.contentHash!==n.versionHash||m(t.baseModel)!==m(s.model.source)||t.source.inputHash!==o.pins.inputHash||t.artifact.contentHash!==o.contentHash||new Set(t.artifact.files.map(p=>p.path)).size!==4||t.artifact.files.some(p=>p.artifactId!==t.artifact.id)||t.artifact.files.reduce((p,g)=>p+g.sizeBytes,0)>s.training.maxCheckpointBytes)&&c();let l=t.artifact.files.find(p=>p.path==="adapter_model.safetensors");(!l||l.sha256!==o.payload.sha256||l.sizeBytes!==o.payload.sizeBytes)&&c();for(let[p,g]of[["manifest.json",o],["adapter_config.json",o.adapterConfig],["decision_contract.json",o.contract]]){let v=t.artifact.files.find(f=>f.path===p);(!v||v.sha256!==await u(g)||v.sizeBytes!==aa(g)||v.sizeBytes>262144)&&c()}return t}d(Fe,"parseAndVerifyDecisionModelVersion");async function zm(i,n,t={}){let a=or.parse(i),r=await Fe(n,{...t,modelProjectId:a.modelProjectId,versionHash:a.versionHash});if(r.artifact.id!==a.artifact.id||r.artifact.contentHash!==a.artifact.contentHash||await u(r.request.model)!==a.modelHash)throw new h("decision_experiment_source_mismatch","Retain the exact saved decision Model and trained adapter.");return r}d(zm,"verifySavedDecisionExperimentSource");async function Cb(i,n,t={}){let a=zt.parse(i),r=await Fe(n,t);return zt.parse({...a,baseModel:r.baseModel,parentArtifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},startingDecision:{modelProjectId:r.modelProjectId,versionHash:r.contentHash,artifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},modelHash:await u(r.request.model)}})}d(Cb,"decisionFormFromModelVersion");var Rs=e.object({teamId:Ie,operationId:Ie,executionId:Ie,resultHash:Xe,artifactHash:Xe,name:e.string().trim().min(1).max(200),modelProjectId:Ie.nullable(),expectedModelRevision:e.number().int().nonnegative()}).strict().refine(i=>i.modelProjectId===null?i.expectedModelRevision===0:i.expectedModelRevision>0,{message:"Retain the exact existing Model revision, or create a new Model."}),Dm=e.object({schemaVersion:e.literal("openpond.decisionResultSaveReceipt.v1"),teamId:Ie,actorId:Ie,operationId:Ie,requestHash:Xe,model:ye,version:Xt}).strict(),Um=Dm.extend({contentHash:Xe});async function Vm(i,n,t){let a=Rs.parse(n),r=Um.parse(i),{contentHash:s,...o}=r;if(await Fe(r.version,{teamId:a.teamId,modelProjectId:r.model.id,ownerUserId:r.actorId}),s!==await u(o)||r.teamId!==a.teamId||r.model.teamId!==a.teamId||t!==void 0&&r.actorId!==t||r.operationId!==a.operationId||r.requestHash!==await u(a)||r.version.source.executionId!==a.executionId||r.version.source.resultHash!==a.resultHash||r.version.artifact.contentHash!==a.artifactHash||r.model.name!==a.name||r.model.revision!==a.expectedModelRevision+1||a.modelProjectId!==null&&r.model.id!==a.modelProjectId||r.version.portableProjectId!==r.model.portableProjectId)throw new h("decision_model_save_mismatch","The saved Model differs from the original decision training result, artifact or Model revision.");return r}d(Vm,"parseAndVerifyDecisionResultSaveReceipt");function Nm(i){return{async saveDecisionResultModel(n,t){let a=Rs.parse(n);return Vm(await i(`/v1/training/modification-executions/${encodeURIComponent(a.executionId)}/model`,{method:"POST",body:m(a),signal:t?.signal}),a,t?.actorId)}}}d(Nm,"createDecisionModelClient");var Es="b84624f44dfe8fc6cd9e41df916c44124a0c46dc",$m=17179869184,Ps=8388608,C=e.string().regex(/^[a-f0-9]{64}$/),sr=e.string().trim().min(1).max(500),ks=e.string().min(1).max(32768),As=B.refine(i=>i.modelId==="Qwen/Qwen3-8B"&&i.revision==="b968826d9c46dd6066d109eabc6255188de91218"&&i.dtype==="bfloat16"&&i.hiddenSize===4096&&i.intermediateSizes.length===36&&i.intermediateSizes.every(n=>n===12288),{message:"AlphaEdit requires the exact unquantized Qwen3-8B BF16 backbone."});function Cs(i){return i.split("{}").length===2&&!i.replace("{}","").match(/[{}]/)}d(Cs,"onePlaceholder");var Bm=e.object({id:sr,subject:e.string().min(1).max(2048),promptTemplate:ks.refine(Cs),targetNew:e.string().min(1).max(4096)}).strict(),Fm=e.object({id:sr,text:ks}).strict(),Om=e.array(Bm).min(1).max(64).superRefine((i,n)=>{(new Set(i.map(t=>t.id)).size!==i.length||new TextEncoder().encode(m(i)).byteLength>Ps)&&n.addIssue({code:"custom",message:"Edit identifiers must be unique and the canonical batch must fit the data byte bound."})}),Lm=e.array(Fm).min(1).max(4096).superRefine((i,n)=>{(new Set(i.map(t=>t.id)).size!==i.length||new TextEncoder().encode(m(i)).byteLength>Ps)&&n.addIssue({code:"custom",message:"Preservation identifiers must be unique and the canonical batch must fit the data byte bound."})}),Co=e.object({batch:F,examplesSha256:C}).strict(),qs=e.object({edits:Co,preservation:Co}).strict(),Yt=e.object({schemaVersion:e.literal("openpond.alphaEditConfig.v1"),implementation:e.literal("openpond_qwen_alphaedit_v1"),sourceRevision:e.literal(Es),rewriteModule:e.literal("mlp.down_proj.weight"),factToken:e.literal("subject_last"),layers:e.array(e.number().int().min(0).max(35)).min(1).max(8),lossLayer:e.number().int().min(0).max(35),contextTemplateGroups:e.array(e.array(e.string().min(2).max(2048).refine(Cs)).min(1).max(8)).min(1).max(4),nullspaceThreshold:e.number().finite().positive().max(1),l2:e.number().finite().positive().max(1e5),covariance:e.literal("non_padding_uncentered_second_moment_fp32_v1"),projector:e.literal("covariance_svd_below_absolute_threshold_v1"),sequentialState:e.literal("post_edit_group_mean_keys_outer_product_sum_v1"),targetTokenization:e.literal("leading_space_no_special_tokens_v1")}).strict().superRefine((i,n)=>{(i.layers.some((a,r)=>r>0&&a<=i.layers[r-1])||i.lossLayer<i.layers[i.layers.length-1]||i.contextTemplateGroups[0]?.length!==1||i.contextTemplateGroups[0]?.[0]!=="{}")&&n.addIssue({code:"custom",message:"Layers must increase, the loss layer must follow the rewrite layers, and the first context group must be the clean prompt."});let t=i.contextTemplateGroups.flat();new Set(t).size!==t.length&&n.addIssue({code:"custom",message:"Context templates must be unique."})}),cr=e.object({maxSteps:e.number().int().min(1).max(128),learningRate:e.number().finite().positive().max(1),klFactor:e.number().finite().min(0).max(100),latentWeightDecay:e.number().finite().min(0).max(100),clampNormFactor:e.number().finite().positive().max(100),maxSequenceLength:e.number().int().min(2).max(8192),maxDurationSeconds:e.number().finite().min(1).max(21600),maxForwardTokenWork:e.number().int().positive().max(1e8),maxCheckpointBytes:e.number().int().positive().max($m),seed:e.number().int().min(0).max(2147483647)}).strict(),wa=e.object({id:sr,contentHash:C}).strict(),it=e.object({schemaVersion:e.literal("openpond.alphaEditTrainingRequest.v1"),model:As,data:qs,config:Yt,training:cr,parentArtifact:wa.nullable()}).strict();async function _a(i){return it.parse(i)}d(_a,"parseAndVerifyAlphaEditTrainingRequest");async function Db(i,n,t){let a=it.parse(i),r=Om.parse(n),s=Lm.parse(t);if(await u(r)!==a.data.edits.examplesSha256||await u(s)!==a.data.preservation.examplesSha256)throw new h("alphaedit_data_mismatch","The AlphaEdit input differs from its reviewed edit or preservation batch.");return{edits:r,preservation:s}}d(Db,"verifyAlphaEditData");var Wm=e.object({name:e.string().regex(/^[A-Za-z0-9_.]{1,200}$/),shape:e.array(e.number().int().positive().max(1e6)).length(2),dtype:e.enum(["BF16","F32"])}).strict(),zs=2147483648,Ds=e.string().regex(/^state-(?:[0-9]|[12][0-9]|3[0-5])\.safetensors$/),qo=e.object({sha256:C,sizeBytes:e.number().int().positive().max(zs),tensors:e.array(Wm).min(1).max(24)}).strict();function Gm(i){let n=Yt.parse(i);return{patch:n.layers.map(t=>({name:`layers.${t}.mlp.down_proj.weight`,shape:[4096,12288],dtype:"BF16"})),state:n.layers.flatMap(t=>["covariance","projector","cache_c"].map(a=>({name:`layers.${t}.${a}`,shape:[12288,12288],dtype:"F32"})))}}d(Gm,"alphaEditTensorInventory");function Vb(i){let n=Yt.parse(i).layers.length;return n*(4096*12288*2+3*12288*12288*4)+(n+1)*65544+262144}d(Vb,"alphaEditMinimumCheckpointBytes");var Jm=e.object({schemaVersion:e.literal("openpond.alphaEditArtifact.v1"),method:e.literal("alphaedit"),config:Yt,pins:e.object({baseModel:As,configHash:C,recipeHash:C,dataHash:C,data:qs,runtimeHash:C,parentArtifactHash:C.nullable(),preservationModelHash:C}).strict(),representation:e.literal("exact_replacement_bf16_down_proj_matrices_v1"),payloads:e.object({patch:qo.extend({path:e.literal("patch.safetensors")}),state:e.array(qo.extend({path:Ds})).min(1).max(8)}).strict()}).strict(),Us=Jm.extend({contentHash:C}),sa=d(i=>[...i].sort((n,t)=>n.name<t.name?-1:n.name>t.name?1:0),"order");async function Vs(i,n){let t=Us.parse(i),{contentHash:a,...r}=t,s=Gm(t.config),o=d(()=>{throw new h("alphaedit_artifact_mismatch","The AlphaEdit matrix patch differs from its exact model, state or input.")},"fail8");if((a!==await u(r)||t.pins.configHash!==await u(t.config)||t.pins.dataHash!==await u(t.pins.data)||t.pins.preservationModelHash!==await u(t.pins.baseModel)||t.payloads.patch.sizeBytes<t.config.layers.length*4096*12288*2||t.payloads.state.length!==t.config.layers.length||m(sa(t.payloads.patch.tensors))!==m(sa(s.patch))||t.payloads.state.some((c,l)=>c.path!==`state-${t.config.layers[l]}.safetensors`||c.sizeBytes<3*12288*12288*4||m(sa(c.tensors))!==m(sa(s.state.filter(p=>p.name.startsWith(`layers.${t.config.layers[l]}.`))))))&&o(),n){let c=it.parse(n.request);(m(t.pins.baseModel)!==m(c.model)||m(t.config)!==m(c.config)||m(t.pins.data)!==m(c.data)||t.pins.recipeHash!==await u(c.training)||t.pins.runtimeHash!==n.runtimeHash||t.pins.parentArtifactHash!==(c.parentArtifact?.contentHash??null)||t.payloads.patch.sizeBytes+t.payloads.state.reduce((l,p)=>l+p.sizeBytes,0)>c.training.maxCheckpointBytes)&&o()}return t}d(Vs,"parseAndVerifyAlphaEditArtifact");var Qm=e.object({path:e.union([e.enum(["manifest.json","patch.safetensors"]),Ds]),artifactId:e.string().min(1).max(500),sha256:C,sizeBytes:e.number().int().positive().max(zs)}).strict(),Km=e.object({schemaVersion:e.literal("openpond.alphaEditComparisons.v1"),startingState:e.enum(["base","parent"]),vocabularySize:e.number().int().min(1).max(262144),edits:e.array(e.object({id:e.string().min(1).max(500),contextCount:e.number().int().min(1).max(32),targetTokens:e.number().int().min(1).max(32*8191),beforeMeanTargetNll:e.number().finite().nonnegative(),afterMeanTargetNll:e.number().finite().nonnegative(),reloadedMeanTargetNll:e.number().finite().nonnegative()}).strict()).min(1).max(64),preservation:e.object({examples:e.number().int().min(1).max(4096),comparedPositions:e.number().int().min(1).max(4096),meanNextTokenKl:e.number().finite().nonnegative(),maximumNextTokenKl:e.number().finite().nonnegative()}).strict(),reload:e.object({reference:e.literal("final_edited_model"),comparedTargetTokens:e.number().int().min(1).max(2048*8191),comparedPreservationPositions:e.number().int().min(1).max(4096),meanNextTokenKl:e.number().finite().nonnegative(),maximumNextTokenKl:e.number().finite().nonnegative(),maximumAbsoluteTargetNllDifference:e.number().finite().nonnegative(),maximumAbsoluteLogProbabilityDifference:e.number().finite().nonnegative(),absoluteTolerance:e.literal(1e-5),equivalent:e.boolean(),baseWeightsHash:C,editedWeightsHash:C,untouchedWeightsHash:C}).strict()}).strict(),Xm=e.object({schemaVersion:e.literal("openpond.alphaEditTrainingResult.v1"),inputHash:C,modelHash:C,runtimeHash:C,dataHash:C,preparedRowsHash:C,editsProcessed:e.number().int().min(1).max(64),latentOptimizerSteps:e.number().int().min(0).max(8192),forwardTokenWork:e.number().int().positive().max(1e8),durationMs:e.number().finite().nonnegative().max(216e5),comparisons:Km,targetLosses:e.array(e.object({id:e.string().min(1).max(500),initial:e.number().finite().nonnegative(),final:e.number().finite().nonnegative(),optimizerSteps:e.number().int().min(0).max(128)}).strict()).min(1).max(64),untouchedWeightsHashBefore:C,untouchedWeightsHashAfter:C,editedWeightsHashBefore:C,editedWeightsHashAfter:C,baseOptimizerParameterCount:e.literal(0),baseGradientParameterCount:e.literal(0),layerEvidence:e.array(e.object({layer:e.number().int().min(0).max(35),preservationTokens:e.number().int().positive(),nullspaceRank:e.number().int().min(0).max(12288),updateFrobeniusNorm:e.number().finite().nonnegative(),solveRelativeResidual:e.number().finite().nonnegative().max(.01),sequentialKeyCount:e.number().int().min(1).max(64)}).strict()).min(1).max(8),artifact:wa.extend({manifest:Us,files:e.array(Qm).min(3).max(10)})}).strict(),dr=Xm.extend({contentHash:C});async function Ym(i,n){let t=it.parse(n.request),a=dr.parse(i),{contentHash:r,...s}=a,o=await Vs(a.artifact.manifest,n),c=a.artifact.files.find(b=>b.path==="manifest.json"),l=a.artifact.files.find(b=>b.path==="patch.safetensors"),p=[o.payloads.patch,...o.payloads.state],g=a.comparisons,v=g.reload,f=t.config.contextTemplateGroups.reduce((b,x)=>b+x.length,0),S=v.baseWeightsHash===t.model.weightsHash&&v.editedWeightsHash===a.editedWeightsHashAfter&&v.untouchedWeightsHash===a.untouchedWeightsHashAfter&&v.maximumAbsoluteTargetNllDifference<=v.absoluteTolerance&&v.maximumAbsoluteLogProbabilityDifference<=v.absoluteTolerance&&v.maximumNextTokenKl<=v.absoluteTolerance;if(r!==await u(s)||a.inputHash!==await u(t)||a.modelHash!==await u(t.model)||a.runtimeHash!==n.runtimeHash||a.dataHash!==await u(t.data)||a.untouchedWeightsHashBefore!==a.untouchedWeightsHashAfter||a.targetLosses.length!==a.editsProcessed||new Set(a.targetLosses.map(b=>b.id)).size!==a.editsProcessed||a.latentOptimizerSteps!==a.targetLosses.reduce((b,x)=>b+x.optimizerSteps,0)||a.targetLosses.some(b=>b.optimizerSteps>t.training.maxSteps)||g.startingState!==(t.parentArtifact?"parent":"base")||g.edits.length!==a.editsProcessed||m(g.edits.map(b=>b.id))!==m(a.targetLosses.map(b=>b.id))||g.edits.some(b=>b.contextCount!==f||b.targetTokens%f!==0||b.targetTokens>f*(t.training.maxSequenceLength-1)||Math.abs(b.afterMeanTargetNll-b.reloadedMeanTargetNll)>v.maximumAbsoluteTargetNllDifference+1e-12)||g.preservation.examples!==g.preservation.comparedPositions||g.preservation.meanNextTokenKl>g.preservation.maximumNextTokenKl+1e-12||v.comparedTargetTokens!==g.edits.reduce((b,x)=>b+x.targetTokens,0)||v.comparedPreservationPositions!==g.preservation.comparedPositions||v.meanNextTokenKl>v.maximumNextTokenKl+1e-12||v.equivalent!==S||a.forwardTokenWork<3*(v.comparedTargetTokens+v.comparedPreservationPositions)||a.forwardTokenWork>t.training.maxForwardTokenWork||a.durationMs>t.training.maxDurationSeconds*1e3||m(a.layerEvidence.map(b=>b.layer))!==m(t.config.layers)||a.layerEvidence.some(b=>b.sequentialKeyCount!==a.editsProcessed)||a.artifact.contentHash!==o.contentHash||!c||!l||a.artifact.files.length!==t.config.layers.length+2||new Set(a.artifact.files.map(b=>b.path)).size!==a.artifact.files.length||c.sha256!==await u(o)||c.sizeBytes!==new TextEncoder().encode(m(o)).byteLength||c.sizeBytes>262144||l.sha256!==o.payloads.patch.sha256||l.sizeBytes!==o.payloads.patch.sizeBytes||p.some(b=>!a.artifact.files.some(x=>x.path===b.path&&x.sha256===b.sha256&&x.sizeBytes===b.sizeBytes))||a.artifact.files.some(b=>b.artifactId!==a.artifact.id)||a.artifact.files.reduce((b,x)=>b+x.sizeBytes,0)>t.training.maxCheckpointBytes)throw new h("alphaedit_result_mismatch","The AlphaEdit result differs from its matrix patch, observed work or committed custody.");return a}d(Ym,"parseAndVerifyAlphaEditTrainingResult");var mr=16777216,Ns="8a55f3159f735eb0823d7a894f67f632bf568bb3",ga=e.string().regex(/^[a-f0-9]{64}$/),$s=e.object({layer:e.number().int().min(0).max(35),neuron:e.number().int().min(0).max(12287)}).strict(),_n=e.object({count:e.number().int().min(1).max(128),span:e.enum(["reply_prediction","reply_start","prompt"]),backgroundStatistic:e.enum(["mean_domains","max_domains"]),maximumBackgroundTargetRatio:e.number().finite().min(0).max(1),gradientExamples:e.number().int().min(1).max(64),explicitCoordinates:e.array($s).min(1).max(128).nullable()}).strict().superRefine((i,n)=>{i.explicitCoordinates&&(i.explicitCoordinates.length!==i.count||new Set(i.explicitCoordinates.map(t=>`${t.layer}:${t.neuron}`)).size!==i.count)&&n.addIssue({code:"custom",path:["explicitCoordinates"],message:"Explicit coordinates must be distinct and match the selected count."})}),si=e.object({batch:F,examplesSha256:ga,encodingHash:ga}).strict(),Bs=e.object({target:si,background:e.array(si.extend({domain:e.string().trim().min(1).max(100)}).strict()).min(1).max(8),preservation:si.nullable()}).strict().superRefine((i,n)=>{new Set(i.background.map(t=>t.domain)).size!==i.background.length&&n.addIssue({code:"custom",path:["background"],message:"Background domains must have distinct names."})}),lr=e.object({learningRate:e.number().finite().positive().max(.1),maxSteps:e.number().int().min(1).max(128),gradientAccumulationSteps:e.number().int().min(1).max(32),maxSequenceLength:e.number().int().min(2).max(8192),preservationWeight:e.number().finite().min(0).max(100),preservationExamplesPerStep:e.number().int().min(0).max(32),seed:e.number().int().min(0).max(2147483647),maxDurationSeconds:e.number().finite().min(1).max(21600),maxCheckpointBytes:e.number().int().min(1).max(mr),maximumForwardTokenWork:e.number().int().min(1).max(1e8)}).strict(),An=e.object({schemaVersion:e.literal("openpond.selectiveNeuronTrainingRequest.v1"),model:B,data:Bs,selection:_n,training:lr,parentArtifact:e.null()}).strict().superRefine((i,n)=>{(i.model.modelId!=="Qwen/Qwen3-8B"||i.model.revision!=="b968826d9c46dd6066d109eabc6255188de91218"||i.model.dtype!=="bfloat16"||i.model.hiddenSize!==4096||i.model.intermediateSizes.length!==36||i.model.intermediateSizes.some(a=>a!==12288))&&n.addIssue({code:"custom",path:["model"],message:"Use the exact supported dense BF16 Qwen3-8B source identity."});let t=i.training.preservationWeight>0;(t!==(i.data.preservation!==null)||t!==i.training.preservationExamplesPerStep>0)&&n.addIssue({code:"custom",path:["training","preservationWeight"],message:"Preservation data, weight and per-step work must be present together."})}),Zm=e.object({schemaVersion:e.literal("openpond.neuronTrainingEncoding.v1"),implementation:e.literal("supervised_trainer.prepare_example.v1"),modelHash:ga,tokenizerHash:ga,maxSequenceLength:e.number().int().min(2).max(8192),completionOnly:e.literal(!0),enableThinking:e.literal(!1),truncation:e.literal("left_prompt_preserve_final_target_v1"),selectionBoundaries:e.literal("verified_last_user_template_offsets_v1")}).strict();async function el(i,n){let t=B.parse(i);return Zm.parse({schemaVersion:"openpond.neuronTrainingEncoding.v1",implementation:"supervised_trainer.prepare_example.v1",modelHash:await u(t),tokenizerHash:t.tokenizerHash,maxSequenceLength:n,completionOnly:!0,enableThinking:!1,truncation:"left_prompt_preserve_final_target_v1",selectionBoundaries:"verified_last_user_template_offsets_v1"})}d(el,"neuronTrainingEncoding");async function Zt(i){A(i,131072);let n=An.parse(i),t=await u(await el(n.model,n.training.maxSequenceLength));if([n.data.target,...n.data.background,...n.data.preservation?[n.data.preservation]:[]].some(a=>a.encodingHash!==t))throw new h("neuron_training_encoding_mismatch","The reviewed batches differ from the exact native supervised encoding.");return n}d(Zt,"parseAndVerifyNeuronTrainingRequest");var be=e.string().regex(/^[a-f0-9]{64}$/),Fs=e.object({implementation:e.literal("openpond_qwen3_selective_columns_v1"),upstream:e.literal("changjonathanc/neuron-tuning"),revision:e.literal(Ns),license:e.literal("Apache-2.0"),hook:e.literal("mlp.down_proj"),operation:e.literal("output_plus_selected_input_times_delta_v1"),parameterization:e.literal("column_gain_rms_direction_v1"),activityQuantile:e.literal(.9),backgroundFloor:e.literal(1e-6),gradientSubsetSeed:e.literal(0),optimizer:e.literal("Adam"),betas:e.tuple([e.literal(.9),e.literal(.999)]),epsilon:e.literal(1e-8),weightDecay:e.literal(0),gradientClipNorm:e.literal(1),batchSize:e.literal(1),parameterDtype:e.literal("float32"),resume:e.literal("unsupported")}).strict();function Lb(){return Fs.parse({implementation:"openpond_qwen3_selective_columns_v1",upstream:"changjonathanc/neuron-tuning",revision:Ns,license:"Apache-2.0",hook:"mlp.down_proj",operation:"output_plus_selected_input_times_delta_v1",parameterization:"column_gain_rms_direction_v1",activityQuantile:.9,backgroundFloor:1e-6,gradientSubsetSeed:0,optimizer:"Adam",betas:[.9,.999],epsilon:1e-8,weightDecay:0,gradientClipNorm:1,batchSize:1,parameterDtype:"float32",resume:"unsupported"})}d(Lb,"neuronTrainingAlgorithm");var tl=$s.extend({targetMeanAbsolute:e.number().finite().positive(),backgroundMeanAbsolute:e.number().finite().nonnegative(),backgroundTargetRatio:e.number().finite().nonnegative(),gradientNorm:e.number().finite().nonnegative(),score:e.number().finite().nonnegative(),targetActivityThreshold:e.number().finite().nonnegative(),backgroundByDomain:e.array(e.object({domainIndex:e.number().int().min(0).max(7),meanAbsolute:e.number().finite().nonnegative()}).strict()).min(1).max(8)}).strict(),nl=e.object({schemaVersion:e.literal("openpond.neuronTrainingSelectionResult.v1"),modelHash:be,dataHash:be,selectionConfigHash:be,preparedRowsHash:be,source:e.enum(["automatic","explicit"]),targetExampleIds:e.array(e.string().min(1).max(200)).min(1).max(64),eligibleCount:e.number().int().min(1).max(442368),entries:e.array(tl).min(1).max(128)}).strict(),Ha=nl.extend({contentHash:be});function hn(){throw new h("neuron_training_artifact_mismatch","The learned patch differs from its exact base, verified selection, data, settings or tensor inventory.")}d(hn,"fail");var ci=d((i,n)=>Math.abs(i-n)<=1e-6*Math.max(1,Math.abs(i),Math.abs(n)),"close");async function al(i,n){let t=Ha.parse(i),{contentHash:a,...r}=t,s=t.entries.map(({layer:o,neuron:c})=>({layer:o,neuron:c}));(a!==await u(r)||t.modelHash!==await u(n.model)||t.dataHash!==await u(n.data)||t.selectionConfigHash!==await u(n.selection)||t.entries.length!==n.selection.count||t.eligibleCount<t.entries.length||new Set(t.entries.map(o=>`${o.layer}:${o.neuron}`)).size!==t.entries.length||new Set(t.targetExampleIds).size!==t.targetExampleIds.length||t.targetExampleIds.length>n.selection.gradientExamples||t.source!==(n.selection.explicitCoordinates?"explicit":"automatic")||n.selection.explicitCoordinates&&m(s)!==m(n.selection.explicitCoordinates))&&hn(),t.source==="automatic"&&t.entries.some((o,c)=>{let l=t.entries[c-1];return l&&(o.score>l.score||o.score===l.score&&(o.layer<l.layer||o.layer===l.layer&&o.neuron<l.neuron))})&&hn();for(let o of t.entries){(o.targetMeanAbsolute<o.targetActivityThreshold||o.backgroundTargetRatio>n.selection.maximumBackgroundTargetRatio+1e-6||!ci(o.backgroundTargetRatio,o.backgroundMeanAbsolute/o.targetMeanAbsolute)||!ci(o.score,o.gradientNorm/Math.max(o.backgroundMeanAbsolute,1e-6))||m(o.backgroundByDomain.map(l=>l.domainIndex))!==m(n.data.background.map((l,p)=>p)))&&hn();let c=n.selection.backgroundStatistic==="max_domains"?Math.max(...o.backgroundByDomain.map(l=>l.meanAbsolute)):o.backgroundByDomain.reduce((l,p)=>l+p.meanAbsolute,0)/o.backgroundByDomain.length;ci(c,o.backgroundMeanAbsolute)||hn()}return t}d(al,"parseAndVerifyNeuronTrainingSelection");var il=e.object({name:e.string().regex(/^layer(?:[0-9]|[12][0-9]|3[0-5])\.(?:indices|delta)$/),dtype:e.enum(["I64","F32"]),shape:e.array(e.number().int().positive().max(4096)).min(1).max(2)}).strict();function rl(i){let n=new Map;for(let t of Ha.parse(i).entries)n.set(t.layer,(n.get(t.layer)??0)+1);return[...n].flatMap(([t,a])=>[{name:`layer${t}.indices`,dtype:"I64",shape:[a]},{name:`layer${t}.delta`,dtype:"F32",shape:[4096,a]}]).sort((t,a)=>t.name<a.name?-1:t.name>a.name?1:0)}d(rl,"neuronTrainingPatchTensorInventory");var ol=e.object({schemaVersion:e.literal("openpond.neuronTrainingArtifact.v1"),method:e.literal("selective_neuron_training"),algorithm:Fs,pins:e.object({baseModel:B,inputHash:be,data:Bs,dataHash:be,selectionConfigHash:be,trainingConfigHash:be,runtimeHash:be,parentArtifactHash:e.null()}).strict(),selection:Ha,payload:e.object({path:e.literal("patch.safetensors"),sha256:be,sizeBytes:e.number().int().positive().max(mr),tensors:e.array(il).min(2).max(72)}).strict()}).strict(),Os=ol.extend({contentHash:be});async function Ls(i,n){A(i,262144);let t=Os.parse(i),{contentHash:a,...r}=t,s=await Zt(n.request);return await al(t.selection,s),(a!==await u(r)||m(t.pins.baseModel)!==m(s.model)||m(t.pins.data)!==m(s.data)||t.pins.inputHash!==await u(s)||t.pins.dataHash!==await u(s.data)||t.pins.selectionConfigHash!==await u(s.selection)||t.pins.trainingConfigHash!==await u(s.training)||t.pins.runtimeHash!==n.runtimeHash||m(t.payload.tensors)!==m(rl(t.selection))||t.payload.sizeBytes>s.training.maxCheckpointBytes)&&hn(),t}d(Ls,"parseAndVerifyNeuronTrainingArtifact");var Pe=e.string().regex(/^[a-f0-9]{64}$/),ke=e.number().int().nonnegative().max(1e8),sl=e.object({selectionTarget:ke,selectionBackground:ke,selectionGradient:ke,training:ke,preservationOriginal:ke,preservationEdited:ke,verification:ke}).strict(),cl=e.object({schemaVersion:e.literal("openpond.neuronTrainingResult.v1"),inputHash:Pe,modelHash:Pe,runtimeHash:Pe,dataHash:Pe,preparedRowsHash:Pe,selection:Ha,optimizerSteps:e.number().int().min(1).max(128),examplesProcessed:e.number().int().min(1).max(4096),targetTokens:e.number().int().positive().max(33554432),preservationTokens:ke,work:sl,forwardTokenWork:ke,backwardTokenWork:ke,durationMs:e.number().finite().nonnegative().max(216e5),meanLoss:e.number().finite().nonnegative(),finalLoss:e.number().finite().nonnegative(),meanPreservationKl:e.number().finite().nonnegative().nullable(),baseWeightsHashBefore:Pe,baseWeightsHashAfter:Pe,baseOptimizerParameterCount:e.literal(0),baseGradientParameterCount:e.literal(0),trainableParameterCount:e.number().int().min(4097).max(524416),artifact:e.object({id:e.string().min(1).max(500),contentHash:Pe,manifest:Os,files:e.array(e.object({path:e.enum(["manifest.json","patch.safetensors"]),artifactId:e.string().min(1).max(500),sha256:Pe,sizeBytes:e.number().int().positive().max(mr)}).strict()).length(2)}).strict()}).strict(),ur=cl.extend({contentHash:Pe});async function dl(i,n){A(i,1048576);let t=await Zt(n.request),a=ur.parse(i),{contentHash:r,...s}=a,o=await Ls(a.artifact.manifest,{request:t,runtimeHash:n.runtimeHash}),c=a.artifact.files.find(p=>p.path==="patch.safetensors"),l=a.artifact.files.find(p=>p.path==="manifest.json");if(r!==await u(s)||a.inputHash!==await u(t)||a.modelHash!==await u(t.model)||a.dataHash!==await u(t.data)||a.runtimeHash!==n.runtimeHash||a.preparedRowsHash!==a.selection.preparedRowsHash||m(a.selection)!==m(o.selection)||a.artifact.contentHash!==o.contentHash||a.baseWeightsHashBefore!==t.model.weightsHash||a.baseWeightsHashAfter!==a.baseWeightsHashBefore||a.trainableParameterCount!==t.selection.count*(t.model.hiddenSize+1)||a.optimizerSteps!==t.training.maxSteps||a.examplesProcessed!==a.optimizerSteps*t.training.gradientAccumulationSteps||a.durationMs>t.training.maxDurationSeconds*1e3||a.forwardTokenWork>t.training.maximumForwardTokenWork||a.forwardTokenWork!==Object.values(a.work).reduce((p,g)=>p+g,0)||a.backwardTokenWork!==a.work.selectionGradient+a.work.training+a.work.preservationEdited||a.targetTokens>a.work.training||a.work.selectionTarget<=0||a.work.selectionBackground<=0||a.work.selectionGradient!==a.work.selectionTarget||a.work.verification<=0||t.training.preservationWeight>0!=(a.meanPreservationKl!==null)||a.work.preservationOriginal!==a.work.preservationEdited||t.training.preservationWeight===0&&(a.preservationTokens!==0||a.work.preservationOriginal!==0)||t.training.preservationWeight>0&&(a.preservationTokens<=0||a.work.preservationOriginal<=0)||!c||!l||c.sha256!==o.payload.sha256||c.sizeBytes!==o.payload.sizeBytes||l.sha256!==await u(o)||l.sizeBytes!==new TextEncoder().encode(m(o)).byteLength||a.artifact.files.some(p=>p.artifactId!==a.artifact.id)||a.artifact.files.reduce((p,g)=>p+g.sizeBytes,0)>t.training.maxCheckpointBytes)throw new h("neuron_training_result_mismatch","The selective neuron result differs from its exact run, measured work, frozen base or committed learned patch.");return a}d(dl,"parseAndVerifyNeuronTrainingResult");var ml=e.string().trim().min(1).max(240),zo=e.string().regex(/^[a-f0-9]{64}$/),pr=e.object({modelProjectId:ml,versionHash:zo,artifact:wa,modelHash:zo}).strict(),Rt=Yt.parse({schemaVersion:"openpond.alphaEditConfig.v1",implementation:"openpond_qwen_alphaedit_v1",sourceRevision:Es,rewriteModule:"mlp.down_proj.weight",factToken:"subject_last",layers:[27,28,29],lossLayer:31,contextTemplateGroups:[["{}"]],nullspaceThreshold:.02,l2:10,covariance:"non_padding_uncentered_second_moment_fp32_v1",projector:"covariance_svd_below_absolute_threshold_v1",sequentialState:"post_edit_group_mean_keys_outer_product_sum_v1",targetTokenization:"leading_space_no_special_tokens_v1"}),ll=cr.parse({maxSteps:25,learningRate:.1,klFactor:.0625,latentWeightDecay:.5,clampNormFactor:.75,maxSequenceLength:2048,maxDurationSeconds:3600,maxForwardTokenWork:16e6,maxCheckpointBytes:8589934592,seed:42}),ce=e.string().max(100),ul=e.object({layers:e.string().max(200),lossLayer:ce,contextTemplateGroups:e.string().max(65536),nullspaceThreshold:ce,l2:ce}).strict(),pl=e.object({maxSteps:ce,learningRate:ce,klFactor:ce,latentWeightDecay:ce,clampNormFactor:ce,maxSequenceLength:ce,maxDurationSeconds:ce,maxForwardTokenWork:ce,maxCheckpointBytes:ce,seed:ce}).strict(),ut=e.object({baseModel:T.nullable(),editsBatch:F.nullable(),preservationBatch:F.nullable(),name:e.string().max(500),maximumSpendUsd:ce,config:ul,training:pl,parentArtifact:wa.nullable(),startingModule:pr.optional()}).strict();function Jb(i=null){return ut.parse({baseModel:i,editsBatch:null,preservationBatch:null,name:"",maximumSpendUsd:"",config:{layers:Rt.layers.join(", "),lossLayer:String(Rt.lossLayer),contextTemplateGroups:JSON.stringify(Rt.contextTemplateGroups),nullspaceThreshold:String(Rt.nullspaceThreshold),l2:String(Rt.l2)},training:Object.fromEntries(Object.entries(ll).map(([n,t])=>[n,String(t)])),parentArtifact:null})}d(Jb,"newAlphaEditExperimentForm");var Hn=e.string().trim().min(1).max(500),fa=e.string().regex(/^[a-f0-9]{64}$/),Cn=e.enum(["source_validated","gpu_qualified"]);function qn(i,n){if(i.state==="ready"!=(n!==null))throw new h("model_modification_validation_mismatch","Runtime validation must describe the observed executable runtime.")}d(qn,"assertModelModificationValidationLevel");var Oe=e.enum(["neuron_steering","inspect_activations"]),Ue=e.object({teamId:Hn,modelId:T.shape.modelId,source:T.shape.source,revision:T.shape.revision.unwrap().optional(),tokenizerRevision:T.shape.tokenizerRevision.unwrap().optional(),chatTemplateHash:T.shape.chatTemplateHash.unwrap().optional(),modelAssetId:T.shape.modelAssetId.unwrap().optional()}).strict(),hl=e.discriminatedUnion("state",[e.object({state:e.literal("unavailable"),code:e.enum(["model_not_supported","runtime_not_qualified"]),reason:e.string().trim().min(1).max(1e3)}).strict(),e.object({state:e.literal("ready"),model:B,runtime:e.object({id:Hn,releaseHash:fa,imageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),requestSchema:e.literal("openpond.activationReferenceRequest.v1"),evidence:e.object({id:Hn,contentHash:fa}).strict()}).strict(),limits:e.object({maximumPrompts:e.number().int().positive().max(8),maximumPromptTokens:e.number().int().positive().max(4096),maximumVariants:e.number().int().positive().max(17),maximumCoordinates:e.number().int().positive().max(64),maximumNewTokens:e.number().int().nonnegative().max(128),maximumCapturedValues:e.number().int().positive().max(65536),maximumForwardTokenWork:e.number().int().positive().max(1e6),maximumDurationSeconds:e.number().positive().max(300),maximumAbsoluteDose:e.number().finite().positive()}).strict()}).strict()]),gl=e.object({schemaVersion:e.literal("openpond.modelModificationCapabilities.v1"),teamId:Hn,actorId:Hn,query:Ue,requestHash:fa,destination:e.literal("hosted"),checkedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),methods:e.array(e.object({method:Oe,draftSchema:e.literal("openpond.experimentDraft.v1"),validationLevel:Cn.nullable(),execution:hl}).strict()).length(2)}).strict().superRefine((i,n)=>{(i.teamId!==i.query.teamId||new Set(i.methods.map(t=>t.method)).size!==2)&&n.addIssue({code:"custom",message:"Capabilities must retain one entry per method and the exact workspace."});for(let t of i.methods)t.execution.state==="ready"&&(i.query.source!=="managed"||i.query.modelAssetId!==void 0||t.execution.model.modelId!==i.query.modelId||t.execution.model.revision!==i.query.revision||!i.query.tokenizerRevision)&&n.addIssue({code:"custom",message:"An executable capability must bind this exact admitted managed base."})}),fl=gl.safeExtend({contentHash:fa});async function vl(i,n,t){let a=Ue.parse(n),r=fl.parse(i);for(let p of r.methods)qn(p.execution,p.validationLevel);let{contentHash:s,...o}=r;if(m(r.query)!==m(a)||r.requestHash!==await u(a)||r.teamId!==a.teamId||t!==void 0&&r.actorId!==t||s!==await u(o))throw new h("model_modification_capability_mismatch","Capabilities returned a different model, account or retained observation.");let c=Date.parse(r.checkedAt),l=Date.parse(r.expiresAt);if(c>Date.now()+3e4||l<=Date.now()||l<=c||l-c>3e5)throw new h("model_modification_capability_expired","Refresh model capabilities before preparing execution.");return r}d(vl,"parseAndVerifyModelModificationCapabilities");function bl(i){return{async modificationCapabilities(n,t){let a=Ue.parse(n),r=new URLSearchParams;for(let[o,c]of Object.entries(a))c!==void 0&&r.set(o,c);let s=AbortSignal.timeout(3e4);return vl(await i(`/v1/training/modification-capabilities?${r}`,{signal:t?.signal?AbortSignal.any([t.signal,s]):s}),a)}}}d(bl,"createModelModificationCapabilitiesClient");var vn=e.string().trim().min(1).max(500),Ye=e.string().trim().min(1).max(240),X=e.string().regex(/^[a-f0-9]{64}$/),Il=e.url().max(2e3).refine(i=>{try{let n=new URL(i);return(n.protocol==="https:"||n.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(n.hostname))&&!n.username&&!n.password&&!n.search&&!n.hash&&n.origin===i}catch{return!1}},"Use a canonical HTTPS API origin, or an explicit loopback development origin."),zn={location:e.literal("cloud"),apiOrigin:Il,owner:e.object({teamId:Ye,actorId:Ye}).strict(),projectId:Ye.nullable()},Sl=e.object({...zn,kind:e.literal("training_result"),jobId:vn,modelProjectId:vn,portableProjectId:vn,submissionHash:X,candidate:e.lazy(()=>Ki.omit({registryArtifactId:!0})),executionReceipt:j}).strict().superRefine((i,n)=>{i.candidate.composition==="base"!=(i.candidate.parent===null)&&n.addIssue({code:"custom",path:["candidate","parent"],message:"The candidate composition must retain its exact parent checkpoint."})}),Ws=e.object({...zn,kind:e.literal("managed_modification_result"),executionId:Ye,method:Oe,inputHash:X,runtimeHash:X,resultHash:X}).strict(),xl=e.object({...zn,kind:e.literal("engram_result"),executionId:Ye,inputHash:X,runtimeHash:X,resultHash:X,artifact:e.object({id:Ye,contentHash:X}).strict()}).strict(),yl=e.object({...zn,kind:e.literal("decision_result"),mode:e.enum(["train","score"]),executionId:Ye,inputHash:X,modelHash:X,runtimeHash:X,resultHash:X,artifact:e.object({id:vn,contentHash:X}).strict().nullable()}).strict().superRefine((i,n)=>{i.mode==="train"&&i.artifact===null&&n.addIssue({code:"custom",path:["artifact"],message:"A trained decision result must retain its exact committed artifact."})}),Gs={...zn,executionId:Ye,inputHash:X,modelHash:X,runtimeHash:X,resultHash:X,artifact:e.object({id:vn,contentHash:X}).strict()},wl=e.object({...Gs,kind:e.literal("alphaedit_result")}).strict(),_l=e.object({...Gs,kind:e.literal("neuron_training_result")}).strict(),Yb=e.discriminatedUnion("kind",[Sl,Ws,xl,yl,wl,_l]),Do=e.string().trim().min(1).max(240),ma=e.string().regex(/^[a-f0-9]{64}$/),Js=e.object({modelProjectId:Do,versionHash:ma,artifact:e.object({id:Do,contentHash:ma}).strict(),modelHash:ma}).strict(),Hl=_n.parse({count:8,span:"reply_prediction",backgroundStatistic:"max_domains",maximumBackgroundTargetRatio:.2,gradientExamples:16,explicitCoordinates:null}),jl=lr.parse({learningRate:.03,maxSteps:32,gradientAccumulationSteps:1,maxSequenceLength:2048,preservationWeight:0,preservationExamplesPerStep:0,seed:42,maxDurationSeconds:3600,maxCheckpointBytes:16777216,maximumForwardTokenWork:16e6}),de=e.string().max(100),Tl=e.object({count:de,span:_n.shape.span,backgroundStatistic:_n.shape.backgroundStatistic,maximumBackgroundTargetRatio:de,gradientExamples:de,coordinates:e.string().max(1e4)}).strict(),Ml=e.object({learningRate:de,maxSteps:de,gradientAccumulationSteps:de,maxSequenceLength:de,preservationWeight:de,preservationExamplesPerStep:de,seed:de,maxDurationSeconds:de,maxCheckpointBytes:de,maximumForwardTokenWork:de}).strict(),Rl=e.object({result:Ws,modelHash:ma}).strict(),Dn=e.object({baseModel:T.nullable(),targetBatch:F.nullable(),background:e.array(e.object({domain:e.string().max(100),batch:F.nullable()}).strict()).max(8),preservationBatch:F.nullable(),name:e.string().max(500),maximumSpendUsd:de,selection:Tl,training:Ml,parentArtifact:e.null(),inspectionSource:Rl.optional()}).strict();function Zb(i=null){let n=Hl;return Dn.parse({baseModel:i,targetBatch:null,background:[{domain:"background",batch:null}],preservationBatch:null,name:"",maximumSpendUsd:"",parentArtifact:null,selection:{count:String(n.count),span:n.span,backgroundStatistic:n.backgroundStatistic,maximumBackgroundTargetRatio:String(n.maximumBackgroundTargetRatio),gradientExamples:String(n.gradientExamples),coordinates:""},training:Object.fromEntries(Object.entries(jl).map(([t,a])=>[t,String(a)]))})}d(Zb,"newNeuronTrainingExperimentForm");var Se=e.string().trim().min(1).max(240),De=e.string().regex(/^[a-f0-9]{64}$/),Qs={teamId:Se,ownerUserId:Se,modelProjectId:Se,portableProjectId:Se,baseModel:T,source:e.object({executionId:Se,inputHash:De,runtimeHash:De,resultHash:De}).strict(),createdAt:e.iso.datetime()},El=e.object({...Qs,schemaVersion:e.literal("openpond.alphaEditModelVersion.v1"),request:it,artifact:dr.shape.artifact}).strict(),Un=El.extend({contentHash:De}),Pl=e.object({...Qs,schemaVersion:e.literal("openpond.neuronTrainingModelVersion.v1"),request:An,artifact:ur.shape.artifact}).strict(),Vn=Pl.extend({contentHash:De});function Nn(){throw new h("weight_model_version_mismatch","The saved Model differs from its exact learned weights, source or committed artifact.")}d(Nn,"fail2");async function Ks(i,n){let{contentHash:t,...a}=i;(t!==await u(a)||n.teamId!==void 0&&i.teamId!==n.teamId||n.modelProjectId!==void 0&&i.modelProjectId!==n.modelProjectId||n.ownerUserId!==void 0&&i.ownerUserId!==n.ownerUserId||i.baseModel.source!=="managed"||i.baseModel.modelAssetId!==null||i.baseModel.modelId!==i.request.model.modelId||i.baseModel.revision!==i.request.model.revision||!i.baseModel.tokenizerRevision||i.source.inputHash!==await u(i.request)||i.artifact.contentHash!==i.artifact.manifest.contentHash)&&Nn()}d(Ks,"verifyEnvelope");async function Xs(i,n,t,a){let r=m(n),s=[{path:"manifest.json",sha256:await u(n),sizeBytes:new TextEncoder().encode(r).byteLength},...t];(s[0].sizeBytes>262144||i.files.length!==s.length||new Set(i.files.map(o=>o.path)).size!==s.length||i.files.some(o=>o.artifactId!==i.id)||i.files.reduce((o,c)=>o+c.sizeBytes,0)>a||s.some(o=>!i.files.some(c=>c.path===o.path&&c.sha256===o.sha256&&c.sizeBytes===o.sizeBytes)))&&Nn()}d(Xs,"verifyFiles");async function rt(i,n={}){let t=Un.parse(i);await Ks(t,n);let a=await Vs(t.artifact.manifest,{request:t.request,runtimeHash:t.source.runtimeHash});return await Xs(t.artifact,a,[a.payloads.patch,...a.payloads.state],t.request.training.maxCheckpointBytes),t}d(rt,"parseAndVerifyAlphaEditModelVersion");async function xt(i,n={}){let t=Vn.parse(i);await Ks(t,n);let a=await Ls(t.artifact.manifest,{request:t.request,runtimeHash:t.source.runtimeHash});return await Xs(t.artifact,a,[a.payload],t.request.training.maxCheckpointBytes),t}d(xt,"parseAndVerifyNeuronTrainingModelVersion");async function kl(i,n,t={}){let a=pr.parse(i),r=await rt(n,{...t,modelProjectId:a.modelProjectId});return(r.contentHash!==a.versionHash||r.artifact.id!==a.artifact.id||r.artifact.contentHash!==a.artifact.contentHash||await u(r.request.model)!==a.modelHash)&&Nn(),r}d(kl,"verifySavedAlphaEditExperimentSource");async function Al(i,n,t={}){let a=Js.parse(i),r=await xt(n,{...t,modelProjectId:a.modelProjectId});return(r.contentHash!==a.versionHash||r.artifact.id!==a.artifact.id||r.artifact.contentHash!==a.artifact.contentHash||await u(r.request.model)!==a.modelHash)&&Nn(),r}d(Al,"verifySavedNeuronTrainingExperimentSource");var Dt=e.object({teamId:Se,operationId:Se,executionId:Se,resultHash:De,artifactHash:De,name:e.string().trim().min(1).max(200),modelProjectId:Se.nullable(),expectedModelRevision:e.number().int().nonnegative()}).strict().refine(i=>i.modelProjectId?i.expectedModelRevision>0:i.expectedModelRevision===0,{message:"Retain the existing Model revision or create a new Model."}),eI=Dt,tI=Dt,Ys={teamId:Se,actorId:Se,operationId:Se,requestHash:De,model:ye},Cl=e.object({...Ys,schemaVersion:e.literal("openpond.alphaEditResultSaveReceipt.v1"),version:Un}).strict(),ql=Cl.extend({contentHash:De}),zl=e.object({...Ys,schemaVersion:e.literal("openpond.neuronTrainingResultSaveReceipt.v1"),version:Vn}).strict(),Dl=zl.extend({contentHash:De});async function Zs(i,n){let{contentHash:t,...a}=i;(t!==await u(a)||i.teamId!==n.teamId||i.model.teamId!==n.teamId||i.operationId!==n.operationId||i.requestHash!==await u(n)||i.version.source.executionId!==n.executionId||i.version.source.resultHash!==n.resultHash||i.version.artifact.contentHash!==n.artifactHash||i.model.name!==n.name||i.model.revision!==n.expectedModelRevision+1||n.modelProjectId!==null&&i.model.id!==n.modelProjectId||i.version.portableProjectId!==i.model.portableProjectId)&&Nn()}d(Zs,"verifySave");async function Ul(i,n){let t=Dt.parse(n),a=ql.parse(i);return await rt(a.version,{teamId:t.teamId,modelProjectId:a.model.id,ownerUserId:a.actorId}),await Zs(a,t),a}d(Ul,"parseAndVerifyAlphaEditResultSaveReceipt");async function Vl(i,n){let t=Dt.parse(n),a=Dl.parse(i);return await xt(a.version,{teamId:t.teamId,modelProjectId:a.model.id,ownerUserId:a.actorId}),await Zs(a,t),a}d(Vl,"parseAndVerifyNeuronTrainingResultSaveReceipt");function Nl(i){let n=d(t=>i(`/v1/training/modification-executions/${encodeURIComponent(t.executionId)}/model`,{method:"POST",body:m(t)}),"save");return{async saveAlphaEditResultModel(t){let a=Dt.parse(t);return Ul(await n(a),a)},async saveNeuronTrainingResultModel(t){let a=Dt.parse(t);return Vl(await n(a),a)}}}d(Nl,"createWeightModelClient");var _=e.string().trim().min(1).max(240),se=e.string().regex(/^[a-f0-9]{64}$/),ec=e.object({schemaVersion:e.literal("openpond.steeringProfilePublication.v1"),id:_,revision:e.literal(1),teamId:_,ownerUserId:_,projectId:_.nullable(),name:e.string().trim().min(1).max(200),baseModel:T,profile:$i,source:e.object({executionId:_,inputHash:se,runtimeHash:se,resultHash:se,variantId:_}).strict(),calibrationEvidence:e.array(e.object({promptId:_,calibration:bs.shape.calibration}).strict()).min(1).max(8),createdAt:e.iso.datetime()}).strict(),hr=ec.extend({contentHash:se}).strict();async function tc(i,n={}){let t=hr.parse(i),{contentHash:a,...r}=t;if(await Zo(t.profile),a!==await u(r)||n.teamId&&t.teamId!==n.teamId||n.ownerUserId&&t.ownerUserId!==n.ownerUserId||n.id&&t.id!==n.id||t.baseModel.modelId!==t.profile.model.modelId||t.baseModel.revision!==t.profile.model.revision||new Set(t.calibrationEvidence.map(s=>s.promptId)).size!==t.calibrationEvidence.length)throw new h("steering_publication_mismatch","The immutable steering profile differs from its exact source or workspace.");return t}d(tc,"parseAndVerifySteeringProfilePublication");var $l=e.object({schemaVersion:e.literal("openpond.steeringModelVersion.v1"),teamId:_,modelProjectId:_,portableProjectId:_,publication:hr,createdAt:e.iso.datetime()}).strict(),$n=$l.extend({contentHash:se}).strict(),nc=e.discriminatedUnion("schemaVersion",[St,$n,Tn,Xt,Un,Vn]);async function ot(i,n={}){let t=nc.parse(i);if(t.schemaVersion==="openpond.trainingModelVersion.v1")return Jt(t,n);if(t.schemaVersion==="openpond.engramModelVersion.v1")return bt(t,n);if(t.schemaVersion==="openpond.decisionModelVersion.v1")return Fe(t,n);if(t.schemaVersion==="openpond.alphaEditModelVersion.v1")return rt(t,n);if(t.schemaVersion==="openpond.neuronTrainingModelVersion.v1")return xt(t,n);let{contentHash:a,...r}=t;if(await tc(t.publication,n),a!==await u(r)||t.teamId!==t.publication.teamId||n.teamId&&t.teamId!==n.teamId||n.modelProjectId&&t.modelProjectId!==n.modelProjectId)throw new h("saved_model_version_mismatch","The saved steering Model version differs from its immutable publication.");return t}d(ot,"parseAndVerifySavedModelVersion");var Bl=e.object({schemaVersion:e.literal("openpond.steeringProfileRecord.v1"),publication:hr,revision:e.number().int().positive(),archived:e.boolean(),updatedAt:e.iso.datetime()}).strict(),ac=Bl.extend({contentHash:se}).strict();async function ic(i,n={}){let t=ac.parse(i),{contentHash:a,...r}=t;if(await tc(t.publication,n),a!==await u(r))throw new h("steering_profile_record_mismatch","The retained profile record changed.");return t}d(ic,"parseAndVerifySteeringProfileRecord");var Fl=e.object({teamId:_,operationId:_,executionId:_,variantId:_,resultHash:se,profileHash:se,name:e.string().trim().min(1).max(200),modelProjectId:_.nullable(),expectedModelRevision:e.number().int().nonnegative()}).strict().refine(i=>i.modelProjectId?i.expectedModelRevision>0:i.expectedModelRevision===0,{message:"Retain the exact existing Model revision, or create a new Model."}),Ol=e.object({teamId:_,operationId:_,expectedRevision:e.number().int().positive(),contentHash:se}).strict(),Ll=e.object({schemaVersion:e.literal("openpond.steeringProfileReceipt.v1"),teamId:_,actorId:_,operationId:_,requestHash:se,record:ac,model:ye.nullable(),version:$n.nullable()}).strict(),Wl=Ll.extend({contentHash:se}).strict();async function Uo(i,n,t){let a=Wl.parse(i),{contentHash:r,...s}=a;await ic(a.record,{teamId:n.teamId,ownerUserId:a.actorId,id:t});let o="executionId"in n;if(r!==await u(s)||a.teamId!==n.teamId||a.operationId!==n.operationId||a.requestHash!==await u(o?n:{id:t,request:n}))throw new h("steering_profile_receipt_mismatch","Retry the original steering Model command.");if(o){let c=a.record.publication;if(!a.model||!a.version||c.source.executionId!==n.executionId||c.source.variantId!==n.variantId||c.source.resultHash!==n.resultHash||c.profile.contentHash!==n.profileHash||c.name!==n.name||a.model.name!==n.name||n.modelProjectId&&a.model.id!==n.modelProjectId||a.model.revision!==n.expectedModelRevision+1)throw new h("steering_profile_receipt_mismatch","The saved Model differs from the selected result variant.");if(await ot(a.version,{teamId:n.teamId,modelProjectId:a.model.id}),m(a.version.publication)!==m(c))throw new h("steering_profile_receipt_mismatch","The Model version has a different publication.")}else if(!a.record.archived||a.record.revision!==n.expectedRevision+1||a.record.publication.contentHash!==n.contentHash||a.model||a.version)throw new h("steering_profile_receipt_mismatch","The archive receipt differs from its original immutable profile.");return a}d(Uo,"parseAndVerifySteeringProfileReceipt");var rc=e.object({projectId:_.optional(),modelProjectId:_.optional(),archived:e.boolean().default(!1),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),Gl=e.object({id:_,teamId:_,ownerUserId:_,projectId:_.nullable(),modelProjectId:_,name:e.string().min(1).max(200),publicationHash:se,profileHash:se,baseModel:T,source:ec.shape.source,revision:e.number().int().positive(),archived:e.boolean(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}).strict(),nI=e.object({teamId:_}).strict(),Jl=e.object({schemaVersion:e.literal("openpond.steeringProfilePage.v1"),teamId:_,ownerUserId:_,query:rc,items:e.array(Gl).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),Ql=Jl.extend({contentHash:se}).strict(),Kl=e.object({schemaVersion:e.literal("openpond.savedModelVersionRead.v1"),teamId:_,model:ye,version:nc.nullable()}).strict();async function Xl(i,n,t,a){let r=Kl.parse(i);if(r.teamId!==n||r.model.teamId!==n||r.model.id!==t)throw new h("saved_model_version_mismatch","Choose this Model's workspace.");if(a!==void 0&&r.version?.contentHash!==a)throw new h("saved_model_version_mismatch","The response differs from the exact saved Model version.");if(r.version&&(await ot(r.version,{teamId:n,modelProjectId:t}),r.version.portableProjectId!==r.model.portableProjectId))throw new h("saved_model_version_mismatch","The saved version belongs to another Model.");return r}d(Xl,"parseAndVerifySavedModelVersionRead");function Yl(i){return{async saveModificationResultModel(n){let t=Fl.parse(n);return Uo(await i("/v1/training/steering-profiles",{method:"POST",body:JSON.stringify(t)}),t)},async getSteeringProfile(n,t){return ic(await i(`/v1/training/steering-profiles/${encodeURIComponent(_.parse(t))}?${new URLSearchParams({teamId:_.parse(n)})}`),{teamId:n,id:t})},async archiveSteeringProfile(n,t){let a=Ol.parse(t);return Uo(await i(`/v1/training/steering-profiles/${encodeURIComponent(_.parse(n))}/archive`,{method:"POST",body:JSON.stringify(a)}),a,n)},async listSteeringProfiles(n,t={}){let a=Object.fromEntries(Object.entries(rc.parse(t)).filter(([,l])=>l!==void 0)),r=new URLSearchParams({teamId:_.parse(n)});for(let[l,p]of Object.entries(a))p!==void 0&&r.set(l,String(p));let s=Ql.parse(await i(`/v1/training/steering-profiles?${r}`)),{contentHash:o,...c}=s;if(s.teamId!==n||m(s.query)!==m(a)||o!==await u(c)||s.items.length>a.limit||new Set(s.items.map(l=>l.id)).size!==s.items.length||s.nextCursor!==null&&(s.items.length!==a.limit||s.nextCursor===a.cursor))throw new h("steering_profile_page_mismatch","Refresh this profile history.");for(let[l,p]of s.items.entries())if(p.teamId!==n||p.ownerUserId!==s.ownerUserId||a.projectId&&p.projectId!==a.projectId||a.modelProjectId&&p.modelProjectId!==a.modelProjectId||p.archived!==a.archived||l&&s.items[l-1].id>=p.id)throw new h("steering_profile_page_mismatch","The profile list scope changed.");return s},async modelVersion(n,t){let a=new URLSearchParams({teamId:_.parse(t.teamId)});return t.versionHash!==void 0&&a.set("versionHash",se.parse(t.versionHash)),Xl(await i(`/v1/training/models/${encodeURIComponent(_.parse(n))}/version?${a}`),t.teamId,n,t.versionHash)}}}d(Yl,"createSteeringProfileClient");var O=e.string().trim().min(1).max(191),pt=e.string().regex(/^[a-f0-9]{64}$/),Zl=e.object({jobId:O,artifact:e.object({id:O,contentHash:pt}).strict(),checkpointId:O,adapterMode:e.enum(["residual_append","shared","sequential_merge"])}).strict(),Ut=e.object({schemaVersion:e.literal("openpond.trainingPreparationRequest.v1"),teamId:O,operationId:O,projectId:O.nullable(),configuration:e.object({id:O,expectedRevision:e.number().int().positive(),expectedEtag:pt}).strict(),origin:Vr.optional(),parent:Zl.optional(),batch:F,name:e.string().trim().min(1).max(191),maximumSpendUsd:e.number().finite().positive().max(1e6),usageFunding:Yr.optional(),gpuSelection:dn.optional(),physicalPlacement:no.optional()}).strict(),eu=e.object({schemaVersion:e.literal("openpond.trainingPreparationPlan.v1"),id:O,creatorUserId:O,request:Ut,requestHash:pt,source:e.lazy(()=>Ja),submissionHash:pt,usageQuote:Zr.optional(),createdAt:e.string().datetime({offset:!0})}).strict(),tu=eu.extend({contentHash:pt}).strict(),gr=e.object({schemaVersion:e.literal("openpond.trainingPreparationReceipt.v1"),plan:tu,revision:e.number().int().positive(),state:e.enum(["prepared","submitted","cancelled"]),jobId:O.nullable()}).strict().superRefine((i,n)=>{i.state==="submitted"!=!!i.jobId&&n.addIssue({code:"custom",path:["jobId"],message:"Only submitted preparations identify a job."})}),Vo=e.object({teamId:O,planHash:pt,expectedRevision:e.number().int().positive(),estimateReview:La.optional(),usageQuoteHash:pt.optional()}).strict(),nu=e.object({projectId:O.optional(),state:e.enum(["prepared","submitted","cancelled"]).optional(),afterId:O.optional(),limit:e.number().int().min(1).max(100).default(25)}).strict(),au=e.object({schemaVersion:e.literal("openpond.trainingPreparationPage.v1"),teamId:O,items:e.array(gr).max(100),nextCursor:O.nullable()}).strict();async function oc(i){let n=gr.parse(i),{contentHash:t,...a}=n.plan,r=a.request.usageFunding;if(!!r!=!!a.usageQuote)throw new h("training_usage_quote_mismatch","Retain the reviewed complete Job price before starting.");if(a.usageQuote&&r&&await eo(a.usageQuote,{teamId:a.request.teamId,actorUserId:a.creatorUserId,preparationId:a.id,submissionHash:a.submissionHash,customerCapUsd:r.customerCapUsd}),await u(a)!==t||await u(a.request)!==a.requestHash||a.source.modelProject.id!==a.request.configuration.id||await u(a.source.origin??null)!==await u(a.request.origin??null))throw new h("training_preparation_mismatch","The prepared training inputs changed.");return n}d(oc,"parseAndVerifyTrainingPreparationReceipt");function iu(i){async function n(t,a,r){let s=await oc(t);if(s.plan.request.teamId!==a||r&&s.plan.id!==r)throw new h("training_preparation_scope_mismatch","The training preparation belongs to a different workspace or request.");return s}return d(n,"read"),{async listPreparations(t,a={}){let r=O.parse(t),s=nu.parse(a),o=new URLSearchParams;for(let[p,g]of Object.entries(s))o.set(p,String(g));let c=au.parse(await i(`/v1/training/preparations?${o}`));if(c.teamId!==r||c.items.length>s.limit||new Set(c.items.map(p=>p.plan.id)).size!==c.items.length||c.nextCursor!==null&&(c.nextCursor!==c.items.at(-1)?.plan.id||c.nextCursor===s.afterId))throw new h("training_preparation_page_mismatch","The preparation page does not match its workspace or cursor.");let l=await Promise.all(c.items.map(async p=>{let g=await n(p,r);if(s.projectId&&g.plan.request.projectId!==s.projectId||s.state&&g.state!==s.state)throw new h("training_preparation_page_mismatch","A preparation does not match the requested Project or state.");return g}));return{...c,items:l}},async prepareRun(t){let a=Ut.parse(t),r=await n(await i("/v1/training/preparations",{method:"POST",body:JSON.stringify(a)}),a.teamId);if(r.plan.requestHash!==await u(a))throw new h("training_preparation_request_mismatch","The preparation does not match the requested run.");return r},async getPreparation(t,a){return n(await i(`/v1/training/preparations/${encodeURIComponent(O.parse(a))}`),O.parse(t),a)},async startPreparation(t,a){let r=Vo.parse(a),s=await n(await i(`/v1/training/preparations/${encodeURIComponent(O.parse(t))}/start`,{method:"POST",body:JSON.stringify(r)}),r.teamId,t);if(s.plan.contentHash!==r.planHash||s.state!=="submitted"||s.plan.usageQuote?.contentHash!==r.usageQuoteHash)throw new h("training_preparation_start_mismatch","The submitted run does not match the approved preparation.");return s},async cancelPreparation(t,a){let r=Vo.parse(a),s=await n(await i(`/v1/training/preparations/${encodeURIComponent(O.parse(t))}/cancel`,{method:"POST",body:JSON.stringify(r)}),r.teamId,t);if(s.plan.contentHash!==r.planHash||s.state!=="cancelled")throw new h("training_preparation_cancel_mismatch","The preparation cancellation could not be verified.");return s}}}d(iu,"createTrainingPreparationClient");var he=e.string().min(1).max(500),mt=e.string().max(500),ca=e.string().max(100),la=e.array(he).max(1e4).nullable(),ru=e.string().regex(/^[a-f0-9]{64}$/),ou=e.discriminatedUnion("kind",[e.object({kind:e.literal("workspace"),id:he,revision:e.number().int().positive().nullable(),ownerUserId:he.optional(),taskIds:la}).strict(),e.object({kind:e.literal("published"),release:Mt,taskIds:la}).strict(),e.object({kind:e.literal("profile"),profileRepositoryId:he,sourceRevision:he,release:Mt,name:e.string().max(500),definitionId:mt,taskIds:la}).strict()]),su=e.object({repositoryId:he,sourceRevision:he,definitionId:he,workflowId:he,label:e.string().max(500)}).strict(),cu=e.object({profileRepositoryId:mt,sourceRevision:mt,definitionId:mt,sourceHash:ru.nullable(),release:Mt.nullable(),taskIds:la,source:zr.nullable().optional()}).strict(),du=e.object({selectedDatasetId:mt,dataset:ou.nullable(),workspaceMode:e.enum(["recorded","model"]).nullable(),mode:e.enum(["hosted_chat","fixture"]),executionMode:e.enum(["model","model_harness","model_harness_profile"]),name:e.string().max(500),modelId:mt,messages:uo,temperature:ca,topP:ca,maxOutputTokens:ca,budget:ca,seedText:e.string().max(1e4),reasoningEffort:ho.shape.reasoningEffort.unwrap(),sourceId:mt,harness:Ur.nullable(),project:lo.nullable(),members:e.array(e.object({taskId:he,fixtureId:he.nullable()}).strict()).max(1e4).nullable(),graderIds:e.array(he).max(100).nullable(),graders:e.array(Xa).max(100),graderMappings:e.record(he,go),selectedGraders:e.array(Dr).max(100),workflow:su.nullable(),profile:cu.nullable()}).strict(),mu=e.object({mode:e.enum(["model","model_harness","model_harness_profile"]),localRuntime:po.options[0].shape.localRuntime,sourceId:e.string().max(500),profileChoiceId:e.string().max(500),temperature:e.number().finite().nullable().optional(),topP:e.number().finite().nullable().optional(),name:e.string().max(500),release:Mt.nullable(),modelId:e.string().max(500),budget:e.number().finite().nullable(),outputTokens:e.number().finite().nullable(),prompt:e.string().max(1e5),targetId:e.string().max(500),seed:e.string().max(1e4),graderChoices:e.record(e.string().regex(/^[a-f0-9]{64}$/),e.array(Xa).max(100))}).strict(),lu=e.object({release:Mt,mode:e.enum(["all","subset"]),ids:e.array(e.string().min(1).max(500)).max(1e4)}).strict(),uu=fo.pick({id:!0,request:!0,graders:!0,maximumCostUsd:!0}).extend({packageHash:e.string().regex(/^[a-f0-9]{64}$/).optional()}).strict(),pu=e.object({form:mu,selection:lu.nullable(),source:uu.nullable(),executionLocation:e.enum(["local","hosted"])}).strict(),ht=e.object({baseModel:T.nullable(),startingProfile:Rn.optional(),prompts:e.array(e.object({id:e.string().trim().min(1).max(240),text:e.string().max(16e3)}).strict()).max(8),coordinates:e.array(e.object({id:e.string().trim().min(1).max(240),layer:e.string().max(100),neuron:e.string().max(100),dose:e.string().max(100)}).strict()).max(64),doseMultipliers:e.string().max(1e3),normalization:Xo,tokenScope:Ko,maxNewTokens:e.string().max(100),maximumCapturedValues:e.string().max(100),maximumForwardTokenWork:e.string().max(100),maximumDurationSeconds:e.string().max(100),maximumSpendUsd:e.string().max(100).optional()}).strict().superRefine((i,n)=>{(new Set(i.prompts.map(t=>t.id)).size!==i.prompts.length||new Set(i.coordinates.map(t=>t.id)).size!==i.coordinates.length)&&n.addIssue({code:"custom",message:"Authoring row identities must be unique."})}),pI=Oi.parse({learningRate:.001,weightDecay:0,maxSteps:16,gradientAccumulationSteps:8,maxSequenceLength:2048,seed:42,maxDurationSeconds:3600,maxCheckpointBytes:2147483648});function hI(i){return jn.parse({schemaVersion:"openpond.engramAdapterConfig.v1",implementation:"openpond_qwen_engram_paper_v1",hook:"self_attn.input",injectLayers:[1,3,7,15],suffixOrders:[2,3],previousOrders:[3],numHashes:4,tableSize:90007,perHashDim:i,alpha:.2,memoryInitStd:.02,adapterDtype:"float32",projectionInit:"zeros",gateInit:"zeros_no_bias",boundary:"incomplete_group_off_v1",occupancy:"training_before_lookup_v1",history:"request_absolute_positions_v1",batchSize:1})}d(hI,"engramPaperConfig");var We=e.string().max(100),hu=e.object({learningRate:We,weightDecay:We,maxSteps:We,gradientAccumulationSteps:We,maxSequenceLength:We,seed:We,maxDurationSeconds:We,maxCheckpointBytes:We}).strict(),Vt=e.object({baseModel:T.nullable(),batch:F.nullable(),name:e.string().max(500),maximumSpendUsd:e.string().max(100),training:hu,parentArtifact:ns.nullable(),startingModule:rs.optional()}).strict(),gu=e.object({enabled:e.boolean(),mode:e.enum(["nightly","approved_count"]),minimumTasks:e.string().max(100),localTime:e.string().max(100),timeZone:e.string().max(200),maximumSpendUsd:e.string().max(100),maximumDailySpendUsd:e.string().max(100)}).strict();function fr(i){return Rn.parse({modelProjectId:i.modelProjectId,versionHash:i.contentHash,publication:{id:i.publication.id,revision:i.publication.revision,contentHash:i.publication.contentHash},profileHash:i.publication.profile.contentHash})}d(fr,"savedSteeringExperimentSource");async function sc(i,n,t={}){let a=Rn.parse(i),r=await ot(n,{...t,modelProjectId:a.modelProjectId});if(r.schemaVersion!=="openpond.steeringModelVersion.v1"||m(a)!==m(fr(r)))throw new h("steering_experiment_source_mismatch","Resolve the exact saved steering Model version, publication and profile.");return r}d(sc,"verifySavedSteeringExperimentSource");var Ge={label:e.string().trim().min(1).max(500),inferenceModelId:e.string().trim().min(1).max(500).nullable(),baseModel:T.nullable()},yt=e.discriminatedUnion("source",[e.object({...Ge,source:e.literal("inference")}).strict().refine(i=>!!i.inferenceModelId,{message:"Retain the selected model's original inference identity."}),e.object({...Ge,source:e.literal("managed")}).strict().refine(i=>!!i.baseModel,{message:"Retain the selected model's original managed identity."}),e.object({...Ge,source:e.literal("steering"),inferenceModelId:e.null(),baseModel:T,steering:Rn}).strict(),e.object({...Ge,source:e.literal("engram"),inferenceModelId:e.null(),baseModel:T,engram:rs}).strict(),e.object({...Ge,source:e.literal("alphaedit"),inferenceModelId:e.null(),baseModel:T,alphaedit:pr}).strict(),e.object({...Ge,source:e.literal("neuron_training"),inferenceModelId:e.null(),baseModel:T,neuronTraining:Js}).strict(),e.object({...Ge,source:e.literal("decision"),inferenceModelId:e.null(),baseModel:T,decision:or}).strict().superRefine((i,n)=>{m(i.baseModel)!==m(Cm())&&n.addIssue({code:"custom",path:["baseModel"],message:"Retain the saved decision Model's exact adapter release and its own tokenizer."})}),e.object({...Ge,source:e.literal("trained"),inferenceModelId:e.null(),baseModel:T,trainedVersion:e.lazy(()=>St)}).strict().superRefine((i,n)=>{m(i.baseModel)!==m(i.trainedVersion.request.baseModel)&&n.addIssue({code:"custom",path:["baseModel"],message:"Retain the trained version's exact original base."})})]);async function fu(i,n={}){let t=yt.parse(i);if(t.source==="trained"&&await Jt(t.trainedVersion,n),t.source==="alphaedit"&&n.resolveAlphaEditVersion){let a=await kl(t.alphaedit,await n.resolveAlphaEditVersion(t.alphaedit),n);if(m(t.baseModel)!==m(a.baseModel))throw new h("alphaedit_experiment_source_mismatch","Retain the exact saved AlphaEdit Model and original base.")}if(t.source==="neuron_training"&&n.resolveNeuronTrainingVersion){let a=await Al(t.neuronTraining,await n.resolveNeuronTrainingVersion(t.neuronTraining),n);if(m(t.baseModel)!==m(a.baseModel))throw new h("neuron_training_experiment_source_mismatch","Retain the exact saved neuron patch and original base.")}if(t.source==="decision"&&n.resolveDecisionVersion){let a=await zm(t.decision,await n.resolveDecisionVersion(t.decision),n);if(m(t.baseModel)!==m(a.baseModel))throw new h("decision_experiment_source_mismatch","The authoring source differs from the exact saved decision Model's source release.")}if(t.source==="engram"&&n.resolveEngramVersion){let a=await bt(await n.resolveEngramVersion(t.engram),{teamId:n.teamId,modelProjectId:t.engram.modelProjectId});if(a.contentHash!==t.engram.versionHash||a.artifact.id!==t.engram.artifact.id||a.artifact.contentHash!==t.engram.artifact.contentHash||await u(a.artifact.manifest.pins.baseModel)!==t.engram.modelHash||m(t.baseModel)!==m(a.baseModel))throw new h("engram_experiment_source_mismatch","The authoring source differs from the exact saved memory module.")}if(t.source==="steering"&&n.resolveSteeringVersion){let a=await sc(t.steering,await n.resolveSteeringVersion(t.steering),n);if(m(t.baseModel)!==m(a.publication.baseModel))throw new h("steering_experiment_source_mismatch","The authoring source differs from the saved steering Model's exact base.")}return t}d(fu,"parseAndVerifyExperimentStartingModel");var vu=e.enum(["evaluate","sft","grpo","neuron_steering","inspect_activations","engram_adapter","decision_model","alphaedit","selective_neuron_training"]);function bI(i){return{evaluate:"Evaluate",sft:"SFT + LoRA",grpo:"RL (GRPO) + LoRA",neuron_steering:"Neuron steering",inspect_activations:"Inspect activations",engram_adapter:"Engram memory",decision_model:"Decision model",alphaedit:"AlphaEdit",selective_neuron_training:"Neuron training"}[i]}d(bI,"experimentOperationLabel");var ct=Ut.omit({configuration:!0,origin:!0}).extend({schemaVersion:e.literal("openpond.trainingExperimentSetupRequest.v1"),configuration:Ut.shape.configuration.optional(),baseModel:T,settings:Wa.omit({baseModel:!0})}).strict().superRefine((i,n)=>{i.baseModel.revision||n.addIssue({code:"custom",path:["baseModel","revision"],message:"Select an exact model revision."}),(!i.settings.recipe||!["sft","grpo"].includes(i.settings.recipe.method))&&n.addIssue({code:"custom",path:["settings","recipe"],message:"Choose a supported SFT or GRPO recipe."}),i.parent&&i.settings.method!=="grpo"&&n.addIssue({code:"custom",path:["parent"],message:"Checkpoint continuation currently requires GRPO."}),i.settings.method!==i.settings.recipe?.method&&n.addIssue({code:"custom",path:["settings","method"],message:"The method must match its recipe."})}),bu=e.object({schemaVersion:e.literal("openpond.trainingExperimentSetupReceipt.v1"),request:ct,requestHash:e.string().regex(/^[a-f0-9]{64}$/),preparation:gr}).strict();async function Iu(i,n){return`experiment-${await u({teamId:i.teamId,operationId:i.operationId,creatorUserId:n})}`}d(Iu,"trainingExperimentConfigurationIdentity");async function Su(i){let n=bu.parse(i),t=await oc(n.preparation),{schemaVersion:a,baseModel:r,settings:s,configuration:o,...c}=n.request,{schemaVersion:l,configuration:p,...g}=t.plan.request,v=await Iu(n.request,t.plan.creatorUserId);if(n.requestHash!==await u(n.request)||await u(c)!==await u(g)||(o?p.id!==o.id||p.expectedRevision!==o.expectedRevision||p.expectedEtag!==o.expectedEtag:t.plan.source.modelProject.portableProjectId!==v)||t.plan.source.modelProject.revision!==p.expectedRevision||t.plan.source.modelProject.contentHash!==p.expectedEtag||t.plan.source.modelProject.id!==p.id)throw new h("training_experiment_setup_mismatch","The prepared experiment does not match its reviewed draft.");return{...n,preparation:t}}d(Su,"parseAndVerifyTrainingExperimentSetupReceipt");function xu(i){return{async prepareExperiment(n){let t=ct.parse(n),a=await Su(await i("/v1/training/preparations/from-draft",{method:"POST",body:JSON.stringify(t)}));if(a.requestHash!==await u(t))throw new h("training_experiment_setup_request_mismatch","The service returned a different experiment draft.");return a}}}d(xu,"createTrainingExperimentSetupClient");var II=e.object({schemaVersion:e.literal("openpond.trainingExperimentInputsPage.v1"),teamId:e.string().min(1).max(500),actorId:e.string().min(1).max(500),projectId:e.string().min(1).max(500).nullable(),models:e.array(Jr).max(1e3),methods:e.array(e.string().min(1).max(200)).max(100),billingModes:Xr.optional(),batches:e.array(e.object({reference:F,rewardBinding:F,purpose:e.enum(["supervised_training","reward_training","evaluation"]),exampleCount:e.number().int().positive(),sealedAt:e.iso.datetime()}).strict()).max(100),nextCursor:e.string().min(1).max(500).nullable()}).strict(),cc=e.object({baseModel:T.nullable(),recipe:Gr,batch:F.nullable(),evaluation:F.nullable(),validationSplit:e.enum(["validation","frozen_eval"]),name:e.string().max(500),budget:e.string().max(100),customerCapUsd:e.string().max(100).optional(),billingMode:e.enum(["prepaid_only","actual_usage"]).optional(),gpuSelection:dn.optional(),parent:Ut.shape.parent,startingModelLabel:e.string().trim().min(1).max(500).optional(),learningIntent:gu.optional(),learningConfiguration:e.object({inputHash:e.string().regex(/^[a-f0-9]{64}$/),trainingInputHash:e.string().regex(/^[a-f0-9]{64}$/),configuration:ye,policy:sn}).strict().optional()}).strict(),ja=e.object({schemaVersion:e.literal("openpond.experimentDraft.v1"),id:e.string().trim().min(1).max(240),operationType:vu,name:e.string().trim().min(1).max(500),startingModel:yt.optional(),evaluationForm:pu.optional(),hostedEvaluationForm:du.optional(),trainingForm:cc.optional(),activationForm:ht.optional(),engramForm:Vt.optional(),decisionForm:zt.optional(),alphaEditForm:ut.optional(),neuronTrainingForm:Dn.optional(),training:e.object({baseModel:ct.shape.baseModel.optional(),settings:ct.shape.settings.optional(),batch:ct.shape.batch.optional(),maximumSpendUsd:ct.shape.maximumSpendUsd.optional(),usageFunding:ct.shape.usageFunding}).strict().optional()}).strict().superRefine((i,n)=>{let t=i.startingModel;if(i.alphaEditForm&&i.operationType!=="alphaedit"&&n.addIssue({code:"custom",path:["alphaEditForm"],message:"AlphaEdit settings require an AlphaEdit experiment."}),i.neuronTrainingForm&&i.operationType!=="selective_neuron_training"&&n.addIssue({code:"custom",path:["neuronTrainingForm"],message:"Neuron training settings require a neuron-training experiment."}),i.operationType==="alphaedit"&&t&&(t.source!=="managed"&&t.source!=="alphaedit"?n.addIssue({code:"custom",path:["startingModel"],message:"AlphaEdit requires its exact managed base or saved AlphaEdit parent."}):i.alphaEditForm?.baseModel&&m(t.baseModel)!==m(i.alphaEditForm.baseModel)&&n.addIssue({code:"custom",path:["alphaEditForm","baseModel"],message:"Retain the exact selected AlphaEdit source."})),t?.source==="alphaedit"?(i.operationType!=="alphaedit"||!i.alphaEditForm||m(i.alphaEditForm.baseModel)!==m(t.baseModel)||m(i.alphaEditForm.startingModule??null)!==m(t.alphaedit)||m(i.alphaEditForm.parentArtifact)!==m(t.alphaedit.artifact))&&n.addIssue({code:"custom",path:["alphaEditForm"],message:"Retain the exact AlphaEdit matrix patch and continuation state."}):i.alphaEditForm?.startingModule&&n.addIssue({code:"custom",path:["startingModel"],message:"Retain the saved AlphaEdit Model rather than substituting its original base."}),i.operationType==="selective_neuron_training"&&t&&(t.source!=="managed"?n.addIssue({code:"custom",path:["startingModel"],message:"Neuron training currently starts from its exact managed base; learned patches are not reset or silently discarded."}):i.neuronTrainingForm?.baseModel&&m(t.baseModel)!==m(i.neuronTrainingForm.baseModel)&&n.addIssue({code:"custom",path:["neuronTrainingForm","baseModel"],message:"Retain the selected exact neuron-training base."})),t?.source==="neuron_training"&&n.addIssue({code:"custom",path:["startingModel"],message:"This neuron patch supports saved serving, but experiment continuation/composition is not supported. Explicitly select a compatible base to start a fresh experiment."}),i.decisionForm&&i.operationType!=="decision_model"&&n.addIssue({code:"custom",path:["decisionForm"],message:"Decision settings require a decision-model experiment."}),i.operationType==="decision_model"&&t&&(t.source!=="managed"&&t.source!=="decision"?n.addIssue({code:"custom",path:["startingModel"],message:"Decision training/scoring requires its exact source release or saved decision Model; another learned model is not replaced with its base."}):i.decisionForm?.baseModel&&m(t.baseModel)!==m(i.decisionForm.baseModel)&&n.addIssue({code:"custom",path:["decisionForm","baseModel"],message:"Retain the selected exact decision source release."})),t?.source==="decision"?(i.operationType!=="decision_model"||!i.decisionForm||m(i.decisionForm.baseModel)!==m(t.baseModel)||m(i.decisionForm.startingDecision??null)!==m(t.decision)||m(i.decisionForm.parentArtifact)!==m(t.decision.artifact))&&n.addIssue({code:"custom",path:["decisionForm"],message:"Retain the exact saved decision version and artifact for training or scoring."}):i.decisionForm?.startingDecision&&n.addIssue({code:"custom",path:["startingModel"],message:"Retain the saved decision starting model instead of substituting its source release."}),i.engramForm&&i.operationType!=="engram_adapter"&&n.addIssue({code:"custom",path:["engramForm"],message:"Engram settings require an Engram experiment."}),i.operationType==="engram_adapter"&&t&&(t.source!=="managed"&&t.source!=="engram"?n.addIssue({code:"custom",path:["startingModel"],message:"This Engram implementation requires its exact compatible managed base; saved interventions are not silently replaced with their base."}):i.engramForm?.baseModel&&m(t.baseModel)!==m(i.engramForm.baseModel)&&n.addIssue({code:"custom",path:["engramForm","baseModel"],message:"Retain the selected exact Engram base."})),t?.source==="engram"&&(i.operationType!=="engram_adapter"||!i.engramForm||m(i.engramForm.baseModel)!==m(t.baseModel)||m(i.engramForm.startingModule??null)!==m(t.engram)||m(i.engramForm.parentArtifact)!==m(t.engram.artifact))&&n.addIssue({code:"custom",path:["engramForm"],message:"Retain the exact saved Engram module as the continuation parent."}),t?.source==="steering"?(i.operationType!=="neuron_steering"&&n.addIssue({code:"custom",path:["operationType"],message:"Saved steering sources currently require a neuron steering experiment."}),(!i.activationForm||m(i.activationForm.baseModel)!==m(t.baseModel)||m(i.activationForm.startingProfile??null)!==m(t.steering))&&n.addIssue({code:"custom",path:["activationForm"],message:"Retain the exact saved steering source and base in the activation form."})):i.activationForm?.startingProfile&&n.addIssue({code:"custom",path:["startingModel"],message:"Retain the saved steering starting model instead of substituting its base."}),t?.source==="trained"){let a=t.trainedVersion;for(let[s,o]of[["trainingForm",i.trainingForm?.baseModel],["training",i.training?.baseModel],["activationForm",i.activationForm?.baseModel]])o&&m(o)!==m(a.request.baseModel)&&n.addIssue({code:"custom",path:[s,"baseModel"],message:"The form differs from the retained trained source's base."});let r=i.trainingForm?.parent;r&&(r.jobId!==a.jobId||r.checkpointId!==a.candidate.checkpointId||m(r.artifact)!==m(a.candidate.artifact))&&n.addIssue({code:"custom",path:["trainingForm","parent"],message:"Retain the exact trained Job, artifact and checkpoint."})}i.evaluationForm&&i.operationType!=="evaluate"&&n.addIssue({code:"custom",path:["evaluationForm"],message:"Evaluation form settings require an evaluation experiment."}),i.activationForm&&!["neuron_steering","inspect_activations"].includes(i.operationType)&&n.addIssue({code:"custom",path:["activationForm"],message:"Activation settings require a steering or inspection experiment."}),i.trainingForm&&(!["sft","grpo"].includes(i.operationType)||i.trainingForm.recipe.method!==i.operationType)&&n.addIssue({code:"custom",path:["trainingForm"],message:"Training form settings must match the experiment type."}),i.training&&(!["sft","grpo"].includes(i.operationType)||i.training.settings&&i.training.settings.method!==i.operationType)&&n.addIssue({code:"custom",path:["training"],message:"Training settings must match the experiment type."})});async function dc(i,n={}){let t=ja.parse(i);return t.startingModel&&await fu(t.startingModel,n),t}d(dc,"parseAndVerifyExperimentDraft");var SI=e.object({schemaVersion:e.literal("openpond.experimentDraftUpdate.v1"),operationId:e.string().trim().min(1).max(240),expectedRevision:e.number().int().positive(),draft:ja}).strict(),L=e.string().trim().min(1).max(240),xI=e.object({id:L,teamId:L,apiOrigin:e.url().max(2e3)}).strict(),vr=e.object({schemaVersion:e.literal("openpond.experimentDraftRecord.v1"),id:L,teamId:L,ownerUserId:L,projectId:L.nullable(),revision:e.number().int().positive(),status:e.enum(["draft","archived"]),draft:ja,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime(),contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict().superRefine((i,n)=>{i.id!==i.draft.id&&n.addIssue({code:"custom",path:["id"],message:"The stored draft identity does not match its document."})}),yu=e.object({schemaVersion:e.literal("openpond.experimentDraftSave.v1"),teamId:L,operationId:L,expectedRevision:e.number().int().nonnegative(),projectId:L.nullable().default(null),draft:ja}).strict(),wu=e.object({schemaVersion:e.literal("openpond.experimentDraftArchive.v1"),teamId:L,operationId:L,expectedRevision:e.number().int().positive()}).strict(),_u=e.object({schemaVersion:e.literal("openpond.experimentDraftReceipt.v1"),operationId:L,requestHash:e.string().regex(/^[a-f0-9]{64}$/),record:vr}).strict(),Hu=e.object({projectId:L.optional(),search:e.string().trim().max(1e3).optional(),archived:e.boolean().default(!1),cursor:e.string().min(1).max(2e3).optional(),limit:e.number().int().min(1).max(100).default(30)}).strict(),ju=e.object({schemaVersion:e.literal("openpond.experimentDraftPage.v1"),teamId:L,ownerUserId:L,projectId:L.nullable(),items:e.array(vr).max(100),nextCursor:e.string().min(1).max(2e3).nullable()}).strict();async function _i(i){let n=vr.parse(i),{contentHash:t,...a}=n;if(t!==await u(a))throw new h("experiment_draft_hash_mismatch","The saved draft differs from its retained document.");return await dc(n.draft,{teamId:n.teamId}),n}d(_i,"parseAndVerifyExperimentDraftRecord");async function Tu(i){let n=_u.parse(i);return{...n,record:await _i(n.record)}}d(Tu,"parseAndVerifyExperimentDraftReceipt");function ln(i){throw new h("experiment_draft_scope_mismatch",i)}d(ln,"mismatch");function Mu(i){async function n(t,a){let r=m(a);if(new TextEncoder().encode(r).byteLength>32768)throw new h("experiment_draft_too_large","Drafts contain settings and references, not model or dataset bytes.");return Tu(await i(t,{method:"POST",body:r}))}return d(n,"write"),{async saveExperimentDraft(t){let a=yu.parse(t);await dc(a.draft,{teamId:a.teamId});let r=await n("/v1/training/experiment-drafts",a),s=r.record;return(r.operationId!==a.operationId||r.requestHash!==await u(a)||s.teamId!==a.teamId||s.id!==a.draft.id||s.projectId!==a.projectId||s.revision!==a.expectedRevision+1||s.status!=="draft"||m(s.draft)!==m(a.draft))&&ln("The service saved a different draft, Project or revision."),r},async getExperimentDraft(t,a){let r=L.parse(t),s=L.parse(a),o=await _i(await i(`/v1/training/experiment-drafts/${encodeURIComponent(s)}?${new URLSearchParams({teamId:r})}`));return(o.teamId!==r||o.id!==s)&&ln("The service returned another draft or workspace."),o},async listExperimentDrafts(t,a={}){let r=L.parse(t),s=Hu.parse(a),o=new URLSearchParams({teamId:r});for(let[l,p]of Object.entries(s))o.set(l,String(p));let c=ju.parse(await i(`/v1/training/experiment-drafts?${o}`));(c.teamId!==r||c.projectId!==(s.projectId??null)||c.items.length>s.limit||new Set(c.items.map(l=>l.id)).size!==c.items.length||s.cursor&&c.nextCursor===s.cursor)&&ln("The draft list returned another scope or invalid page.");for(let l of c.items){let p=await _i(l);(p.teamId!==r||p.ownerUserId!==c.ownerUserId||s.projectId&&p.projectId!==s.projectId||p.status!==(s.archived?"archived":"draft"))&&ln("The draft list contains another owner, Project or state.")}return c},async archiveExperimentDraft(t,a){let r=L.parse(t),s=wu.parse(a),o=await n(`/v1/training/experiment-drafts/${encodeURIComponent(r)}/archive`,s);return(o.operationId!==s.operationId||o.requestHash!==await u({id:r,...s})||o.record.teamId!==s.teamId||o.record.id!==r||o.record.revision!==s.expectedRevision+1||o.record.status!=="archived")&&ln("The service archived another draft or revision."),o}}}d(Mu,"createExperimentDraftClient");var bn=e.string().trim().min(1).max(240),Hi=e.string().regex(/^[a-f0-9]{64}$/),Ru=e.object({teamId:bn,projectId:bn.nullable(),method:Oe,query:Ue,form:ht}).strict(),Eu=e.object({schemaVersion:e.literal("openpond.managedModificationCompilation.v1"),teamId:bn,actorId:bn,projectId:bn.nullable(),method:Oe,query:Ue,formHash:Hi,request:at,inputHash:Hi}).strict(),Pu=Eu.extend({contentHash:Hi}).strict();function br(i){let n=Ru.parse(i),t=n.query,a={schemaVersion:"openpond.baseModelPreference.v1",modelId:t.modelId,source:t.source,revision:t.revision??null,tokenizerRevision:t.tokenizerRevision??null,chatTemplateHash:t.chatTemplateHash??null,modelAssetId:t.modelAssetId??null};if(n.form.startingProfile&&n.method!=="neuron_steering")throw new h("managed_modification_saved_source_unsupported","Saved steering sources currently require neuron steering.");if(t.teamId!==n.teamId||m(n.form.baseModel)!==m(a))throw new h("managed_modification_compile_scope_mismatch","Retain the exact form, model and workspace query.");if(new TextEncoder().encode(m(n)).byteLength>1048576)throw new h("managed_modification_compile_too_large","The bounded form exceeds 1 MiB.");return n}d(br,"parseManagedModificationCompile");async function ku(i,n){let t=br(n),a=Pu.parse(i),{contentHash:r,...s}=a,o=await It(a.request);if(m(t.form.startingProfile??null)!==m(o.startingProfile?vs(o.startingProfile):null))throw new h("managed_modification_compilation_mismatch","The compilation dropped or changed the saved steering source.");let c=o.variants.filter(l=>l.profile!==null).length;if(r!==await u(s)||a.teamId!==t.teamId||a.projectId!==t.projectId||a.method!==t.method||m(a.query)!==m(t.query)||a.formHash!==await u(t.form)||a.inputHash!==await u(o)||o.model.modelId!==t.query.modelId||o.model.revision!==t.query.revision||(t.method==="inspect_activations"?c>0:c===0||c===o.variants.length))throw new h("managed_modification_compilation_mismatch","The compilation differs from the exact requested form, model or bounds.");return a}d(ku,"parseAndVerifyManagedModificationCompilation");var Y=e.string().trim().min(1).max(240),qe=e.string().regex(/^[a-f0-9]{64}$/),Ir=e.object({schemaVersion:e.literal("openpond.managedModificationExecution.v1"),id:Y,teamId:Y,ownerUserId:Y,projectId:Y.nullable(),name:e.string().trim().min(1).max(500),method:Oe,phase:e.enum(["prepared","queued","dispatching","stopping","cancelled","completed","failed"]),revision:e.number().int().positive(),sourceContentHash:qe,plan:e.object({contentHash:qe,inputHash:qe,runtimeHash:qe,maximumSpendUsd:e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48).nullable(),computePrice:Kr.optional(),createdAt:e.iso.datetime(),expiresAt:e.iso.datetime()}).strict().superRefine((i,n)=>{try{Ga(i)}catch{n.addIssue({code:"custom",message:"Retain the accepted rate, runtime and optional spending limit."})}}),request:at,sourceForm:ht.optional(),result:xa.nullable(),resultRecordedAt:e.iso.datetime().nullable(),updatedAt:e.iso.datetime()}).strict(),Au=Ir.extend({contentHash:qe}).strict(),Sr=e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48),Cu=e.object({teamId:Y,operationId:Y,projectId:Y.nullable(),name:e.string().trim().min(1).max(500),method:Oe,query:Ue,request:at,maximumSpendUsd:Sr.nullish(),sourceForm:ht.optional()}).strict(),mc={teamId:Y,id:Y,operationId:Y,expectedRevision:e.number().int().positive(),planHash:qe},Bn=e.object({...mc,action:e.literal("start"),approvedMaximumSpendUsd:Sr.nullable(),approvedPriceHash:qe.optional()}).strict(),Fn=e.object({...mc,action:e.literal("cancel")}).strict(),en=Ir.omit({schemaVersion:!0,request:!0,sourceForm:!0,result:!0,resultRecordedAt:!0}),qu=e.object({schemaVersion:e.literal("openpond.managedModificationExecutionReceipt.v1"),operationId:Y,requestHash:qe,execution:en}).strict(),zu=qu.extend({contentHash:qe}).strict(),xr=e.object({id:Y.optional(),projectId:Y.optional(),method:Oe.optional(),phase:Ir.shape.phase.optional(),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),Du=en.extend({model:at.shape.model}).strict(),Uu=e.object({schemaVersion:e.literal("openpond.managedModificationExecutionPage.v1"),teamId:Y,ownerUserId:Y,query:xr,items:e.array(Du).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),Vu=Uu.extend({contentHash:qe}).strict();async function Nu(i,n){let t=Vu.parse(i),{contentHash:a,...r}=t,s=xr.parse(n.query??{}),o=d(()=>new h("managed_modification_history_mismatch","The execution history differs from its requested scope."),"invalid");if(t.teamId!==n.teamId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||m(t.query)!==m(s)||a!==await u(r)||t.items.length>s.limit||new Set(t.items.map(c=>c.id)).size!==t.items.length||t.nextCursor!==null&&(t.items.length!==s.limit||t.nextCursor===s.cursor))throw o();for(let[c,l]of t.items.entries()){let p=t.items[c-1];if(Ga(l.plan),l.teamId!==t.teamId||l.ownerUserId!==t.ownerUserId||s.id!==void 0&&l.id!==s.id||s.projectId!==void 0&&l.projectId!==s.projectId||s.method!==void 0&&l.method!==s.method||s.phase!==void 0&&l.phase!==s.phase||k(l.plan.maximumSpendUsd)!==l.plan.maximumSpendUsd||Date.parse(l.plan.expiresAt)<=Date.parse(l.plan.createdAt)||p&&(Date.parse(p.plan.createdAt)<Date.parse(l.plan.createdAt)||Date.parse(p.plan.createdAt)===Date.parse(l.plan.createdAt)&&p.id<=l.id))throw o()}return t}d(Nu,"parseAndVerifyManagedModificationExecutionPage");function _I(i){let n=k(Sr.parse(i));if(n===null)throw new h("managed_modification_cap_invalid","Choose a positive spending limit.");return n}d(_I,"canonicalModificationSpend");async function lc(i){let n=Cu.parse(i);if(n.maximumSpendUsd=k(n.maximumSpendUsd),await It(n.request),n.sourceForm&&(br({teamId:n.teamId,projectId:n.projectId,method:n.method,query:n.query,form:n.sourceForm}),uc(n.sourceForm,n.request,n.maximumSpendUsd)),n.request.startingProfile&&n.method!=="neuron_steering")throw new h("managed_modification_saved_source_unsupported","Saved steering sources currently require neuron steering.");let t=n.request.variants.filter(a=>a.profile!==null).length;if(n.query.teamId!==n.teamId||n.query.modelId!==n.request.model.modelId||n.query.revision!==n.request.model.revision||(n.method==="inspect_activations"?t>0:t===0||t===n.request.variants.length))throw new h("managed_modification_input_invalid","Retain the exact model and appropriate inspection or Off/intervention comparison.");if(new TextEncoder().encode(m(n)).byteLength>1048576)throw new h("managed_modification_input_too_large","The bounded activation request exceeds 1 MiB.");return n}d(lc,"parseAndVerifyManagedModificationPrepare");function Re(i){let n=e.discriminatedUnion("action",[Bn,Fn]).parse(i);return n.action==="start"&&(n.approvedMaximumSpendUsd=k(n.approvedMaximumSpendUsd)),n}d(Re,"parseManagedModificationControl");async function $u(i,n){let t=zu.parse(i),{contentHash:a,...r}=t,s="action"in n?Re(n):await lc(n),o=t.execution,c=!("action"in s),l=await u(c?{action:"prepare",command:s}:s);if(a!==await u(r)||t.operationId!==s.operationId||t.requestHash!==l||o.teamId!==s.teamId||Date.parse(o.plan.expiresAt)<=Date.parse(o.plan.createdAt)||o.plan.maximumSpendUsd!==k(o.plan.maximumSpendUsd))throw new h("managed_modification_receipt_mismatch","The receipt differs from the original operation and reviewed execution.");if(c){let p=s,g=`modification-${await u({teamId:p.teamId,ownerUserId:o.ownerUserId,operationId:p.operationId})}`;if(o.id!==g||o.projectId!==p.projectId||o.name!==p.name||o.method!==p.method||o.phase!=="prepared"||o.revision!==1||o.plan.inputHash!==await u(p.request)||o.plan.maximumSpendUsd!==p.maximumSpendUsd)throw new h("managed_modification_receipt_mismatch","The preparation differs from the requested bounded experiment.")}else{let p=s;if(o.id!==p.id||o.revision!==p.expectedRevision+1||o.plan.contentHash!==p.planHash||(p.action==="start"?o.phase!=="queued"||o.plan.maximumSpendUsd!==p.approvedMaximumSpendUsd||!await Tt(o.plan,p):!["cancelled","stopping"].includes(o.phase)))throw new h("managed_modification_receipt_mismatch","The action differs from the exact reviewed execution.")}return t}d($u,"parseAndVerifyManagedModificationExecutionReceipt");async function Bu(i,n){let t=Au.parse(i),{contentHash:a,...r}=t,s=await It(t.request);if(t.sourceForm&&uc(t.sourceForm,s,t.plan.maximumSpendUsd),s.startingProfile&&t.method!=="neuron_steering")throw new h("managed_modification_saved_source_unsupported","Saved steering sources currently require neuron steering.");let o=s.variants.filter(c=>c.profile!==null).length;if(t.teamId!==n.teamId||t.id!==n.id||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||a!==await u(r)||t.plan.inputHash!==await u(s)||(t.method==="inspect_activations"?o>0:o===0||o===s.variants.length)||t.plan.maximumSpendUsd!==k(t.plan.maximumSpendUsd)||!!t.result!=!!t.resultRecordedAt||Date.parse(t.plan.expiresAt)<=Date.parse(t.plan.createdAt))throw new h("managed_modification_execution_mismatch","The execution differs from its retained identity, request or capture.");return t.result&&await Ji(t.result,s),t}d(Bu,"parseAndVerifyManagedModificationExecution");function uc(i,n,t){if(m(i.startingProfile??null)!==m(n.startingProfile?vs(n.startingProfile):null))throw new h("managed_modification_authoring_mismatch","Retain the exact saved steering source through preparation.");if(!i.baseModel||i.baseModel.modelId!==n.model.modelId||i.baseModel.revision!==n.model.revision||k(i.maximumSpendUsd)!==t)throw new h("managed_modification_authoring_mismatch","The retained form differs from this exact model or spending cap.")}d(uc,"verifySourceForm");var Fu=10*1024*1024;function Ou(i){async function n(t){let a="action"in t?Re(t):await lc(t),r="action"in a?`/v1/training/modification-executions/${encodeURIComponent(a.id)}/${a.action}`:"/v1/training/modification-executions/prepare";return $u(await i(r,{method:"POST",body:m(a)}),a)}return d(n,"mutate"),{async compileModificationExecution(t){let a=br(t);return ku(await i("/v1/training/modification-executions/compile",{method:"POST",body:m(a)}),a)},prepareModificationExecution(t){return n(t)},startModificationExecution(t){return n(t)},cancelModificationExecution(t){return n(t)},async listModificationExecutions(t,a={},r={}){let s=Y.parse(t),o=xr.parse(a),c=new URLSearchParams({teamId:s});for(let[l,p]of Object.entries(o))c.set(l,String(p));return Nu(await i(`/v1/training/modification-executions?${c}`,{signal:r.signal}),{teamId:s,query:o,ownerUserId:r.ownerUserId})},async getModificationExecution(t,a,r={}){let s=Y.parse(t),o=Y.parse(a),c=new URLSearchParams({teamId:s});return Bu(await i(`/v1/training/modification-executions/${encodeURIComponent(o)}?${c}`,{signal:r.signal},Fu),{teamId:s,id:o})}}}d(Ou,"createManagedModificationExecutionClient");var W=e.string().trim().min(1).max(240),He=e.string().regex(/^[a-f0-9]{64}$/),Lu=e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48),On=e.literal("engram_adapter"),tn=Ue,Wu=e.object({schemaVersion:e.literal("openpond.engramExecutionCapability.v1"),teamId:W,actorId:W,query:tn,requestHash:He,checkedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),validationLevel:Cn.nullable(),execution:e.discriminatedUnion("state",[e.object({state:e.literal("unavailable"),code:e.enum(["model_not_supported","runtime_not_qualified"]),reason:e.string().min(1).max(1e3)}).strict(),e.object({state:e.literal("ready"),model:B,config:jn,runtime:e.object({id:W,releaseHash:He,imageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),requestSchema:e.literal("openpond.engramTrainingRequest.v1"),evidence:e.object({id:W,contentHash:He}).strict()}).strict(),limits:e.object({maximumExamples:e.number().int().min(1).max(1e3),maximumDataBytes:e.number().int().positive().max(8388608),maximumSteps:e.number().int().min(1).max(128),maximumSequenceLength:e.number().int().min(2).max(8192),maximumDurationSeconds:e.number().finite().min(1).max(21600),maximumCheckpointBytes:e.number().int().positive().max(2147483648)}).strict()}).strict()])}).strict(),Gu=Wu.extend({contentHash:He}),pc=e.object({teamId:W,projectId:W.nullable(),method:On,query:tn,form:Vt}).strict(),Ju=e.object({schemaVersion:e.literal("openpond.managedEngramCompilation.v1"),teamId:W,actorId:W,projectId:W.nullable(),method:On,query:tn,formHash:He,inputHash:He,request:Sa}).strict(),Qu=Ju.extend({contentHash:He}),Ku=e.object({teamId:W,operationId:W,projectId:W.nullable(),name:e.string().trim().min(1).max(500),method:On,query:tn,request:Sa,maximumSpendUsd:Lu.nullish(),sourceForm:Vt.optional()}).strict(),Xu=Bn,Yu=Fn,Ta=en.omit({method:!0}).extend({method:On}).strict(),Zu=Ta.extend({schemaVersion:e.literal("openpond.managedEngramExecution.v1"),request:Sa,sourceForm:Vt.optional(),result:Li.nullable(),resultRecordedAt:e.iso.datetime().nullable()}).strict(),ep=Zu.extend({contentHash:He}),tp=e.object({schemaVersion:e.literal("openpond.managedEngramExecutionReceipt.v1"),operationId:W,requestHash:He,execution:Ta}).strict(),np=tp.extend({contentHash:He}),ji=e.object({method:On.default("engram_adapter"),id:W.optional(),projectId:W.optional(),phase:Ta.shape.phase.optional(),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),ap=Ta.extend({model:B}).strict(),ip=e.object({schemaVersion:e.literal("openpond.managedEngramExecutionPage.v1"),teamId:W,ownerUserId:W,query:ji,items:e.array(ap).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),rp=ip.extend({contentHash:He});function op(i){let n=Object.entries(i).map(([t,a])=>{if(!a.trim())throw new h("engram_training_settings_missing","Complete each Engram training setting before preparing.");return[t,Number(a)]});return Oi.parse(Object.fromEntries(n))}d(op,"parseEngramFormTraining");function le(){throw new h("engram_execution_mismatch","The Engram operation differs from its exact model, data, settings or original approval.")}d(le,"fail3");function Ma(i,n){(i.source!=="managed"||i.modelAssetId!==void 0||!i.revision||!i.tokenizerRevision||i.modelId!==n.model.modelId||i.revision!==n.model.revision)&&le()}d(Ma,"checkSource");async function Ra(i,n){(!i.baseModel||i.baseModel.modelId!==n.model.modelId||i.baseModel.revision!==n.model.revision||m(i.batch)!==m(n.data.batch)||m(op(i.training))!==m(n.training)||m(i.parentArtifact)!==m(n.parentArtifact))&&le(),i.startingModule&&(m(i.startingModule.artifact)!==m(n.parentArtifact)||i.startingModule.modelHash!==await u(n.model))&&le()}d(Ra,"checkForm");function hc(i,n){let t={schemaVersion:"openpond.baseModelPreference.v1",modelId:n.modelId,source:n.source,revision:n.revision??null,tokenizerRevision:n.tokenizerRevision??null,chatTemplateHash:n.chatTemplateHash??null,modelAssetId:n.modelAssetId??null};m(i.baseModel)!==m(t)&&le()}d(hc,"checkFormQuery");async function sp(i,n,t){let a=tn.parse(n),r=Gu.parse(i),{contentHash:s,...o}=r;qn(r.execution,r.validationLevel);let c=Date.parse(r.checkedAt),l=Date.parse(r.expiresAt);return(r.teamId!==a.teamId||t!==void 0&&r.actorId!==t||m(r.query)!==m(a)||r.requestHash!==await u(a)||s!==await u(o)||c>Date.now()+3e4||l<=Date.now()||l<=c||l-c>3e5)&&le(),r.execution.state==="ready"&&Ma(a,{model:r.execution.model}),r}d(sp,"parseAndVerifyEngramExecutionCapability");async function cp(i,n){let t=pc.parse(n),a=Qu.parse(i),{contentHash:r,...s}=a,o=await Lt(a.request);return Ma(t.query,o),await Ra(t.form,o),hc(t.form,t.query),(r!==await u(s)||a.teamId!==t.teamId||t.query.teamId!==t.teamId||a.projectId!==t.projectId||m(a.query)!==m(t.query)||a.formHash!==await u(t.form)||a.inputHash!==await u(o))&&le(),a}d(cp,"parseAndVerifyManagedEngramCompilation");async function dp(i,n){let t=ep.parse(i),{contentHash:a,...r}=t,s=await Lt(t.request);return(a!==await u(r)||t.teamId!==n.teamId||t.id!==n.id||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||t.plan.inputHash!==await u(s)||t.result===null&&t.resultRecordedAt!==null||t.result!==null&&t.resultRecordedAt===null)&&le(),t.sourceForm&&await Ra(t.sourceForm,s),t.result&&await zd(t.result,{request:s,runtimeHash:t.plan.runtimeHash}),t}d(dp,"parseAndVerifyManagedEngramExecution");async function gc(i){let n=Ku.parse(i);return n.maximumSpendUsd=k(n.maximumSpendUsd),await Lt(n.request),Ma(n.query,n.request),n.query.teamId!==n.teamId&&le(),n.sourceForm&&(await Ra(n.sourceForm,n.request),hc(n.sourceForm,n.query),k(n.sourceForm.maximumSpendUsd)!==n.maximumSpendUsd&&le()),n}d(gc,"parseAndVerifyManagedEngramPrepare");async function di(i,n){let t="action"in n?Re(n):await gc(n),a=np.parse(i),{contentHash:r,...s}=a;return(r!==await u(s)||a.operationId!==t.operationId||a.requestHash!==await u("action"in t?t:{action:"prepare",command:t})||a.execution.teamId!==t.teamId||Date.parse(a.execution.plan.expiresAt)<=Date.parse(a.execution.plan.createdAt)||a.execution.plan.maximumSpendUsd!==k(a.execution.plan.maximumSpendUsd))&&le(),"action"in t?(a.execution.id!==t.id||a.execution.plan.contentHash!==t.planHash||a.execution.revision!==t.expectedRevision+1||(t.action==="start"?a.execution.phase!=="queued"||a.execution.plan.maximumSpendUsd!==t.approvedMaximumSpendUsd||!await Tt(a.execution.plan,t):!["cancelled","stopping"].includes(a.execution.phase)))&&le():(await Lt(t.request),Ma(t.query,t.request),(t.query.teamId!==t.teamId||a.execution.projectId!==t.projectId||a.execution.name!==t.name||a.execution.plan.inputHash!==await u(t.request)||a.execution.plan.maximumSpendUsd!==t.maximumSpendUsd||a.execution.phase!=="prepared"||a.execution.revision!==1||a.execution.id!==`modification-${await u({teamId:t.teamId,ownerUserId:a.execution.ownerUserId,operationId:t.operationId})}`)&&le(),t.sourceForm&&await Ra(t.sourceForm,t.request)),a}d(di,"parseAndVerifyManagedEngramExecutionReceipt");function fc(i={}){let n=ji.parse(i);return ji.parse(Object.fromEntries(Object.entries(n).filter(([,t])=>t!==void 0)))}d(fc,"parseExecutionListQuery");async function mp(i,n){let t=rp.parse(i),{contentHash:a,...r}=t,s=fc(n.query);(a!==await u(r)||t.teamId!==n.teamId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||m(t.query)!==m(s)||t.items.length>s.limit||new Set(t.items.map(o=>o.id)).size!==t.items.length)&&le();for(let o of t.items)(o.teamId!==t.teamId||o.ownerUserId!==t.ownerUserId||s.id!==void 0&&o.id!==s.id||s.projectId!==void 0&&o.projectId!==s.projectId||s.phase!==void 0&&o.phase!==s.phase||o.plan.maximumSpendUsd!==k(o.plan.maximumSpendUsd)||Date.parse(o.plan.expiresAt)<=Date.parse(o.plan.createdAt))&&le();return t}d(mp,"parseAndVerifyManagedEngramExecutionPage");function mi(i){let n=new URLSearchParams;for(let[t,a]of Object.entries(i))a!==void 0&&n.set(t,String(a));return n}d(mi,"params");function lp(i){let n="/v1/training/modification-executions";return{async engramExecutionCapability(t,a){let r=tn.parse(t);return sp(await i(`/v1/training/modification-capabilities/engram?${mi(r)}`,a),r)},async compileEngramExecution(t){let a=pc.parse(t);return cp(await i(`${n}/compile`,{method:"POST",body:m(a)}),a)},async prepareEngramExecution(t){let a=await gc(t);return di(await i(`${n}/prepare`,{method:"POST",body:m(a)}),a)},async startEngramExecution(t){let a=Re(Xu.parse(t));return di(await i(`${n}/${encodeURIComponent(a.id)}/start`,{method:"POST",body:m(a)}),a)},async cancelEngramExecution(t){let a=Yu.parse(t);return di(await i(`${n}/${encodeURIComponent(a.id)}/cancel`,{method:"POST",body:m(a)}),a)},async getEngramExecution(t,a,r){let s={teamId:W.parse(t),id:W.parse(a),ownerUserId:r?.ownerUserId};return dp(await i(`${n}/${encodeURIComponent(s.id)}?${mi({teamId:s.teamId})}`,{signal:r?.signal}),s)},async listEngramExecutions(t,a={},r){let s=W.parse(t),o=fc(a);return mp(await i(`${n}?${mi({teamId:s,...o})}`,{signal:r?.signal}),{teamId:s,query:o,ownerUserId:r?.ownerUserId})}}}d(lp,"createManagedEngramExecutionClient");var G=e.string().trim().min(1).max(240),je=e.string().regex(/^[a-f0-9]{64}$/),up=e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48),Ln=e.literal("decision_model"),Wn=e.enum(["train","score"]),nn=Ue,Ea=e.discriminatedUnion("schemaVersion",[ar,ya]),pp=e.discriminatedUnion("schemaVersion",[rr,nr]),hp=e.object({schemaVersion:e.literal("openpond.decisionExecutionCapability.v1"),teamId:G,actorId:G,query:nn,requestHash:je,checkedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),validationLevel:Cn.nullable(),execution:e.discriminatedUnion("state",[e.object({state:e.literal("unavailable"),code:e.enum(["model_not_supported","runtime_not_qualified"]),reason:e.string().min(1).max(1e3)}).strict(),e.object({state:e.literal("ready"),model:Qt,runtime:e.object({id:G,releaseHash:je,imageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),requestSchemas:e.tuple([e.literal("openpond.decisionTrainingRequest.v1"),e.literal("openpond.decisionScoringRequest.v1")]),evidence:e.object({id:G,contentHash:je}).strict()}).strict(),limits:e.object({train:e.object({maximumExamples:e.number().int().min(1).max(4096),maximumDataBytes:e.number().int().positive().max(8388608),maximumSteps:e.number().int().min(1).max(4096),maximumGradientAccumulationSteps:e.number().int().min(1).max(64),maximumPromptTokens:e.number().int().min(1).max(2048),maximumForwardTokenWork:e.number().int().positive().max(536870912),maximumDurationSeconds:e.number().finite().min(1).max(21600),maximumCheckpointBytes:e.number().int().positive().max(268435456)}).strict(),score:e.object({maximumQuestions:e.number().int().min(1).max(8),maximumChoicesPerQuestion:e.number().int().min(2).max(26),maximumStateBytes:e.number().int().positive().max(65536),maximumPromptTokens:e.number().int().min(1).max(2048),maximumForwardTokenWork:e.number().int().positive().max(65536),maximumDurationSeconds:e.number().finite().positive().max(300)}).strict()}).strict()}).strict()])}).strict(),gp=hp.extend({contentHash:je}),fp=e.object({teamId:G,projectId:G.nullable(),method:Ln,mode:Wn,query:nn,form:zt}).strict(),vp=e.object({schemaVersion:e.literal("openpond.managedDecisionCompilation.v1"),teamId:G,actorId:G,projectId:G.nullable(),method:Ln,mode:Wn,query:nn,formHash:je,inputHash:je,request:Ea}).strict(),bp=vp.extend({contentHash:je}),Ip=e.object({teamId:G,operationId:G,projectId:G.nullable(),name:e.string().trim().min(1).max(500),method:Ln,mode:Wn,query:nn,request:Ea,maximumSpendUsd:up.nullish(),sourceForm:zt.optional()}).strict(),Sp=Bn,xp=Fn,Pa=en.omit({method:!0}).extend({method:Ln,mode:Wn}).strict(),yp=Pa.extend({schemaVersion:e.literal("openpond.managedDecisionExecution.v1"),request:Ea,sourceForm:zt.optional(),result:pp.nullable(),resultRecordedAt:e.iso.datetime().nullable()}).strict(),wp=yp.extend({contentHash:je}),_p=e.object({schemaVersion:e.literal("openpond.managedDecisionExecutionReceipt.v1"),operationId:G,requestHash:je,execution:Pa}).strict(),Hp=_p.extend({contentHash:je}),Ti=e.object({method:Ln.default("decision_model"),mode:Wn.optional(),id:G.optional(),projectId:G.optional(),phase:Pa.shape.phase.optional(),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),jp=Pa.extend({model:Qt}).strict(),Tp=e.object({schemaVersion:e.literal("openpond.managedDecisionExecutionPage.v1"),teamId:G,ownerUserId:G,query:Ti,items:e.array(jp).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),Mp=Tp.extend({contentHash:je});function E(){throw new h("decision_execution_mismatch","The decision operation differs from its exact source, mode, input, settings or original approval.")}d(E,"fail4");function ka(i){return i.schemaVersion==="openpond.decisionTrainingRequest.v1"?"train":"score"}d(ka,"requestMode");function vc(i){return{schemaVersion:"openpond.baseModelPreference.v1",modelId:i.modelId,source:i.source,revision:i.revision??null,tokenizerRevision:i.tokenizerRevision??null,chatTemplateHash:i.chatTemplateHash??null,modelAssetId:i.modelAssetId??null}}d(vc,"querySource");function yr(i,n){m(vc(i))!==m(n.source)&&E()}d(yr,"checkSource2");function bc(i){return Object.fromEntries(Object.entries(i).map(([n,t])=>{if(!t.trim())throw new h("decision_settings_missing","Complete each decision setting before compiling.");return[n,Number(t)]}))}d(bc,"formNumbers");function Ic(i){return Ms.parse(bc(i))}d(Ic,"parseDecisionFormTraining");function Sc(i){return{input:kn.parse({state:Br(i.stateJson,131072,"Decision state"),questions:i.questions.map(t=>({...t,choices:t.choices.map(a=>{let r=a.value;return t.type==="boolean"?(r!=="false"&&r!=="true"&&E(),r=r==="true"):t.type==="integer_levels"&&(/^-?(0|[1-9]\d*)$/.test(r)||E(),r=Number(r)),{value:r,description:a.description}})}))}),limits:ya.shape.limits.parse(bc(i.limits))}}d(Sc,"parseDecisionFormScoring");async function wr(i,n){let t=n.schemaVersion==="openpond.decisionTrainingRequest.v1"?n.parentArtifact:n.artifact;if((i.mode!==ka(n)||m(i.baseModel)!==m(n.model.source)||m(i.parentArtifact)!==m(t))&&E(),i.startingDecision&&(m(i.startingDecision.artifact)!==m(t)||i.startingDecision.modelHash!==await u(n.model))&&E(),i.mode==="train"&&n.schemaVersion==="openpond.decisionTrainingRequest.v1")(m(i.batch)!==m(n.data.batch)||m(Ic(i.training))!==m(n.training))&&E();else if(i.mode==="score"&&n.schemaVersion==="openpond.decisionScoringRequest.v1"){let a=Sc(i);(m(a.input)!==m(n.input)||m(a.limits)!==m(n.limits))&&E()}else E()}d(wr,"checkForm2");async function Aa(i){let n=Ea.parse(i);return n.schemaVersion==="openpond.decisionTrainingRequest.v1"?ir(n):tr(n)}d(Aa,"verifyRequest");function _r(i){(i.plan.maximumSpendUsd!==k(i.plan.maximumSpendUsd)||Date.parse(i.plan.expiresAt)<=Date.parse(i.plan.createdAt))&&E()}d(_r,"checkPlan");async function xc(i,n,t){let a=nn.parse(n),r=gp.parse(i),{contentHash:s,...o}=r;qn(r.execution,r.validationLevel);let c=Date.parse(r.checkedAt),l=Date.parse(r.expiresAt);return(r.teamId!==a.teamId||t!==void 0&&r.actorId!==t||m(r.query)!==m(a)||r.requestHash!==await u(a)||s!==await u(o)||c>Date.now()+3e4||l<=Date.now()||l<=c||l-c>3e5)&&E(),r.execution.state==="ready"&&(await Kt(r.execution.model),yr(a,r.execution.model)),r}d(xc,"parseAndVerifyDecisionExecutionCapability");async function MI(i,n){let t=await xc(i,i.query,i.actorId),a=await Aa(n),r=t.execution;if(r.state!=="ready")throw new h("decision_runtime_unavailable","This exact decision runtime is not qualified for execution.");if(m(r.model)!==m(a.model)&&E(),a.schemaVersion==="openpond.decisionTrainingRequest.v1"){let s=r.limits.train,o=a.training;(o.maxSteps>s.maximumSteps||o.gradientAccumulationSteps>s.maximumGradientAccumulationSteps||o.maximumPromptTokens>s.maximumPromptTokens||o.maxDurationSeconds>s.maximumDurationSeconds||o.maxCheckpointBytes>s.maximumCheckpointBytes||o.maxSteps*o.gradientAccumulationSteps*o.maximumPromptTokens>s.maximumForwardTokenWork)&&E()}else{let s=r.limits.score;(a.input.questions.length>s.maximumQuestions||a.input.questions.some(o=>o.choices.length>s.maximumChoicesPerQuestion)||aa(a.input.state)>s.maximumStateBytes||a.limits.maximumPromptTokens>s.maximumPromptTokens||a.limits.maximumForwardTokenWork>s.maximumForwardTokenWork||a.limits.maximumDurationSeconds>s.maximumDurationSeconds)&&E()}return r}d(MI,"verifyDecisionExecutionCapabilityRequest");function yc(i){A(i,1048576);let n=fp.parse(i);return(n.query.teamId!==n.teamId||n.mode!==n.form.mode||m(n.form.baseModel)!==m(vc(n.query)))&&E(),n.form.name.trim()||E(),k(n.form.maximumSpendUsd),n.form.mode==="train"?(n.form.batch===null&&E(),Ic(n.form.training)):Sc(n.form),n}d(yc,"parseManagedDecisionCompile");async function Rp(i,n,t){let a=yc(n),r=bp.parse(i),{contentHash:s,...o}=r,c=await Aa(r.request);return yr(a.query,c.model),await wr(a.form,c),(s!==await u(o)||r.teamId!==a.teamId||r.projectId!==a.projectId||t!==void 0&&r.actorId!==t||r.mode!==a.mode||r.mode!==ka(c)||m(r.query)!==m(a.query)||r.formHash!==await u(a.form)||r.inputHash!==await u(c))&&E(),r}d(Rp,"parseAndVerifyManagedDecisionCompilation");async function wc(i){A(i,1048576);let n=Ip.parse(i);n.maximumSpendUsd=k(n.maximumSpendUsd);let t=await Aa(n.request);return(n.query.teamId!==n.teamId||n.mode!==ka(t))&&E(),yr(n.query,t.model),n.sourceForm&&(await wr(n.sourceForm,t),(n.sourceForm.name.trim()!==n.name||k(n.sourceForm.maximumSpendUsd)!==n.maximumSpendUsd)&&E()),n}d(wc,"parseAndVerifyManagedDecisionPrepare");async function Ep(i,n){A(i,1048576);let t=wp.parse(i),{contentHash:a,...r}=t,s=await Aa(t.request);return _r(t),(a!==await u(r)||t.teamId!==n.teamId||t.id!==n.id||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||t.mode!==ka(s)||t.plan.inputHash!==await u(s)||t.result===null&&t.resultRecordedAt!==null||t.result!==null&&t.resultRecordedAt===null||t.phase==="completed"&&t.result===null)&&E(),t.sourceForm&&(await wr(t.sourceForm,s),(t.sourceForm.name.trim()!==t.name||k(t.sourceForm.maximumSpendUsd)!==t.plan.maximumSpendUsd)&&E()),t.result&&(s.schemaVersion==="openpond.decisionTrainingRequest.v1"&&t.result.schemaVersion==="openpond.decisionTrainingResult.v1"?await Em(t.result,{request:s,runtimeHash:t.plan.runtimeHash}):s.schemaVersion==="openpond.decisionScoringRequest.v1"&&t.result.schemaVersion==="openpond.decisionScoringResult.v1"?await ws(t.result,{request:s,runtimeHash:t.plan.runtimeHash}):E()),t}d(Ep,"parseAndVerifyManagedDecisionExecution");async function li(i,n,t){let a="action"in n?Re(n):await wc(n),r=Hp.parse(i),{contentHash:s,...o}=r,c=r.execution;return _r(c),(s!==await u(o)||r.operationId!==a.operationId||c.teamId!==a.teamId||t!==void 0&&c.ownerUserId!==t||r.requestHash!==await u("action"in a?a:{action:"prepare",command:a}))&&E(),"action"in a?(c.id!==a.id||c.plan.contentHash!==a.planHash||c.revision!==a.expectedRevision+1||(a.action==="start"?c.phase!=="queued"||c.plan.maximumSpendUsd!==a.approvedMaximumSpendUsd||!await Tt(c.plan,a):!["cancelled","stopping"].includes(c.phase)))&&E():(c.projectId!==a.projectId||c.name!==a.name||c.mode!==a.mode||c.plan.inputHash!==await u(a.request)||c.plan.maximumSpendUsd!==a.maximumSpendUsd||c.phase!=="prepared"||c.revision!==1||c.id!==`modification-${await u({teamId:a.teamId,ownerUserId:c.ownerUserId,operationId:a.operationId})}`)&&E(),r}d(li,"parseAndVerifyManagedDecisionExecutionReceipt");function _c(i={}){let n=Ti.parse(i);return Ti.parse(Object.fromEntries(Object.entries(n).filter(([,t])=>t!==void 0)))}d(_c,"parseExecutionListQuery2");async function Pp(i,n){let t=Mp.parse(i),{contentHash:a,...r}=t,s=_c(n.query);(a!==await u(r)||t.teamId!==n.teamId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||m(t.query)!==m(s)||t.items.length>s.limit||new Set(t.items.map(o=>o.id)).size!==t.items.length||t.nextCursor!==null&&(t.items.length!==s.limit||t.nextCursor===s.cursor))&&E();for(let[o,c]of t.items.entries()){let l=t.items[o-1];_r(c),await Kt(c.model),(c.teamId!==t.teamId||c.ownerUserId!==t.ownerUserId||s.mode!==void 0&&c.mode!==s.mode||s.id!==void 0&&c.id!==s.id||s.projectId!==void 0&&c.projectId!==s.projectId||s.phase!==void 0&&c.phase!==s.phase||l&&(Date.parse(l.plan.createdAt)<Date.parse(c.plan.createdAt)||Date.parse(l.plan.createdAt)===Date.parse(c.plan.createdAt)&&l.id<=c.id))&&E()}return t}d(Pp,"parseAndVerifyManagedDecisionExecutionPage");function ui(i){let n=new URLSearchParams;for(let[t,a]of Object.entries(i))a!==void 0&&n.set(t,String(a));return n}d(ui,"params2");function kp(i){let n="/v1/training/modification-executions";return{async decisionExecutionCapability(t,a){let r=nn.parse(t);return xc(await i(`/v1/training/modification-capabilities/decision?${ui(r)}`,{signal:a?.signal}),r,a?.ownerUserId)},async compileDecisionExecution(t,a){let r=yc(t);return Rp(await i(`${n}/compile`,{method:"POST",body:m(r),signal:a?.signal}),r,a?.ownerUserId)},async prepareDecisionExecution(t,a){let r=await wc(t);return li(await i(`${n}/prepare`,{method:"POST",body:m(r),signal:a?.signal}),r,a?.ownerUserId)},async startDecisionExecution(t,a){let r=Re(Sp.parse(t));return li(await i(`${n}/${encodeURIComponent(r.id)}/start`,{method:"POST",body:m(r),signal:a?.signal}),r,a?.ownerUserId)},async cancelDecisionExecution(t,a){let r=Re(xp.parse(t));return li(await i(`${n}/${encodeURIComponent(r.id)}/cancel`,{method:"POST",body:m(r),signal:a?.signal}),r,a?.ownerUserId)},async getDecisionExecution(t,a,r){let s={teamId:G.parse(t),id:G.parse(a),ownerUserId:r?.ownerUserId};return Ep(await i(`${n}/${encodeURIComponent(s.id)}?${ui({teamId:s.teamId})}`,{signal:r?.signal}),s)},async listDecisionExecutions(t,a={},r){let s=G.parse(t),o=_c(a);return Pp(await i(`${n}?${ui({teamId:s,...o})}`,{signal:r?.signal}),{teamId:s,query:o,ownerUserId:r?.ownerUserId})}}}d(kp,"createManagedDecisionExecutionClient");var J=e.string().trim().min(1).max(240),Te=e.string().regex(/^[a-f0-9]{64}$/),Ap=e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48),Gn=e.literal("alphaedit"),an=Ue,Cp=e.object({schemaVersion:e.literal("openpond.alphaEditExecutionCapability.v1"),teamId:J,actorId:J,query:an,requestHash:Te,checkedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),validationLevel:Cn.nullable(),execution:e.discriminatedUnion("state",[e.object({state:e.literal("unavailable"),code:e.enum(["model_not_supported","runtime_not_qualified"]),reason:e.string().min(1).max(1e3)}).strict(),e.object({state:e.literal("ready"),model:B,runtime:e.object({id:J,releaseHash:Te,imageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),requestSchema:e.literal("openpond.alphaEditTrainingRequest.v1"),evidence:e.object({id:J,contentHash:Te}).strict()}).strict(),limits:e.object({maximumExamples:e.number().int().min(1).max(4096),maximumDataBytes:e.number().int().positive().max(8388608),maximumSteps:e.number().int().min(1).max(128),maximumSequenceLength:e.number().int().min(2).max(8192),maximumDurationSeconds:e.number().finite().min(1).max(21600),maximumCheckpointBytes:e.number().int().positive().max(17179869184)}).strict()}).strict()])}).strict(),qp=Cp.extend({contentHash:Te}),Hc=e.object({teamId:J,projectId:J.nullable(),method:Gn,query:an,form:ut}).strict(),zp=e.object({schemaVersion:e.literal("openpond.managedAlphaEditCompilation.v1"),teamId:J,actorId:J,projectId:J.nullable(),method:Gn,query:an,formHash:Te,inputHash:Te,request:it}).strict(),Dp=zp.extend({contentHash:Te}),Up=e.object({teamId:J,operationId:J,projectId:J.nullable(),name:e.string().trim().min(1).max(500),method:Gn,query:an,request:it,maximumSpendUsd:Ap.nullish(),sourceForm:ut.optional()}).strict(),Vp=Bn,Np=Fn,Ca=en.omit({method:!0}).extend({method:Gn}).strict(),$p=Ca.extend({schemaVersion:e.literal("openpond.managedAlphaEditExecution.v1"),request:it,sourceForm:ut.optional(),result:dr.nullable(),resultRecordedAt:e.iso.datetime().nullable()}).strict(),Bp=$p.extend({contentHash:Te}),Fp=e.object({schemaVersion:e.literal("openpond.managedAlphaEditExecutionReceipt.v1"),operationId:J,requestHash:Te,execution:Ca}).strict(),Op=Fp.extend({contentHash:Te}),Mi=e.object({method:Gn.default("alphaedit"),id:J.optional(),projectId:J.optional(),phase:Ca.shape.phase.optional(),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),Lp=Ca.extend({model:B}).strict(),Wp=e.object({schemaVersion:e.literal("openpond.managedAlphaEditExecutionPage.v1"),teamId:J,ownerUserId:J,query:Mi,items:e.array(Lp).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),Gp=Wp.extend({contentHash:Te});function Jp(i){let n=Object.entries(i).map(([t,a])=>{if(!a.trim())throw new h("alphaedit_training_settings_missing","Complete each AlphaEdit training setting before preparing.");return[t,Number(a)]});return cr.parse(Object.fromEntries(n))}d(Jp,"parseAlphaEditFormTraining");function ue(){throw new h("alphaedit_execution_mismatch","The AlphaEdit operation differs from its exact model, data, settings or original approval.")}d(ue,"fail5");function qa(i,n){(i.source!=="managed"||i.modelAssetId!==void 0||!i.revision||!i.tokenizerRevision||i.modelId!==n.model.modelId||i.revision!==n.model.revision)&&ue()}d(qa,"checkSource3");function Qp(i){let n;try{n=JSON.parse(i.contextTemplateGroups)}catch{throw new h("alphaedit_context_invalid","Enter valid JSON context-template groups.")}if(!i.layers.trim()||i.layers.split(",").some(t=>!/^\s*\d+\s*$/.test(t)))throw new h("alphaedit_layers_invalid","Enter comma-separated layer indexes.");if(![i.lossLayer,i.nullspaceThreshold,i.l2].every(t=>t.trim()))throw new h("alphaedit_config_missing","Complete the AlphaEdit configuration.");return Yt.parse({...Rt,layers:i.layers.split(",").map(Number),lossLayer:Number(i.lossLayer),contextTemplateGroups:n,nullspaceThreshold:Number(i.nullspaceThreshold),l2:Number(i.l2)})}d(Qp,"parseAlphaEditFormConfig");async function za(i,n){(!i.baseModel||i.baseModel.modelId!==n.model.modelId||i.baseModel.revision!==n.model.revision||m(i.editsBatch)!==m(n.data.edits.batch)||m(i.preservationBatch)!==m(n.data.preservation.batch)||m(Qp(i.config))!==m(n.config)||m(Jp(i.training))!==m(n.training)||m(i.parentArtifact)!==m(n.parentArtifact))&&ue(),i.startingModule&&(m(i.startingModule.artifact)!==m(n.parentArtifact)||i.startingModule.modelHash!==await u(n.model))&&ue()}d(za,"checkForm3");function jc(i,n){let t={schemaVersion:"openpond.baseModelPreference.v1",modelId:n.modelId,source:n.source,revision:n.revision??null,tokenizerRevision:n.tokenizerRevision??null,chatTemplateHash:n.chatTemplateHash??null,modelAssetId:n.modelAssetId??null};m(i.baseModel)!==m(t)&&ue()}d(jc,"checkFormQuery2");async function Kp(i,n,t){let a=an.parse(n),r=qp.parse(i),{contentHash:s,...o}=r;qn(r.execution,r.validationLevel);let c=Date.parse(r.checkedAt),l=Date.parse(r.expiresAt);return(r.teamId!==a.teamId||t!==void 0&&r.actorId!==t||m(r.query)!==m(a)||r.requestHash!==await u(a)||s!==await u(o)||c>Date.now()+3e4||l<=Date.now()||l<=c||l-c>3e5)&&ue(),r.execution.state==="ready"&&qa(a,{model:r.execution.model}),r}d(Kp,"parseAndVerifyAlphaEditExecutionCapability");async function Xp(i,n){let t=Hc.parse(n),a=Dp.parse(i),{contentHash:r,...s}=a,o=await _a(a.request);return qa(t.query,o),await za(t.form,o),jc(t.form,t.query),(r!==await u(s)||a.teamId!==t.teamId||t.query.teamId!==t.teamId||a.projectId!==t.projectId||m(a.query)!==m(t.query)||a.formHash!==await u(t.form)||a.inputHash!==await u(o))&&ue(),a}d(Xp,"parseAndVerifyManagedAlphaEditCompilation");async function Yp(i,n){let t=Bp.parse(i),{contentHash:a,...r}=t,s=await _a(t.request);return(a!==await u(r)||t.teamId!==n.teamId||t.id!==n.id||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||t.plan.inputHash!==await u(s)||t.result===null&&t.resultRecordedAt!==null||t.result!==null&&t.resultRecordedAt===null)&&ue(),t.sourceForm&&await za(t.sourceForm,s),t.result&&await Ym(t.result,{request:s,runtimeHash:t.plan.runtimeHash}),t}d(Yp,"parseAndVerifyManagedAlphaEditExecution");async function Tc(i){let n=Up.parse(i);return n.maximumSpendUsd=k(n.maximumSpendUsd),await _a(n.request),qa(n.query,n.request),n.query.teamId!==n.teamId&&ue(),n.sourceForm&&(await za(n.sourceForm,n.request),jc(n.sourceForm,n.query),k(n.sourceForm.maximumSpendUsd)!==n.maximumSpendUsd&&ue()),n}d(Tc,"parseAndVerifyManagedAlphaEditPrepare");async function pi(i,n){let t="action"in n?Re(n):await Tc(n),a=Op.parse(i),{contentHash:r,...s}=a;return(r!==await u(s)||a.operationId!==t.operationId||a.requestHash!==await u("action"in t?t:{action:"prepare",command:t})||a.execution.teamId!==t.teamId||Date.parse(a.execution.plan.expiresAt)<=Date.parse(a.execution.plan.createdAt)||a.execution.plan.maximumSpendUsd!==k(a.execution.plan.maximumSpendUsd))&&ue(),"action"in t?(a.execution.id!==t.id||a.execution.plan.contentHash!==t.planHash||a.execution.revision!==t.expectedRevision+1||(t.action==="start"?a.execution.phase!=="queued"||a.execution.plan.maximumSpendUsd!==t.approvedMaximumSpendUsd||!await Tt(a.execution.plan,t):!["cancelled","stopping"].includes(a.execution.phase)))&&ue():(await _a(t.request),qa(t.query,t.request),(t.query.teamId!==t.teamId||a.execution.projectId!==t.projectId||a.execution.name!==t.name||a.execution.plan.inputHash!==await u(t.request)||a.execution.plan.maximumSpendUsd!==t.maximumSpendUsd||a.execution.phase!=="prepared"||a.execution.revision!==1||a.execution.id!==`modification-${await u({teamId:t.teamId,ownerUserId:a.execution.ownerUserId,operationId:t.operationId})}`)&&ue(),t.sourceForm&&await za(t.sourceForm,t.request)),a}d(pi,"parseAndVerifyManagedAlphaEditExecutionReceipt");function Mc(i={}){let n=Mi.parse(i);return Mi.parse(Object.fromEntries(Object.entries(n).filter(([,t])=>t!==void 0)))}d(Mc,"parseExecutionListQuery3");async function Zp(i,n){let t=Gp.parse(i),{contentHash:a,...r}=t,s=Mc(n.query);(a!==await u(r)||t.teamId!==n.teamId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||m(t.query)!==m(s)||t.items.length>s.limit||new Set(t.items.map(o=>o.id)).size!==t.items.length)&&ue();for(let o of t.items)(o.teamId!==t.teamId||o.ownerUserId!==t.ownerUserId||s.id!==void 0&&o.id!==s.id||s.projectId!==void 0&&o.projectId!==s.projectId||s.phase!==void 0&&o.phase!==s.phase||o.plan.maximumSpendUsd!==k(o.plan.maximumSpendUsd)||Date.parse(o.plan.expiresAt)<=Date.parse(o.plan.createdAt))&&ue();return t}d(Zp,"parseAndVerifyManagedAlphaEditExecutionPage");function hi(i){let n=new URLSearchParams;for(let[t,a]of Object.entries(i))a!==void 0&&n.set(t,String(a));return n}d(hi,"params3");function eh(i){let n="/v1/training/modification-executions";return{async alphaEditExecutionCapability(t,a){let r=an.parse(t);return Kp(await i(`/v1/training/modification-capabilities/alphaedit?${hi(r)}`,a),r)},async compileAlphaEditExecution(t){let a=Hc.parse(t);return Xp(await i(`${n}/compile`,{method:"POST",body:m(a)}),a)},async prepareAlphaEditExecution(t){let a=await Tc(t);return pi(await i(`${n}/prepare`,{method:"POST",body:m(a)}),a)},async startAlphaEditExecution(t){let a=Re(Vp.parse(t));return pi(await i(`${n}/${encodeURIComponent(a.id)}/start`,{method:"POST",body:m(a)}),a)},async cancelAlphaEditExecution(t){let a=Np.parse(t);return pi(await i(`${n}/${encodeURIComponent(a.id)}/cancel`,{method:"POST",body:m(a)}),a)},async getAlphaEditExecution(t,a,r){let s={teamId:J.parse(t),id:J.parse(a),ownerUserId:r?.ownerUserId};return Yp(await i(`${n}/${encodeURIComponent(s.id)}?${hi({teamId:s.teamId})}`,{signal:r?.signal}),s)},async listAlphaEditExecutions(t,a={},r){let s=J.parse(t),o=Mc(a);return Zp(await i(`${n}?${hi({teamId:s,...o})}`,{signal:r?.signal}),{teamId:s,query:o,ownerUserId:r?.ownerUserId})}}}d(eh,"createManagedAlphaEditExecutionClient");var Q=e.string().trim().min(1).max(240),Me=e.string().regex(/^[a-f0-9]{64}$/),th=e.string().regex(/^(0|[1-9]\d*)(\.\d{1,6})?$/).max(48),Jn=e.literal("selective_neuron_training"),rn=Ue,nh=e.object({schemaVersion:e.literal("openpond.neuronTrainingExecutionCapability.v1"),teamId:Q,actorId:Q,query:rn,requestHash:Me,checkedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),validationLevel:Cn.nullable(),execution:e.discriminatedUnion("state",[e.object({state:e.literal("unavailable"),code:e.enum(["model_not_supported","runtime_not_qualified"]),reason:e.string().min(1).max(1e3)}).strict(),e.object({state:e.literal("ready"),model:B,runtime:e.object({id:Q,releaseHash:Me,imageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),requestSchema:e.literal("openpond.selectiveNeuronTrainingRequest.v1"),evidence:e.object({id:Q,contentHash:Me}).strict()}).strict(),limits:e.object({maximumExamples:e.number().int().min(1).max(4096),maximumDataBytes:e.number().int().positive().max(8388608),maximumSteps:e.number().int().min(1).max(128),maximumSequenceLength:e.number().int().min(2).max(8192),maximumDurationSeconds:e.number().finite().min(1).max(21600),maximumCheckpointBytes:e.number().int().positive().max(16777216)}).strict()}).strict()])}).strict(),ah=nh.extend({contentHash:Me}),Rc=e.object({teamId:Q,projectId:Q.nullable(),method:Jn,query:rn,form:Dn}).strict(),ih=e.object({schemaVersion:e.literal("openpond.managedNeuronTrainingCompilation.v1"),teamId:Q,actorId:Q,projectId:Q.nullable(),method:Jn,query:rn,formHash:Me,inputHash:Me,request:An}).strict(),rh=ih.extend({contentHash:Me}),oh=e.object({teamId:Q,operationId:Q,projectId:Q.nullable(),name:e.string().trim().min(1).max(500),method:Jn,query:rn,request:An,maximumSpendUsd:th.nullish(),sourceForm:Dn.optional()}).strict(),sh=Bn,ch=Fn,Da=en.omit({method:!0}).extend({method:Jn}).strict(),dh=Da.extend({schemaVersion:e.literal("openpond.managedNeuronTrainingExecution.v1"),request:An,sourceForm:Dn.optional(),result:ur.nullable(),resultRecordedAt:e.iso.datetime().nullable()}).strict(),mh=dh.extend({contentHash:Me}),lh=e.object({schemaVersion:e.literal("openpond.managedNeuronTrainingExecutionReceipt.v1"),operationId:Q,requestHash:Me,execution:Da}).strict(),uh=lh.extend({contentHash:Me}),Ri=e.object({method:Jn.default("selective_neuron_training"),id:Q.optional(),projectId:Q.optional(),phase:Da.shape.phase.optional(),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),ph=Da.extend({model:B}).strict(),hh=e.object({schemaVersion:e.literal("openpond.managedNeuronTrainingExecutionPage.v1"),teamId:Q,ownerUserId:Q,query:Ri,items:e.array(ph).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),gh=hh.extend({contentHash:Me});function fh(i){let n=Object.entries(i).map(([t,a])=>{if(!a.trim())throw new h("neuron_training_training_settings_missing","Complete each NeuronTraining training setting before preparing.");return[t,Number(a)]});return lr.parse(Object.fromEntries(n))}d(fh,"parseNeuronTrainingFormTraining");function pe(){throw new h("neuron_training_execution_mismatch","The NeuronTraining operation differs from its exact model, data, settings or original approval.")}d(pe,"fail6");function Ua(i,n){(i.source!=="managed"||i.modelAssetId!==void 0||!i.revision||!i.tokenizerRevision||i.modelId!==n.model.modelId||i.revision!==n.model.revision)&&pe()}d(Ua,"checkSource4");function vh(i){if(![i.count,i.maximumBackgroundTargetRatio,i.gradientExamples].every(a=>a.trim()))throw new h("neuron_training_selection_missing","Complete the neuron selection settings.");let n=i.coordinates.trim()?i.coordinates.trim().split(/\r?\n/):null;if(n?.some(a=>!/^\s*\d+\s*:\s*\d+\s*$/.test(a)))throw new h("neuron_training_coordinates_invalid","Enter one layer:neuron coordinate per line.");let t=n?.map(a=>{let[r,s]=a.split(":").map(Number);return{layer:r,neuron:s}})??null;return _n.parse({count:Number(i.count),span:i.span,backgroundStatistic:i.backgroundStatistic,maximumBackgroundTargetRatio:Number(i.maximumBackgroundTargetRatio),gradientExamples:Number(i.gradientExamples),explicitCoordinates:t})}d(vh,"parseNeuronTrainingFormSelection");async function Va(i,n){(!i.baseModel||i.baseModel.modelId!==n.model.modelId||i.baseModel.revision!==n.model.revision||m(i.targetBatch)!==m(n.data.target.batch)||m(i.background.map(t=>({domain:t.domain.trim(),batch:t.batch})))!==m(n.data.background.map(t=>({domain:t.domain,batch:t.batch})))||m(i.preservationBatch)!==m(n.data.preservation?.batch??null)||m(vh(i.selection))!==m(n.selection)||m(fh(i.training))!==m(n.training))&&pe(),i.inspectionSource&&(!n.selection.explicitCoordinates||i.inspectionSource.modelHash!==await u(n.model))&&pe()}d(Va,"checkForm4");function Ec(i,n){let t={schemaVersion:"openpond.baseModelPreference.v1",modelId:n.modelId,source:n.source,revision:n.revision??null,tokenizerRevision:n.tokenizerRevision??null,chatTemplateHash:n.chatTemplateHash??null,modelAssetId:n.modelAssetId??null};m(i.baseModel)!==m(t)&&pe()}d(Ec,"checkFormQuery3");async function bh(i,n,t){let a=rn.parse(n),r=ah.parse(i),{contentHash:s,...o}=r;qn(r.execution,r.validationLevel);let c=Date.parse(r.checkedAt),l=Date.parse(r.expiresAt);return(r.teamId!==a.teamId||t!==void 0&&r.actorId!==t||m(r.query)!==m(a)||r.requestHash!==await u(a)||s!==await u(o)||c>Date.now()+3e4||l<=Date.now()||l<=c||l-c>3e5)&&pe(),r.execution.state==="ready"&&Ua(a,{model:r.execution.model}),r}d(bh,"parseAndVerifyNeuronTrainingExecutionCapability");async function Ih(i,n){let t=Rc.parse(n),a=rh.parse(i),{contentHash:r,...s}=a,o=await Zt(a.request);return Ua(t.query,o),await Va(t.form,o),Ec(t.form,t.query),(r!==await u(s)||a.teamId!==t.teamId||t.query.teamId!==t.teamId||a.projectId!==t.projectId||m(a.query)!==m(t.query)||a.formHash!==await u(t.form)||a.inputHash!==await u(o))&&pe(),a}d(Ih,"parseAndVerifyManagedNeuronTrainingCompilation");async function Sh(i,n){let t=mh.parse(i),{contentHash:a,...r}=t,s=await Zt(t.request);return(a!==await u(r)||t.teamId!==n.teamId||t.id!==n.id||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||t.plan.inputHash!==await u(s)||t.result===null&&t.resultRecordedAt!==null||t.result!==null&&t.resultRecordedAt===null)&&pe(),t.sourceForm&&await Va(t.sourceForm,s),t.result&&await dl(t.result,{request:s,runtimeHash:t.plan.runtimeHash}),t}d(Sh,"parseAndVerifyManagedNeuronTrainingExecution");async function Pc(i){let n=oh.parse(i);return n.maximumSpendUsd=k(n.maximumSpendUsd),await Zt(n.request),Ua(n.query,n.request),n.query.teamId!==n.teamId&&pe(),n.sourceForm&&(await Va(n.sourceForm,n.request),Ec(n.sourceForm,n.query),k(n.sourceForm.maximumSpendUsd)!==n.maximumSpendUsd&&pe()),n}d(Pc,"parseAndVerifyManagedNeuronTrainingPrepare");async function gi(i,n){let t="action"in n?Re(n):await Pc(n),a=uh.parse(i),{contentHash:r,...s}=a;return(r!==await u(s)||a.operationId!==t.operationId||a.requestHash!==await u("action"in t?t:{action:"prepare",command:t})||a.execution.teamId!==t.teamId||Date.parse(a.execution.plan.expiresAt)<=Date.parse(a.execution.plan.createdAt)||a.execution.plan.maximumSpendUsd!==k(a.execution.plan.maximumSpendUsd))&&pe(),"action"in t?(a.execution.id!==t.id||a.execution.plan.contentHash!==t.planHash||a.execution.revision!==t.expectedRevision+1||(t.action==="start"?a.execution.phase!=="queued"||a.execution.plan.maximumSpendUsd!==t.approvedMaximumSpendUsd||!await Tt(a.execution.plan,t):!["cancelled","stopping"].includes(a.execution.phase)))&&pe():(await Zt(t.request),Ua(t.query,t.request),(t.query.teamId!==t.teamId||a.execution.projectId!==t.projectId||a.execution.name!==t.name||a.execution.plan.inputHash!==await u(t.request)||a.execution.plan.maximumSpendUsd!==t.maximumSpendUsd||a.execution.phase!=="prepared"||a.execution.revision!==1||a.execution.id!==`modification-${await u({teamId:t.teamId,ownerUserId:a.execution.ownerUserId,operationId:t.operationId})}`)&&pe(),t.sourceForm&&await Va(t.sourceForm,t.request)),a}d(gi,"parseAndVerifyManagedNeuronTrainingExecutionReceipt");function kc(i={}){let n=Ri.parse(i);return Ri.parse(Object.fromEntries(Object.entries(n).filter(([,t])=>t!==void 0)))}d(kc,"parseExecutionListQuery4");async function xh(i,n){let t=gh.parse(i),{contentHash:a,...r}=t,s=kc(n.query);(a!==await u(r)||t.teamId!==n.teamId||n.ownerUserId!==void 0&&t.ownerUserId!==n.ownerUserId||m(t.query)!==m(s)||t.items.length>s.limit||new Set(t.items.map(o=>o.id)).size!==t.items.length)&&pe();for(let o of t.items)(o.teamId!==t.teamId||o.ownerUserId!==t.ownerUserId||s.id!==void 0&&o.id!==s.id||s.projectId!==void 0&&o.projectId!==s.projectId||s.phase!==void 0&&o.phase!==s.phase||o.plan.maximumSpendUsd!==k(o.plan.maximumSpendUsd)||Date.parse(o.plan.expiresAt)<=Date.parse(o.plan.createdAt))&&pe();return t}d(xh,"parseAndVerifyManagedNeuronTrainingExecutionPage");function fi(i){let n=new URLSearchParams;for(let[t,a]of Object.entries(i))a!==void 0&&n.set(t,String(a));return n}d(fi,"params4");function yh(i){let n="/v1/training/modification-executions";return{async neuronTrainingExecutionCapability(t,a){let r=rn.parse(t);return bh(await i(`/v1/training/modification-capabilities/neuron-training?${fi(r)}`,a),r)},async compileNeuronTrainingExecution(t){let a=Rc.parse(t);return Ih(await i(`${n}/compile`,{method:"POST",body:m(a)}),a)},async prepareNeuronTrainingExecution(t){let a=await Pc(t);return gi(await i(`${n}/prepare`,{method:"POST",body:m(a)}),a)},async startNeuronTrainingExecution(t){let a=Re(sh.parse(t));return gi(await i(`${n}/${encodeURIComponent(a.id)}/start`,{method:"POST",body:m(a)}),a)},async cancelNeuronTrainingExecution(t){let a=ch.parse(t);return gi(await i(`${n}/${encodeURIComponent(a.id)}/cancel`,{method:"POST",body:m(a)}),a)},async getNeuronTrainingExecution(t,a,r){let s={teamId:Q.parse(t),id:Q.parse(a),ownerUserId:r?.ownerUserId};return Sh(await i(`${n}/${encodeURIComponent(s.id)}?${fi({teamId:s.teamId})}`,{signal:r?.signal}),s)},async listNeuronTrainingExecutions(t,a={},r){let s=Q.parse(t),o=kc(a);return xh(await i(`${n}?${fi({teamId:s,...o})}`,{signal:r?.signal}),{teamId:s,query:o,ownerUserId:r?.ownerUserId})}}}d(yh,"createManagedNeuronTrainingExecutionClient");var kt=e.string().trim().min(1).max(240),Ze=e.string().regex(/^[a-f0-9]{64}$/),wh=e.object({modelProjectId:kt,versionHash:Ze}).strict(),Ac=e.object({schemaVersion:e.literal("openpond.resolvedWeightModelSelection.v1"),method:e.enum(["alphaedit","selective_neuron_training"]),savedModel:wh,artifact:e.object({id:kt,contentHash:Ze,manifestSha256:Ze}).strict(),modelHash:Ze}).strict();async function Hr(i,n){let t=Ac.parse(i),a=n.schemaVersion==="openpond.alphaEditModelVersion.v1"?await rt(n):await xt(n),r=a.schemaVersion==="openpond.alphaEditModelVersion.v1"?"alphaedit":"selective_neuron_training";if(t.method!==r||t.savedModel.modelProjectId!==a.modelProjectId||t.savedModel.versionHash!==a.contentHash||t.artifact.id!==a.artifact.id||t.artifact.contentHash!==a.artifact.contentHash||t.artifact.manifestSha256!==await u(a.artifact.manifest)||t.modelHash!==await u(a.request.model))throw new h("weight_model_selection_mismatch","The admitted Model differs from its exact learned patch and base.");return t}d(Hr,"parseAndVerifyResolvedWeightModelSelection");var _h=e.object({schemaVersion:e.literal("openpond.weightModelInferenceReceipt.v1"),teamId:kt,requestId:kt,requestHash:Ze,selection:Ac,poolId:kt,routingBinding:e.object({id:kt,revision:e.number().int().positive()}).strict(),runtimeHash:Ze,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),engineGeneration:e.number().int().positive(),cacheNamespace:Ze,completedAt:e.iso.datetime()}).strict(),jr=_h.extend({contentHash:Ze});async function AI(i,n){let t=jr.parse(i),{contentHash:a,...r}=t;if(await Hr(t.selection,n.version),a!==await u(r)||t.teamId!==n.teamId||t.requestId!==n.requestId||t.requestHash!==n.requestHash||m(t.selection)!==m(n.selection)||t.poolId!==n.poolId||m(t.routingBinding)!==m(n.routingBinding)||t.runtimeHash!==n.runtimeHash||t.workerImageDigest!==n.workerImageDigest||t.engineGeneration!==n.engineGeneration||t.cacheNamespace!==n.cacheNamespace)throw new h("weight_model_inference_mismatch","The completed inference differs from its admitted Model, runtime or cache.");return t}d(AI,"parseAndVerifyWeightModelInferenceReceipt");var V=e.string().trim().min(1).max(240),wt=e.string().regex(/^[a-f0-9]{64}$/),Hh=e.object({id:V,revision:e.number().int().positive()}).strict(),jh=e.object({teamId:V,versionHash:wt}).strict(),Qn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.alphaEditModelServingControlRequest.v1"),teamId:V,operationId:V,versionHash:wt,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),CI=Qn.omit({operationId:!0}).extend({modelProjectId:V}).strict(),qI=e.object({modelProjectId:V,request:Qn}).strict(),Ei=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.alphaEditModelServingControl.v1"),teamId:V,modelProjectId:V,versionHash:wt,actorId:V,operationId:V,revision:e.number().int().positive(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:e.string().trim().min(1).max(500),poolId:V.nullable(),binding:Hh.nullable(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:V.nullable(),updatedAt:e.iso.datetime()}).strict(),Th=e.object({id:V,revision:e.number().int().positive(),modelId:e.string().trim().min(1).max(500),poolId:V,versionHash:wt}).strict(),Mh=e.object({state:e.enum(["qualified","unavailable"]),reason:e.enum(["qualified","runtime_unavailable","artifact_unavailable","model_mismatch"]),runtimeHash:wt.nullable()}).strict(),Rh=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.alphaEditModelServing.v1"),teamId:V,modelProjectId:V,observedAt:e.iso.datetime(),version:Un,availability:Mh,control:Ei.nullable(),cleanup:e.array(Ei).max(100),pools:e.array(Wt).max(100),bindings:e.array(Th).max(100),lastVerifiedInference:jr.nullable(),state:e.enum(["unavailable","inactive","starting","active","retiring"])}).strict(),Cc=Rh.extend({contentHash:wt}),Eh=e.object({schemaVersion:e.literal("openpond.alphaEditModelServingControlReceipt.v1"),teamId:V,modelProjectId:V,actorId:V,request:Qn,version:Un,control:Ei}).strict(),Ph=Eh.extend({contentHash:wt});function qc(i){return i.modelId===`personalized:model:${i.modelProjectId}`&&(!i.binding||i.poolId!==null)&&(i.phase!=="active"||i.desiredState==="active"&&i.poolId!==null&&i.binding!==null&&["pending","shared"].includes(i.capacityState))&&(i.phase!=="stopping"||i.desiredState==="stopped")&&(i.capacityState!=="released"||!i.binding&&i.activeRequests===0&&i.unsettledRequests===0)&&(i.phase!=="stopped"||i.desiredState==="stopped"&&!i.binding&&i.activeRequests===0&&i.unsettledRequests===0&&["shared","released"].includes(i.capacityState))}d(qc,"validControl2");function kh(i){let n=i.control;if(n?.phase==="stopping"||i.cleanup.some(a=>a.phase!=="stopped"||!["shared","released"].includes(a.capacityState)))return"retiring";if(i.availability.state!=="qualified"||n?.phase==="failed")return"unavailable";if(!n||n.desiredState==="stopped")return i.bindings.length?"unavailable":"inactive";let t=n.binding;return n.phase==="active"&&t&&i.bindings.some(a=>a.id===t.id&&a.revision===t.revision&&a.poolId===n.poolId&&i.pools.some(r=>r.id===a.poolId&&r.state==="ready"&&r.endpointRecorded))?"active":n.phase==="starting"?"starting":"unavailable"}d(kh,"alphaEditModelServingState");async function Ah(i,n){let t=Ph.parse(i),a=Qn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(await rt(t.version,{teamId:a.teamId,modelProjectId:n.modelProjectId,ownerUserId:t.actorId}),!Ot(a,o)||r!==await u(s)||m(t.request)!==m(a)||t.teamId!==a.teamId||t.modelProjectId!==n.modelProjectId||n.actorId!==void 0&&t.actorId!==n.actorId||t.version.contentHash!==a.versionHash||o.teamId!==t.teamId||o.modelProjectId!==t.modelProjectId||o.actorId!==t.actorId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||o.desiredState!==(a.action==="activate"?"active":"stopped")||!qc(o)||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("alphaedit_serving_control_mismatch","The serving receipt differs from the exact AlphaEdit Model or original control command.");return t}d(Ah,"parseAndVerifyAlphaEditModelServingControl");async function zc(i,n){let t=Cc.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"alphaedit"},t.control),await rt(t.version,n);function s(){throw new h("alphaedit_model_serving_mismatch","The serving evidence differs from the exact AlphaEdit Model or retained resource custody.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.version.contentHash!==n.versionHash||t.state!==kh(t)||t.availability.state==="qualified"!=(t.availability.reason==="qualified")||t.availability.state==="qualified"&&t.availability.runtimeHash===null)&&s();for(let l of[t.pools,t.bindings])new Set(l.map(p=>p.id)).size!==l.length&&s();for(let l of[...t.cleanup,...t.control?[t.control]:[]])(l.teamId!==n.teamId||l.modelProjectId!==n.modelProjectId||!qc(l))&&s();(new Set(t.cleanup.map(l=>l.operationId)).size!==t.cleanup.length||t.cleanup.some(l=>l.desiredState!=="stopped"))&&s();let o=t.control;if(o&&o.versionHash!==n.versionHash&&!(o.phase==="stopped"&&o.desiredState==="stopped")&&s(),t.bindings.some(l=>l.versionHash!==n.versionHash||l.modelId!==`personalized:model:${n.modelProjectId}`||!t.pools.some(p=>p.id===l.poolId))&&s(),o?.binding){let l=o.binding;t.bindings.some(p=>p.id===l.id&&p.revision===l.revision&&p.poolId===o.poolId&&p.modelId===o.modelId)||s()}t.pools.some(l=>l.workersMin>l.workersMax)&&s();let c=t.lastVerifiedInference;if(c){let{contentHash:l,...p}=c;await Hr(c.selection,t.version),(l!==await u(p)||c.teamId!==n.teamId||t.pools.some(g=>g.id===c.poolId&&g.workerImageDigest!==c.workerImageDigest))&&s()}return t}d(zc,"parseAndVerifyAlphaEditModelServing");function Ch(i){return{async alphaEditModelServing(n,t,a){let r=V.parse(n),s=jh.parse(t);return zc(await i(`/v1/training/models/${encodeURIComponent(r)}/serving?${new URLSearchParams(s)}`,{signal:a?.signal}),{modelProjectId:r,...s,ownerUserId:a?.ownerUserId})},async controlAlphaEditModelServing(n,t,a){let r=V.parse(n),s=Qn.parse(t);return Ah(await i(`/v1/training/models/${encodeURIComponent(r)}/serving`,{method:"POST",body:m(s),signal:a?.signal}),{modelProjectId:r,request:s,actorId:a?.actorId})}}}d(Ch,"createAlphaEditModelServingClient");var N=e.string().trim().min(1).max(240),_t=e.string().regex(/^[a-f0-9]{64}$/),qh=e.object({id:N,revision:e.number().int().positive()}).strict(),zh=e.object({teamId:N,versionHash:_t}).strict(),Kn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.neuronTrainingModelServingControlRequest.v1"),teamId:N,operationId:N,versionHash:_t,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),DI=Kn.omit({operationId:!0}).extend({modelProjectId:N}).strict(),UI=e.object({modelProjectId:N,request:Kn}).strict(),Pi=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.neuronTrainingModelServingControl.v1"),teamId:N,modelProjectId:N,versionHash:_t,actorId:N,operationId:N,revision:e.number().int().positive(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:e.string().trim().min(1).max(500),poolId:N.nullable(),binding:qh.nullable(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:N.nullable(),updatedAt:e.iso.datetime()}).strict(),Dh=e.object({id:N,revision:e.number().int().positive(),modelId:e.string().trim().min(1).max(500),poolId:N,versionHash:_t}).strict(),Uh=e.object({state:e.enum(["qualified","unavailable"]),reason:e.enum(["qualified","runtime_unavailable","artifact_unavailable","model_mismatch"]),runtimeHash:_t.nullable()}).strict(),Vh=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.neuronTrainingModelServing.v1"),teamId:N,modelProjectId:N,observedAt:e.iso.datetime(),version:Vn,availability:Uh,control:Pi.nullable(),cleanup:e.array(Pi).max(100),pools:e.array(Wt).max(100),bindings:e.array(Dh).max(100),lastVerifiedInference:jr.nullable(),state:e.enum(["unavailable","inactive","starting","active","retiring"])}).strict(),Dc=Vh.extend({contentHash:_t}),Nh=e.object({schemaVersion:e.literal("openpond.neuronTrainingModelServingControlReceipt.v1"),teamId:N,modelProjectId:N,actorId:N,request:Kn,version:Vn,control:Pi}).strict(),$h=Nh.extend({contentHash:_t});function Uc(i){return i.modelId===`personalized:model:${i.modelProjectId}`&&(!i.binding||i.poolId!==null)&&(i.phase!=="active"||i.desiredState==="active"&&i.poolId!==null&&i.binding!==null&&["pending","shared"].includes(i.capacityState))&&(i.phase!=="stopping"||i.desiredState==="stopped")&&(i.capacityState!=="released"||!i.binding&&i.activeRequests===0&&i.unsettledRequests===0)&&(i.phase!=="stopped"||i.desiredState==="stopped"&&!i.binding&&i.activeRequests===0&&i.unsettledRequests===0&&["shared","released"].includes(i.capacityState))}d(Uc,"validControl3");function Bh(i){let n=i.control;if(n?.phase==="stopping"||i.cleanup.some(a=>a.phase!=="stopped"||!["shared","released"].includes(a.capacityState)))return"retiring";if(i.availability.state!=="qualified"||n?.phase==="failed")return"unavailable";if(!n||n.desiredState==="stopped")return i.bindings.length?"unavailable":"inactive";let t=n.binding;return n.phase==="active"&&t&&i.bindings.some(a=>a.id===t.id&&a.revision===t.revision&&a.poolId===n.poolId&&i.pools.some(r=>r.id===a.poolId&&r.state==="ready"&&r.endpointRecorded))?"active":n.phase==="starting"?"starting":"unavailable"}d(Bh,"neuronTrainingModelServingState");async function Fh(i,n){let t=$h.parse(i),a=Kn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(await xt(t.version,{teamId:a.teamId,modelProjectId:n.modelProjectId,ownerUserId:t.actorId}),!Ot(a,o)||r!==await u(s)||m(t.request)!==m(a)||t.teamId!==a.teamId||t.modelProjectId!==n.modelProjectId||n.actorId!==void 0&&t.actorId!==n.actorId||t.version.contentHash!==a.versionHash||o.teamId!==t.teamId||o.modelProjectId!==t.modelProjectId||o.actorId!==t.actorId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||o.desiredState!==(a.action==="activate"?"active":"stopped")||!Uc(o)||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("neuron_training_serving_control_mismatch","The serving receipt differs from the exact neuron-training Model or original control command.");return t}d(Fh,"parseAndVerifyNeuronTrainingModelServingControl");async function Vc(i,n){let t=Dc.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"selective_neuron_training"},t.control),await xt(t.version,n);function s(){throw new h("neuron_training_model_serving_mismatch","The serving evidence differs from the exact neuron-training Model or retained resource custody.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.version.contentHash!==n.versionHash||t.state!==Bh(t)||t.availability.state==="qualified"!=(t.availability.reason==="qualified")||t.availability.state==="qualified"&&t.availability.runtimeHash===null)&&s();for(let l of[t.pools,t.bindings])new Set(l.map(p=>p.id)).size!==l.length&&s();for(let l of[...t.cleanup,...t.control?[t.control]:[]])(l.teamId!==n.teamId||l.modelProjectId!==n.modelProjectId||!Uc(l))&&s();(new Set(t.cleanup.map(l=>l.operationId)).size!==t.cleanup.length||t.cleanup.some(l=>l.desiredState!=="stopped"))&&s();let o=t.control;if(o&&o.versionHash!==n.versionHash&&!(o.phase==="stopped"&&o.desiredState==="stopped")&&s(),t.bindings.some(l=>l.versionHash!==n.versionHash||l.modelId!==`personalized:model:${n.modelProjectId}`||!t.pools.some(p=>p.id===l.poolId))&&s(),o?.binding){let l=o.binding;t.bindings.some(p=>p.id===l.id&&p.revision===l.revision&&p.poolId===o.poolId&&p.modelId===o.modelId)||s()}t.pools.some(l=>l.workersMin>l.workersMax)&&s();let c=t.lastVerifiedInference;if(c){let{contentHash:l,...p}=c;await Hr(c.selection,t.version),(l!==await u(p)||c.teamId!==n.teamId||t.pools.some(g=>g.id===c.poolId&&g.workerImageDigest!==c.workerImageDigest))&&s()}return t}d(Vc,"parseAndVerifyNeuronTrainingModelServing");function Oh(i){return{async neuronTrainingModelServing(n,t,a){let r=N.parse(n),s=zh.parse(t);return Vc(await i(`/v1/training/models/${encodeURIComponent(r)}/serving?${new URLSearchParams(s)}`,{signal:a?.signal}),{modelProjectId:r,...s,ownerUserId:a?.ownerUserId})},async controlNeuronTrainingModelServing(n,t,a){let r=N.parse(n),s=Kn.parse(t);return Fh(await i(`/v1/training/models/${encodeURIComponent(r)}/serving`,{method:"POST",body:m(s),signal:a?.signal}),{modelProjectId:r,request:s,actorId:a?.actorId})}}}d(Oh,"createNeuronTrainingModelServingClient");var we=e.string().trim().min(1).max(240),$e=e.string().regex(/^[a-f0-9]{64}$/),Lh=e.object({id:we,revision:e.number().int().positive()}).strict(),Wh=e.object({modelProjectId:we,versionHash:$e}).strict(),Tr=e.object({schemaVersion:e.literal("openpond.resolvedDecisionSelection.v1"),savedModel:Wh,modelHash:$e,artifact:e.object({id:we,contentHash:$e,payloadSha256:$e}).strict()}).strict(),Gh=e.object({schemaVersion:e.literal("openpond.decisionModelScoreRequest.v1"),teamId:we,requestId:we,versionHash:$e,input:kn,limits:ya.shape.limits}).strict();function Nc(i){return A(i,131072),Gh.parse(i)}d(Nc,"parseDecisionModelScoreRequest");async function Jh(i){let n=await Fe(i);return Tr.parse({schemaVersion:"openpond.resolvedDecisionSelection.v1",savedModel:{modelProjectId:n.modelProjectId,versionHash:n.contentHash},modelHash:await u(n.request.model),artifact:{id:n.artifact.id,contentHash:n.artifact.contentHash,payloadSha256:n.artifact.manifest.payload.sha256}})}d(Jh,"resolvedDecisionSelection");async function $c(i,n){let t=Tr.parse(i);if(m(t)!==m(await Jh(n)))throw new h("decision_selection_mismatch","The scorer selected a different exact decision Model or adapter.");return t}d($c,"parseAndVerifyResolvedDecisionSelection");var Qh=e.object({schemaVersion:e.literal("openpond.decisionModelScoreReceipt.v1"),teamId:we,actorId:we,modelProjectId:we,requestId:we,requestHash:$e,version:Xt,selection:Tr,result:nr,poolId:we,routingBinding:Lh,runtimeHash:$e,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),engineGeneration:e.number().int().positive(),cacheNamespace:$e,cleanupComplete:e.literal(!0),completedAt:e.iso.datetime()}).strict(),Bc=Qh.extend({contentHash:$e});async function Kh(i,n){A(i,1048576);let t=Nc(n.request),a=Bc.parse(i),{contentHash:r,...s}=a,o=await Fe(a.version,{teamId:t.teamId,modelProjectId:n.modelProjectId,ownerUserId:a.actorId,versionHash:t.versionHash});await $c(a.selection,o);let c=await tr({schemaVersion:"openpond.decisionScoringRequest.v1",model:o.request.model,artifact:{id:o.artifact.id,contentHash:o.artifact.contentHash},input:t.input,limits:t.limits});await ws(a.result,{request:c,runtimeHash:a.runtimeHash});function l(){throw new h("decision_model_score_mismatch","The completed score differs from the exact Model, original request or admitted runtime.")}d(l,"fail8"),(r!==await u(s)||a.teamId!==t.teamId||a.modelProjectId!==n.modelProjectId||a.requestId!==t.requestId||n.actorId!==void 0&&a.actorId!==n.actorId||a.requestHash!==await u({modelProjectId:n.modelProjectId,request:t}))&&l();let p=n.admission;return p&&(a.poolId!==p.poolId||m(a.routingBinding)!==m(p.routingBinding)||a.runtimeHash!==p.runtimeHash||a.workerImageDigest!==p.workerImageDigest||p.engineGeneration!==void 0&&a.engineGeneration!==p.engineGeneration||p.cacheNamespace!==void 0&&a.cacheNamespace!==p.cacheNamespace)&&l(),a}d(Kh,"parseAndVerifyDecisionModelScoreReceipt");function Xh(i){return{async scoreDecisionModel(n,t,a){let r=we.parse(n),s=Nc(t);return Kh(await i(`/v1/training/models/${encodeURIComponent(r)}/decisions`,{method:"POST",body:m(s),signal:a?.signal}),{modelProjectId:r,request:s,actorId:a?.actorId,admission:a?.admission})}}}d(Xh,"createDecisionModelScoringClient");var $=e.string().trim().min(1).max(240),Ht=e.string().regex(/^[a-f0-9]{64}$/),Yh=e.object({id:$,revision:e.number().int().positive()}).strict(),Zh=e.object({teamId:$,versionHash:Ht}).strict(),Xn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.decisionModelServingControlRequest.v1"),teamId:$,operationId:$,versionHash:Ht,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),BI=Xn.omit({operationId:!0}).extend({modelProjectId:$}).strict(),FI=e.object({modelProjectId:$,request:Xn}).strict(),ki=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.decisionModelServingControl.v1"),teamId:$,modelProjectId:$,versionHash:Ht,actorId:$,operationId:$,revision:e.number().int().positive(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:e.string().trim().min(1).max(500),poolId:$.nullable(),binding:Yh.nullable(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:$.nullable(),updatedAt:e.iso.datetime()}).strict(),eg=e.object({id:$,revision:e.number().int().positive(),modelId:e.string().trim().min(1).max(500),poolId:$,versionHash:Ht}).strict(),tg=e.object({state:e.enum(["qualified","unavailable"]),reason:e.enum(["qualified","runtime_unavailable","artifact_unavailable","model_mismatch"]),runtimeHash:Ht.nullable()}).strict(),ng=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.decisionModelServing.v1"),teamId:$,modelProjectId:$,observedAt:e.iso.datetime(),version:Xt,availability:tg,control:ki.nullable(),cleanup:e.array(ki).max(100),pools:e.array(Wt).max(100),bindings:e.array(eg).max(100),lastVerifiedScore:Bc.nullable(),state:e.enum(["unavailable","inactive","starting","active","retiring"])}).strict(),Fc=ng.extend({contentHash:Ht}),ag=e.object({schemaVersion:e.literal("openpond.decisionModelServingControlReceipt.v1"),teamId:$,modelProjectId:$,actorId:$,request:Xn,version:Xt,control:ki}).strict(),ig=ag.extend({contentHash:Ht});function Oc(i){return i.modelId===`decision:model:${i.modelProjectId}`&&(!i.binding||i.poolId!==null)&&(i.phase!=="active"||i.desiredState==="active"&&i.poolId!==null&&i.binding!==null&&["pending","shared"].includes(i.capacityState))&&(i.phase!=="stopping"||i.desiredState==="stopped")&&(i.capacityState!=="released"||!i.binding&&i.activeRequests===0&&i.unsettledRequests===0)&&(i.phase!=="stopped"||i.desiredState==="stopped"&&!i.binding&&i.activeRequests===0&&i.unsettledRequests===0&&["shared","released"].includes(i.capacityState))}d(Oc,"validControl4");function rg(i){let n=i.control;if(n?.phase==="stopping"||i.cleanup.some(a=>a.phase!=="stopped"||!["shared","released"].includes(a.capacityState)))return"retiring";if(i.availability.state!=="qualified"||n?.phase==="failed")return"unavailable";if(!n||n.desiredState==="stopped")return i.bindings.length?"unavailable":"inactive";let t=n.binding;return n.phase==="active"&&t&&i.bindings.some(a=>a.id===t.id&&a.revision===t.revision&&a.poolId===n.poolId&&i.pools.some(r=>r.id===a.poolId&&r.state==="ready"&&r.endpointRecorded))?"active":n.phase==="starting"?"starting":"unavailable"}d(rg,"decisionModelServingState");async function og(i,n){let t=ig.parse(i),a=Xn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(await Fe(t.version,{teamId:a.teamId,modelProjectId:n.modelProjectId,ownerUserId:t.actorId,versionHash:a.versionHash}),!Ot(a,o)||r!==await u(s)||m(t.request)!==m(a)||t.teamId!==a.teamId||t.modelProjectId!==n.modelProjectId||n.actorId!==void 0&&t.actorId!==n.actorId||o.teamId!==t.teamId||o.modelProjectId!==t.modelProjectId||o.actorId!==t.actorId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||o.desiredState!==(a.action==="activate"?"active":"stopped")||!Oc(o)||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("decision_serving_control_mismatch","The serving receipt differs from the exact decision Model or original control command.");return t}d(og,"parseAndVerifyDecisionModelServingControl");async function Lc(i,n){let t=Fc.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"decision"},t.control),await Fe(t.version,n);function s(){throw new h("decision_model_serving_mismatch","The serving evidence differs from the exact decision Model or retained resource custody.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.state!==rg(t)||t.availability.state==="qualified"!=(t.availability.reason==="qualified")||t.availability.state==="qualified"&&t.availability.runtimeHash===null)&&s();for(let l of[t.pools,t.bindings])new Set(l.map(p=>p.id)).size!==l.length&&s();for(let l of[...t.cleanup,...t.control?[t.control]:[]])(l.teamId!==n.teamId||l.modelProjectId!==n.modelProjectId||!Oc(l))&&s();(new Set(t.cleanup.map(l=>l.operationId)).size!==t.cleanup.length||t.cleanup.some(l=>l.desiredState!=="stopped"))&&s();let o=t.control;if(o&&o.versionHash!==n.versionHash&&!(o.phase==="stopped"&&o.desiredState==="stopped")&&s(),t.bindings.some(l=>l.versionHash!==n.versionHash||l.modelId!==`decision:model:${n.modelProjectId}`||!t.pools.some(p=>p.id===l.poolId))&&s(),o?.binding){let l=o.binding;t.bindings.some(p=>p.id===l.id&&p.revision===l.revision&&p.poolId===o.poolId&&p.modelId===o.modelId)||s()}t.pools.some(l=>l.workersMin>l.workersMax)&&s();let c=t.lastVerifiedScore;if(c){let{contentHash:l,...p}=c,{contentHash:g,...v}=c.result;await $c(c.selection,t.version),(l!==await u(p)||g!==await u(v)||c.teamId!==n.teamId||c.modelProjectId!==n.modelProjectId||c.actorId!==t.version.ownerUserId||c.version.contentHash!==n.versionHash||m(c.version)!==m(t.version)||c.result.modelHash!==await u(t.version.request.model)||c.result.runtimeHash!==c.runtimeHash||m(c.result.artifact)!==m({id:t.version.artifact.id,contentHash:t.version.artifact.contentHash})||t.pools.some(f=>f.id===c.poolId&&f.workerImageDigest!==c.workerImageDigest))&&s()}return t}d(Lc,"parseAndVerifyDecisionModelServing");function sg(i){return{async decisionModelServing(n,t,a){let r=$.parse(n),s=Zh.parse(t);return Lc(await i(`/v1/training/models/${encodeURIComponent(r)}/serving?${new URLSearchParams(s)}`,{signal:a?.signal}),{modelProjectId:r,...s,ownerUserId:a?.ownerUserId})},async controlDecisionModelServing(n,t,a){let r=$.parse(n),s=Xn.parse(t);return og(await i(`/v1/training/models/${encodeURIComponent(r)}/serving`,{method:"POST",body:m(s),signal:a?.signal}),{modelProjectId:r,request:s,actorId:a?.actorId})}}}d(sg,"createDecisionModelServingClient");async function OI(i,n){let t=await Fe(i,n),a=yt.parse({source:"decision",label:n.label,inferenceModelId:null,baseModel:t.baseModel,decision:{modelProjectId:t.modelProjectId,versionHash:t.contentHash,artifact:{id:t.artifact.id,contentHash:t.artifact.contentHash},modelHash:await u(t.request.model)}});if(a.source!=="decision")throw new h("decision_experiment_source_mismatch","Retain the exact saved decision Model.");return a}d(OI,"experimentStartingModelFromDecisionVersion");async function LI(i,n){let t=await rt(i,n),a=yt.parse({source:"alphaedit",label:n.label,inferenceModelId:null,baseModel:t.baseModel,alphaedit:{modelProjectId:t.modelProjectId,versionHash:t.contentHash,artifact:{id:t.artifact.id,contentHash:t.artifact.contentHash},modelHash:await u(t.request.model)}});if(a.source!=="alphaedit")throw new h("alphaedit_experiment_source_mismatch","Retain the exact saved AlphaEdit Model.");return a}d(LI,"experimentStartingModelFromAlphaEditVersion");async function WI(i,n,t={}){let a=ut.parse(i),r=await rt(n,t);return ut.parse({...a,baseModel:r.baseModel,preservationBatch:r.request.data.preservation.batch,config:{layers:r.request.config.layers.join(", "),lossLayer:String(r.request.config.lossLayer),contextTemplateGroups:JSON.stringify(r.request.config.contextTemplateGroups),nullspaceThreshold:String(r.request.config.nullspaceThreshold),l2:String(r.request.config.l2)},parentArtifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},startingModule:{modelProjectId:r.modelProjectId,versionHash:r.contentHash,artifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},modelHash:await u(r.request.model)}})}d(WI,"alphaEditFormFromModelVersion");async function GI(i,n){let t=await xt(i,n),a=yt.parse({source:"neuron_training",label:n.label,inferenceModelId:null,baseModel:t.baseModel,neuronTraining:{modelProjectId:t.modelProjectId,versionHash:t.contentHash,artifact:{id:t.artifact.id,contentHash:t.artifact.contentHash},modelHash:await u(t.request.model)}});if(a.source!=="neuron_training")throw new h("neuron_training_experiment_source_mismatch","Retain the exact saved neuron weights.");return a}d(GI,"experimentStartingModelFromNeuronTrainingVersion");async function JI(i,n){let t=await bt(i,n),a=yt.parse({source:"engram",label:n.label,inferenceModelId:null,baseModel:t.baseModel,engram:{modelProjectId:t.modelProjectId,versionHash:t.contentHash,artifact:{id:t.artifact.id,contentHash:t.artifact.contentHash},modelHash:await u(t.artifact.manifest.pins.baseModel)}});if(a.source!=="engram")throw new h("engram_experiment_source_mismatch","Retain the exact saved memory module.");return a}d(JI,"experimentStartingModelFromEngramVersion");async function QI(i,n,t={}){let a=Vt.parse(i),r=await bt(n,t);return Vt.parse({...a,baseModel:r.baseModel,parentArtifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},startingModule:{modelProjectId:r.modelProjectId,versionHash:r.contentHash,artifact:{id:r.artifact.id,contentHash:r.artifact.contentHash},modelHash:await u(r.artifact.manifest.pins.baseModel)}})}d(QI,"engramFormFromModelVersion");var Nt=e.string().trim().min(1).max(500),cg=e.object({schemaVersion:e.literal("openpond.trainingExecutionSummary.v1"),job:e.lazy(()=>Le),name:e.string().min(1).max(500),method:e.enum(["sft","grpo","reward_model_train"]).nullable(),model:e.object({modelId:Nt,revision:Nt.nullable()}).strict().nullable(),dataset:F.nullable(),startedAt:e.iso.datetime().nullable()}).strict(),dg=e.object({projectId:Nt.optional(),datasetHash:e.string().regex(/^[a-f0-9]{64}$/).optional(),search:e.string().trim().max(1e3).optional(),cursor:e.string().trim().min(1).max(2e3).optional(),limit:e.number().int().min(1).max(100).default(30)}).strict(),mg=e.object({schemaVersion:e.literal("openpond.trainingExecutionPage.v1"),teamId:Nt,projectId:Nt.nullable(),items:e.array(cg).max(100),nextCursor:e.string().trim().min(1).max(2e3).nullable()}).strict();function lg(i){return{async listExecutions(n,t={}){let a=Nt.parse(n),r=dg.parse(t),s=new URLSearchParams;for(let[c,l]of Object.entries(r))s.set(c,String(l));let o=mg.parse(await i(`/v1/training/executions?${s}`));if(o.teamId!==a||o.projectId!==(r.projectId??null)||o.items.length>r.limit||new Set(o.items.map(c=>c.job.id)).size!==o.items.length||r.cursor&&o.nextCursor===r.cursor||o.items.some(c=>c.job.teamId!==a||r.datasetHash&&c.dataset?.contentHash!==r.datasetHash))throw new h("training_execution_page_mismatch","Training history returned a different scope or input selection.");return o}}}d(lg,"createTrainingExecutionClient");var Be=e.string().trim().min(1).max(240),Wc=j.extend({revision:e.number().int().positive()}).strict(),ug=Wc.extend({teamId:Be,jobId:Be,plan:j,baseline:j,candidate:j,state:Nr.shape.state,updatedAt:e.string().datetime()}).strict(),pg=e.object({schemaVersion:e.literal("openpond.trainingAcceptanceGroupPage.v1"),teamId:Be,jobId:Be,groups:e.array(ug).max(100),nextCursor:Be.nullable()}).strict(),hg=e.object({cursor:Be.optional(),limit:e.number().int().min(1).max(100).default(25)}).strict();function gg(i){let n=d(t=>(Be.parse(t.teamId),`/v1/training/jobs/${encodeURIComponent(Be.parse(t.jobId))}/acceptance-groups`),"route");return{async acceptanceGroups(t,a={}){let r=hg.parse(a),s=new URLSearchParams({limit:String(r.limit)});r.cursor&&s.set("cursor",r.cursor);let o=pg.parse(await i(`${n(t)}?${s}`));if(o.teamId!==t.teamId||o.jobId!==t.jobId||o.groups.length>r.limit||o.groups.some(c=>c.teamId!==t.teamId||c.jobId!==t.jobId||r.cursor&&c.id<=r.cursor)||new Set(o.groups.map(c=>c.id)).size!==o.groups.length||o.nextCursor!==null&&o.nextCursor!==o.groups.at(-1)?.id)throw new h("acceptance_group_scope_mismatch","Acceptance groups do not match the requested workspace, job or cursor.");return o},async acceptanceGroup(t,a,r){let s=r?Wc.parse({id:r.id,revision:r.revision,contentHash:r.contentHash}):null;if(s&&s.id!==a)throw new h("acceptance_group_identity_mismatch","The retained group reference differs from the requested group.");let o=s?`?revision=${s.revision}`:"",c=$r(await i(`${n(t)}/${encodeURIComponent(Be.parse(a))}${o}`));if(c.manifest.teamId!==t.teamId||c.manifest.trainingJob.id!==t.jobId||c.manifest.id!==a||s&&(c.revision!==s.revision||c.contentHash!==s.contentHash))throw new h("acceptance_group_identity_mismatch","Acceptance evidence does not match the requested workspace, job or retained revision.");return c}}}d(gg,"createTrainingAcceptanceClient");var Mr=e.object({schemaVersion:e.literal("openpond.trainingExperimentLearning.v1"),teamId:e.string().min(1).max(191),projectId:e.string().min(1).max(191).nullable(),draftId:e.string().min(1).max(191),form:cc.omit({learningConfiguration:!0}),expectedConfiguration:Ut.shape.configuration.optional(),expectedPolicy:sn.optional()}).strict(),fg=e.object({schemaVersion:e.literal("openpond.trainingExperimentLearningReceipt.v1"),inputHash:e.string().regex(/^[a-f0-9]{64}$/),configuration:ye,policy:sn}).strict();function nS(i){let{learningConfiguration:n,...t}=i.form,a=n?.configuration;return Mr.parse({schemaVersion:"openpond.trainingExperimentLearning.v1",...i,form:t,...a?{expectedConfiguration:{id:a.id,expectedRevision:a.revision,expectedEtag:a.etag},expectedPolicy:n.policy}:{}})}d(nS,"trainingExperimentLearningRequest");async function vg(i){let n=Mr.parse(i),{baseModel:t,recipe:a,batch:r,evaluation:s,validationSplit:o,learningIntent:c}=n.form;return u({teamId:n.teamId,projectId:n.projectId,draftId:n.draftId,baseModel:t,recipe:a,batch:r,evaluation:s,validationSplit:o,learningIntent:c})}d(vg,"trainingExperimentLearningInputHash");async function bg(i){let{baseModel:n,recipe:t,batch:a,evaluation:r,validationSplit:s}=i;return u({baseModel:n,recipe:t,batch:a,evaluation:r,validationSplit:s})}d(bg,"trainingExperimentTrainingInputHash");async function aS(i){let n=i.learningConfiguration;if(n&&n.trainingInputHash!==await bg(i))throw new Error("Save the changed training inputs before preparing this Model, or restore its accepted settings.");return n}d(aS,"trainingExperimentSavedConfiguration");function iS(i){let n=i.form.learningIntent;if(!n||!n.enabled&&!i.expectedPolicy)throw new Error("Enable continual learning before saving its first policy.");return Lr.parse({mode:n.mode,minimumTasks:Number(n.minimumTasks),localTime:n.localTime,timeZone:n.timeZone,maximumSpendUsd:Number(n.maximumSpendUsd),maximumDailySpendUsd:Number(n.maximumDailySpendUsd)})}d(iS,"trainingExperimentInitialLearning");function rS(i){return Wa.parse({method:i.recipe.method,baseModel:i.baseModel,recipe:{...i.recipe,dataset:{...i.recipe.dataset&&typeof i.recipe.dataset=="object"?i.recipe.dataset:{},validationSplit:i.validationSplit}},evaluationTasksetRef:i.evaluation,managedRolloutPlacement:"remote"})}d(rS,"trainingExperimentLearningSettings");function Ig(i){return{async saveExperimentLearning(n){let t=Mr.parse(n),a=fg.parse(await i("/v1/training/preparations/from-draft/learning",{method:"POST",body:JSON.stringify(t)})),r=t.form.learningIntent?.enabled===!1&&!!(t.expectedConfiguration&&t.expectedPolicy),s=t.expectedConfiguration,o=r?a.configuration.id===s.id&&a.configuration.revision===s.expectedRevision&&a.configuration.etag===s.expectedEtag:a.configuration.name===t.form.name.trim();if(a.inputHash!==await vg(t)||a.configuration.teamId!==t.teamId||!o||t.expectedPolicy&&(a.policy.id!==t.expectedPolicy.id||a.policy.revision!==t.expectedPolicy.revision+1))throw new h("training_experiment_learning_mismatch","The saved learning policy does not match its authored inputs.");return a}}}d(Ig,"createTrainingExperimentLearningClient");var $t=j.shape.contentHash,oe=e.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),In=e.string().trim().min(1).max(1e3),Sg=e.enum(["complete","bounded","unavailable"]),xg=e.object({baseModel:T.extend({revision:e.string().trim().min(1).max(256),tokenizerRevision:e.string().trim().min(1).max(256),chatTemplateHash:$t}).strict(),recipeHash:$t,harnessRunManifest:j,harnessRelease:j,dataset:j,evaluationDataset:j.nullable(),evidenceSets:e.array(j).max(1e4)}).strict(),No=e.object({version:e.string().trim().min(1).max(191),implementationHash:$t,tokenizerAssetsHash:$t,enableThinking:e.literal(!1)}).strict(),Gc=e.object({promptTokens:oe,retainedPromptTokens:oe,targetTokens:oe,inputTokens:oe,truncatedPrompts:oe}).strict().superRefine((i,n)=>{(i.retainedPromptTokens>i.promptTokens||i.inputTokens!==i.retainedPromptTokens+i.targetTokens||i.truncatedPrompts===0!=(i.promptTokens===i.retainedPromptTokens))&&n.addIssue({code:"custom",message:"SFT tokens must preserve the target and partition the retained input"})}),Jc=e.object({coverage:Sg,total:oe.nullable(),counted:oe,inputsHash:$t.nullable(),reason:In.nullable()}).strict();function Qc(i,n){i.total!==null&&i.counted>i.total&&n.addIssue({code:"custom",path:["counted"],message:"Counted membership exceeds the population"}),i.coverage==="unavailable"?(i.counted!==0||i.totals!==null||i.inputsHash!==null||!i.reason)&&n.addIssue({code:"custom",message:"Unavailable counts require a reason and no token evidence"}):((i.totals===null||i.inputsHash===null)&&n.addIssue({code:"custom",message:"Counted membership requires exact inputs and token totals"}),i.coverage==="complete"&&(i.total===null||i.counted!==i.total)&&n.addIssue({code:"custom",message:"Complete coverage must count the entire declared population"}),i.coverage==="bounded"&&!i.reason&&n.addIssue({code:"custom",path:["reason"],message:"Bounded coverage must explain its limit"}))}d(Qc,"verifyPopulation");var vi=Jc.extend({totals:e.object({promptTokens:oe}).strict().nullable()}).superRefine(Qc).superRefine((i,n)=>{i.totals&&i.totals.promptTokens<i.counted&&n.addIssue({code:"custom",path:["totals"],message:"Each counted initial request requires a nonempty prompt"})}),yg=Jc.extend({totals:Gc.nullable()}).superRefine(Qc).superRefine((i,n)=>{i.totals&&(i.totals.truncatedPrompts>i.counted||i.totals.retainedPromptTokens<i.counted||i.totals.targetTokens<i.counted)&&n.addIssue({code:"custom",path:["totals"],message:"Each counted SFT row requires context and a complete target"})}),$o={schemaVersion:e.literal("openpond.trainingEstimateWorkload.v1"),identity:xg.nullable(),unavailableReason:In.nullable()},wg=e.discriminatedUnion("method",[e.object({...$o,method:e.literal("sft"),preprocessing:No.extend({maxSequenceLength:oe.min(2),promptTruncation:e.literal("left_preserve_complete_target"),targetMask:e.literal("completion_only")}).strict().nullable(),trainingRows:yg,evaluationRows:oe.nullable(),evaluationInitialRequests:vi,evaluationGeneratedCompletionTokens:e.null(),evaluationGeneratedTokensReason:In,planned:e.object({exampleExposures:oe.nullable(),optimizerSteps:oe.nullable(),exposuresHash:$t.nullable(),tokenTotals:Gc.nullable(),reason:In.nullable()}).strict()}).strict(),e.object({...$o,method:e.literal("grpo"),preprocessing:No.extend({maxPromptTokens:oe.positive(),contextAdmission:e.literal("native_policy_context"),addGenerationPrompt:e.literal(!0)}).strict().nullable(),trainingRows:oe.nullable(),evaluationRows:oe.nullable(),trainingInitialRequests:vi,evaluationInitialRequests:vi,generatedCompletionTokens:e.null(),subsequentToolTurnPromptTokens:e.null(),generatedTokensReason:In}).strict()]).superRefine((i,n)=>{let t=i.method==="sft"?[i.trainingRows,i.evaluationInitialRequests]:[i.trainingInitialRequests,i.evaluationInitialRequests];if((!i.identity||!i.preprocessing)&&(!i.unavailableReason||t.some(a=>a.coverage!=="unavailable")||i.method==="sft"&&i.planned.tokenTotals!==null)&&n.addIssue({code:"custom",message:"Native token counts require verified identity and preprocessing; otherwise explain their unavailability"}),i.method==="sft"){let a=i.planned;if(i.preprocessing){let r=i.preprocessing.maxSequenceLength;(i.trainingRows.totals&&i.trainingRows.totals.inputTokens>r*i.trainingRows.counted||a.tokenTotals&&a.exampleExposures!==null&&a.tokenTotals.inputTokens>r*a.exampleExposures)&&n.addIssue({code:"custom",message:"SFT token totals exceed the native sequence limit"})}(a.exampleExposures===null!=(a.optimizerSteps===null)||a.exampleExposures===null!=(a.exposuresHash===null))&&n.addIssue({code:"custom",path:["planned"],message:"A native schedule requires exposures, steps and ordered membership together"}),a.exampleExposures!==null&&(!i.identity||i.trainingRows.total===null||a.optimizerSteps===null||a.optimizerSteps>a.exampleExposures||a.exampleExposures===0!=(a.optimizerSteps===0))&&n.addIssue({code:"custom",path:["planned"],message:"A native schedule requires immutable identity, admitted row membership and valid step counts"}),a.tokenTotals&&(a.exampleExposures===null||a.tokenTotals.truncatedPrompts>a.exampleExposures||a.tokenTotals.retainedPromptTokens<a.exampleExposures||a.tokenTotals.targetTokens<a.exampleExposures)&&n.addIssue({code:"custom",path:["planned","tokenTotals"],message:"Planned tokens must cover the exact scheduled exposures"}),(!i.identity||a.exampleExposures===null||a.tokenTotals===null)&&!a.reason&&n.addIssue({code:"custom",path:["planned","reason"],message:"Incomplete planned workload requires a reason"})}else if(i.preprocessing){let a=i.trainingInitialRequests;a.totals&&a.totals.promptTokens>i.preprocessing.maxPromptTokens*a.counted&&n.addIssue({code:"custom",message:"Training initial request token totals exceed native prompt admission"})}}),ge=e.string().trim().min(1).max(191),At=e.string().regex(/^[a-f0-9]{64}$/),bi=e.string().datetime({offset:!0}),ve=e.number().finite().nonnegative(),_g=e.discriminatedUnion("kind",[e.object({kind:e.literal("preparation"),id:ge,planHash:At,expectedRevision:e.number().int().positive()}).strict(),e.object({kind:e.literal("configuration"),id:ge,expectedRevision:e.number().int().positive(),expectedEtag:At,batch:F.nullable().default(null)}).strict(),e.object({kind:e.literal("submission"),submission:e.lazy(()=>ro)}).strict()]),Kc=e.object({schemaVersion:e.literal("openpond.trainingEstimateRequest.v1"),teamId:ge,source:_g,gpuSelection:dn.optional()}).strict(),ua=e.object({low:ve,high:ve}).strict().refine(i=>i.high>=i.low,"Planning range must be ordered"),Hg=e.object({phase:e.enum(["gpu_allocation","startup","baseline_evaluation","rollouts","optimization","checkpointing","backbone_materialization","final_evaluation","publication","cleanup","retention"]),resource:e.enum(["gpu","cpu","judge","storage","network"]),expectedUsd:ve.nullable(),expectedSeconds:ve.nullable(),planningRangeUsd:ua.nullable(),evidence:e.enum(["measured","configured_rate","unavailable"]),reason:e.string().trim().min(1).max(1e3).nullable()}).strict();function jg(i){return i.kind==="submission"?{kind:i.kind,id:i.submission.idempotencyKey,contentHash:i.submission.contentHash,revision:null}:i.kind==="preparation"?{kind:i.kind,id:i.id,contentHash:i.planHash,revision:i.expectedRevision}:{kind:i.kind,id:i.id,contentHash:i.expectedEtag,revision:i.expectedRevision}}d(jg,"trainingEstimateSourceIdentity");var Xc=e.object({schemaVersion:e.literal("openpond.trainingEstimate.v1"),id:ge,teamId:ge,requestHash:At,inputHash:At,source:e.object({kind:e.enum(["preparation","configuration","submission"]),id:e.string().trim().min(1).max(500),contentHash:At,revision:e.number().int().positive().nullable()}).strict(),status:e.enum(["available","partial","insufficient_evidence"]),currency:e.literal("USD"),createdAt:bi,expiresAt:bi,estimatorVersion:ge,runtimeVersion:ge,pricing:e.object({version:ge,quoteExpiresAt:bi.nullable()}).strict(),gpu:e.object({requested:dn,resolved:e.object({availabilityId:ge,gpuType:e.string().min(1).max(256),gpuCount:e.union([e.literal(1),e.literal(2)])}).strict().nullable(),customerHourlyUsd:ve.nullable(),availability:e.enum(["available","limited","unavailable","unknown"])}).strict(),configuration:e.object({modelId:ge,modelRevision:e.string().min(1).max(256),method:ge,loraRank:e.number().int().positive().nullable(),adapterMode:e.enum(["residual_append","shared","sequential_merge"]).nullable(),groups:e.number().int().nonnegative().nullable(),rolloutConcurrency:e.number().int().positive().nullable(),maxOutputTokens:e.number().int().positive().nullable(),trainingRows:e.number().int().nonnegative().nullable(),evaluationRows:e.number().int().nonnegative().nullable(),retentionDays:e.number().int().positive().nullable(),approvedMaximumUsd:ve.nullable()}).strict(),workload:wg.optional(),cost:e.object({expectedUsd:ve.nullable(),planningRangeUsd:ua.nullable(),knownMinimumUsd:ve,recommendedMaximumUsd:ve.nullable(),minimumCleanupReserveUsd:ve.nullable(),components:e.array(Hg).max(50)}).strict(),executionSeconds:e.object({expected:ve.nullable(),planningRange:ua.nullable()}).strict(),queueWaitSeconds:e.object({expected:ve,planningRange:ua.nullable()}).strict().nullable(),calibration:e.object({version:ge,cohortHash:At,completedSamples:e.number().int().nonnegative(),partialSamples:e.number().int().nonnegative(),scope:e.enum(["workspace","authorized_aggregate"])}).strict(),assumptions:e.array(e.string().trim().min(1).max(1e3)).max(50),unknowns:e.array(e.string().trim().min(1).max(1e3)).max(50),review:La}).strict().superRefine((i,n)=>{let t=i.cost.components.filter(r=>r.phase==="gpu_allocation");if(t.length){let r=t[0],s=i.gpu.customerHourlyUsd;(t.length!==1||r.resource!=="gpu"||r.expectedUsd===null!=(r.expectedSeconds===null)||r.expectedUsd!==null&&(s===null||r.evidence!=="measured"||Math.abs(r.expectedUsd-r.expectedSeconds/3600*s)>1e-9)||r.planningRangeUsd!==null&&r.expectedUsd===null||i.cost.components.some(c=>c.resource==="gpu"&&c.phase!=="gpu_allocation"&&(c.expectedUsd!==null||c.expectedSeconds!==null||c.planningRangeUsd!==null)))&&n.addIssue({code:"custom",path:["cost","components"],message:"GPU allocation evidence must use the whole-Pod rate once, without duplicate GPU phase quantities or charges"})}let a=i.workload;if(a){let r=a.identity?.baseModel,s=a.method==="sft"?a.trainingRows.total:a.trainingRows;(a.method!==i.configuration.method||r&&(r.modelId!==i.configuration.modelId||r.revision!==i.configuration.modelRevision)||s!==null&&i.configuration.trainingRows!==null&&s!==i.configuration.trainingRows||a.evaluationRows!==null&&i.configuration.evaluationRows!==null&&a.evaluationRows!==i.configuration.evaluationRows)&&n.addIssue({code:"custom",path:["workload"],message:"Workload evidence differs from the selected model, method or row population"})}(i.review.estimateId!==i.id||i.review.inputHash!==i.inputHash||i.review.requestHash!==i.requestHash||i.review.pricingVersion!==i.pricing.version||i.review.expiresAt!==i.expiresAt)&&n.addIssue({code:"custom",path:["review"],message:"Estimate review identity differs from the estimate"}),Date.parse(i.expiresAt)<=Date.parse(i.createdAt)&&n.addIssue({code:"custom",path:["expiresAt"],message:"Estimate must expire after its creation"}),i.status==="available"&&(i.cost.expectedUsd===null||i.executionSeconds.expected===null||i.unknowns.length>0)&&n.addIssue({code:"custom",path:["status"],message:"An available estimate requires complete cost and duration coverage"}),i.gpu.requested.mode==="manual"&&i.gpu.resolved&&(i.gpu.requested.availabilityId!==i.gpu.resolved.availabilityId||i.gpu.requested.gpuType!==i.gpu.resolved.gpuType)&&n.addIssue({code:"custom",path:["gpu"],message:"An explicit GPU offering cannot be substituted"}),i.gpu.resolved&&i.gpu.resolved.gpuCount!==(i.gpu.requested.gpuCount??1)&&n.addIssue({code:"custom",path:["gpu","resolved","gpuCount"],message:"The resolved GPU count must match the requested count"})});function Tg(i){return{async estimate(n){let t=Kc.parse(n);t.source.kind==="submission"&&await ia(t.source.submission);let a=Xc.parse(await i("/v1/training/estimates",{method:"POST",body:JSON.stringify(t)}));return Mg(a,t)}}}d(Tg,"createTrainingEstimateClient");async function Mg(i,n){let t=Kc.parse(n);t.source.kind==="submission"&&await ia(t.source.submission);let a=Xc.parse(i),r=a.workload;if(r&&t.source.kind==="submission"){let s=t.source.submission,o=r.identity,c=s.job.kind!=="policy_optimize"||r.method!==s.job.recipe.method;if(o){let l=s.source;c||=o.recipeHash!==await u(s.job.recipe)||await u(o.baseModel)!==await u(s.job.baseModel)||await u({harnessRunManifest:o.harnessRunManifest,harnessRelease:o.harnessRelease,dataset:o.dataset,evaluationDataset:o.evaluationDataset,evidenceSets:o.evidenceSets})!==await u({harnessRunManifest:l.harnessRunManifest,harnessRelease:l.harnessRelease,dataset:l.dataset,evaluationDataset:l.evaluation?.dataset??null,evidenceSets:l.evidenceSets})}if(r.method==="sft"&&(r.preprocessing||r.planned.exampleExposures!==null)){let l=Or.safeParse(s.job.recipe);if(!l.success)c=!0;else{c||=r.preprocessing!==null&&r.preprocessing.maxSequenceLength!==l.data.dataset.maxSequenceLength;let p=l.data.optimizer,g=p.batchSize*p.gradientAccumulationSteps;if(r.planned.exampleExposures!==null&&r.trainingRows.total!==null){let v=Math.min(Math.ceil(r.trainingRows.total*p.epochs),p.maxSteps*g);c||=r.planned.exampleExposures!==v||r.planned.optimizerSteps!==Math.ceil(v/g)}}}else if(r.method==="grpo"&&r.preprocessing){let l=e.object({dataset:e.object({maxPromptTokens:e.number().int().positive()})}).safeParse(s.job.recipe);c||=!l.success||r.preprocessing.maxPromptTokens!==l.data.dataset.maxPromptTokens}if(c)throw new h("training_estimate_scope_mismatch","Workload evidence does not match the exact submitted model, recipe and released data.")}if(a.teamId!==t.teamId||a.requestHash!==await u(t)||Date.parse(a.expiresAt)<=Date.now()||await u(a.source)!==await u(jg(t.source))||t.gpuSelection&&await u(a.gpu.requested)!==await u(t.gpuSelection)||t.source.kind==="submission"&&await u(a.gpu.requested)!==await u(t.source.submission.gpuSelection??{mode:"automatic",objective:t.source.submission.placementObjective}))throw new h("training_estimate_scope_mismatch","The estimate does not match the requested workspace and exact configuration.");return a}d(Mg,"parseAndVerifyTrainingEstimate");var nt=e.string().trim().min(1).max(240),Rr=e.string().regex(/^[a-f0-9]{64}$/),Na=e.number().positive().max(1e6),Bo=e.string().regex(/^\d+(?:\.\d{1,6})?$/),va=e.iso.datetime(),$a=e.object({id:nt,revision:e.number().int().positive(),contentHash:Rr,projectId:nt.nullable()}).strict(),Yc=e.object({schemaVersion:e.literal("openpond.trainingFundingRequest.v1"),teamId:nt,maximumSpendUsd:Na,draft:$a.nullable().default(null)}).strict(),Rg=e.object({schemaVersion:e.literal("openpond.trainingFunding.v1"),teamId:nt,actorId:nt,requestHash:Rr,maximumSpendUsd:Na,draft:$a.nullable(),state:e.enum(["covered","insufficient_credit","member_limit","unavailable"]),canViewBalance:e.boolean(),canPurchase:e.boolean(),availableUsageUsd:Bo.nullable(),prepaidCreditUsd:Bo.nullable(),checkedAt:va,expiresAt:va}).strict().superRefine((i,n)=>{!i.canViewBalance&&(i.availableUsageUsd!==null||i.prepaidCreditUsd!==null)&&n.addIssue({code:"custom",path:["canViewBalance"],message:"Private balances cannot accompany a restricted funding read."}),Date.parse(i.expiresAt)<=Date.parse(i.checkedAt)&&n.addIssue({code:"custom",path:["expiresAt"],message:"Funding observations must expire after their check."})}),Zc=e.object({schemaVersion:e.literal("openpond.trainingFundingHandoffRequest.v1"),teamId:nt,maximumSpendUsd:Na.nullable(),draft:$a}).strict(),Eg=e.object({schemaVersion:e.literal("openpond.trainingFundingHandoff.v1"),teamId:nt,actorId:nt,requestHash:Rr,maximumSpendUsd:Na.nullable(),draft:$a,canPurchase:e.boolean(),billingUrl:e.string().url().nullable(),checkedAt:va,expiresAt:va}).strict().superRefine((i,n)=>{if(!!i.billingUrl!==i.canPurchase&&n.addIssue({code:"custom",path:["billingUrl"],message:"A purchase handoff requires current billing access."}),i.billingUrl){let t=new URL(i.billingUrl);(t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname))||t.username||t.password||t.search||t.hash||!/^\/entry\/[A-Za-z0-9_-]{40,4096}$/.test(t.pathname))&&n.addIssue({code:"custom",path:["billingUrl"],message:"Use a grantless hosted Billing entry URL."})}Date.parse(i.expiresAt)<=Date.parse(i.checkedAt)&&n.addIssue({code:"custom",path:["expiresAt"],message:"Funding handoffs must expire after creation."})});async function Pg(i,n,t){let a=Yc.parse(n),r=Rg.parse(i);if(r.teamId!==a.teamId||t&&r.actorId!==t||r.maximumSpendUsd!==a.maximumSpendUsd||m(r.draft)!==m(a.draft)||r.requestHash!==await u(a)||Date.parse(r.expiresAt)<=Date.now())throw new h("training_funding_scope_mismatch","Funding returned another actor, workspace, draft or spending cap.");return r}d(Pg,"parseAndVerifyTrainingFunding");async function kg(i,n,t){let a=Zc.parse(n),r=Eg.parse(i);if(r.teamId!==a.teamId||t&&r.actorId!==t||r.maximumSpendUsd!==a.maximumSpendUsd||m(r.draft)!==m(a.draft)||r.requestHash!==await u(a)||Date.parse(r.expiresAt)<=Date.now())throw new h("training_funding_handoff_scope_mismatch","Billing returned another actor, workspace, draft or spending cap.");return r}d(kg,"parseAndVerifyTrainingFundingHandoff");function Ag(i){return{async funding(n){let t=Yc.parse(n);return Pg(await i("/v1/training/funding/preview",{method:"POST",body:m(t)}),t)},async fundingHandoff(n){let t=Zc.parse(n);return kg(await i("/v1/training/funding/handoff",{method:"POST",body:m(t)}),t)}}}d(Ag,"createTrainingFundingClient");async function Cg(i,n,t){let a=Ya.parse(n),r=So.parse(i),{contentHash:s,...o}=r;if(s!==ea(o)||r.requestHash!==ea(a)||r.id!==`dataset-review-${ea([r.teamId,r.actorId,r.operationId])}`||r.teamId!==a.teamId||t&&r.actorId!==t||r.operationId!==a.operationId||r.packageHash!==a.packageHash||m(r.dataset)!==m(a.dataset)||r.purpose!==a.purpose)throw new h("dataset_training_review_mismatch","The Dataset review receipt differs from its exact source or operation.");if(new Set(r.evidence.map(c=>c.id)).size!==r.evidence.length||new Set(r.proposals.map(c=>c.id)).size!==r.proposals.length||r.proposals.length>r.evidence.length||a.taskIds&&r.evidence.length!==a.taskIds.length)throw new h("dataset_training_review_inventory_mismatch","The Dataset review returned another example inventory.");return r}d(Cg,"parseAndVerifyDatasetTrainingReviewReceipt");function qg(i){return{async reviewDataset(n){let t=Ya.parse(n);return Cg(await i("/v1/training/dataset-reviews",{method:"POST",body:m(t)}),t)}}}d(qg,"createDatasetTrainingReviewClient");var xe=e.string().trim().min(1).max(200),Ai=e.string().regex(/^[a-f0-9]{64}$/),Ba=e.object({schemaVersion:e.literal("openpond.trainingResultSave.v1"),teamId:xe,operationId:xe,name:e.string().trim().min(1).max(200),expectedModelRevision:e.number().int().positive(),submissionHash:Ai,artifact:j,checkpointId:xe}).strict(),mS=Ba.omit({operationId:!0}).extend({jobId:xe}).strict(),lS=e.object({jobId:xe,request:Ba}).strict(),zg=e.object({schemaVersion:e.literal("openpond.trainingResultSaveReceipt.v1"),teamId:xe,actorId:xe,operationId:xe,requestHash:Ai,model:e.lazy(()=>ye),version:e.lazy(()=>St),contentHash:Ai}).strict(),Dg=e.object({teamId:xe}).strict(),Ug=e.object({schemaVersion:e.literal("openpond.trainingSavedModel.v1"),teamId:xe,model:e.lazy(()=>ye),version:e.lazy(()=>St).nullable()}).strict();async function Vg(i,n){let t=Ug.parse(i);if(t.teamId!==n.teamId||t.model.teamId!==n.teamId||t.model.id!==n.modelProjectId)throw new h("training_saved_model_mismatch","The saved Model belongs to another workspace or configuration.");if(t.version&&(await Jt(t.version,n)).portableProjectId!==t.model.portableProjectId)throw new h("training_saved_model_mismatch","The saved Model version belongs to another configuration.");return t}d(Vg,"parseAndVerifyTrainingSavedModel");async function Ng(i,n){let t=zg.parse(i),a=Ba.parse(n.request),{contentHash:r,...s}=t,o=await Jt(t.version,{teamId:a.teamId,modelProjectId:t.model.id,jobId:n.jobId});if(r!==await u(s)||t.requestHash!==await u(a)||t.teamId!==a.teamId||t.model.teamId!==a.teamId||n.actorId&&t.actorId!==n.actorId||t.operationId!==a.operationId||t.model.name!==a.name||t.model.revision!==a.expectedModelRevision+1||t.model.portableProjectId!==o.portableProjectId||o.request.submissionHash!==a.submissionHash||o.candidate.artifact.id!==a.artifact.id||o.candidate.artifact.contentHash!==a.artifact.contentHash||o.candidate.checkpointId!==a.checkpointId)throw new h("training_result_save_mismatch","The saved Model differs from the reviewed training result or name.");return t}d(Ng,"parseAndVerifyTrainingResultSave");function $g(i){return{async savedModel(n,t){let a=xe.parse(n),r=Dg.parse(t);return Vg(await i(`/v1/training/models/${encodeURIComponent(a)}?${new URLSearchParams(r)}`),{...r,modelProjectId:a})},async saveResultModel(n,t){let a=xe.parse(n),r=Ba.parse(t);return Ng(await i(`/v1/training/jobs/${encodeURIComponent(a)}/model`,{method:"POST",body:JSON.stringify(r)}),{jobId:a,request:r})}}}d($g,"createTrainingModelSaveClient");var ae=e.string().trim().min(1).max(500),Er=e.string().regex(/^[a-f0-9]{64}$/),Ci=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.trainingModelServingControl.v1"),teamId:ae,modelProjectId:ae,versionHash:Er,artifact:j,actorId:ae,operationId:ae,revision:e.number().int().positive(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:ae,deploymentId:ae,poolId:ae,idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:ae.nullable(),updatedAt:e.string().datetime({offset:!0})}).strict(),Yn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.trainingModelServingControlRequest.v1"),teamId:ae,operationId:ae,artifact:j,versionHash:Er,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),hS=Yn.omit({operationId:!0}).extend({modelProjectId:ae}).strict(),gS=e.object({modelProjectId:ae,request:Yn}).strict(),Bg=e.object({schemaVersion:e.literal("openpond.trainingModelServingControlReceipt.v1"),teamId:ae,modelProjectId:ae,actorId:ae,request:Yn,control:Ci,contentHash:Er}).strict();async function Fg(i,n){let t=Bg.parse(i),a=Yn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(!Ot(a,o)||r!==await u(s)||await u(t.request)!==await u(a)||t.modelProjectId!==n.modelProjectId||t.teamId!==a.teamId||n.actorId&&t.actorId!==n.actorId||o.actorId!==t.actorId||o.teamId!==a.teamId||o.modelProjectId!==t.modelProjectId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.artifact.id!==a.artifact.id||o.artifact.contentHash!==a.artifact.contentHash||o.modelId!==`personalized:model:${n.modelProjectId}`||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||o.desiredState!==(a.action==="activate"?"active":"stopped")||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("training_model_serving_control_mismatch","The serving command differs from its reviewed Model, version or action.");return t}d(Fg,"parseAndVerifyTrainingModelServingControl");function Og(i){return{async controlModelServing(n,t){let a=ae.parse(n),r=Yn.parse(t);return Fg(await i(`/v1/training/models/${encodeURIComponent(a)}/serving`,{method:"POST",body:JSON.stringify(r)}),{modelProjectId:a,request:r})}}}d(Og,"createTrainingModelServingControlClient");var Z=e.string().trim().min(1).max(500),ed=e.string().regex(/^[a-f0-9]{64}$/),ba=e.string().datetime({offset:!0}),td=e.object({teamId:Z,versionHash:ed}).strict(),Lg=e.lazy(()=>St),Wg=e.object({artifact:j,baseProfileId:Z,state:Z,qualified:e.boolean(),revoked:e.boolean(),deleted:e.boolean(),reason:e.enum(["qualified","evaluation_pending","post_training_pending","evaluation_failed","candidate_rejected","artifact_revoked","artifact_deleted","runtime_unavailable"]),source:e.object({jobId:Z,artifact:j,checkpointId:Z}).strict()}).strict(),Gg=e.object({id:Z,artifactId:Z,poolId:Z.nullable(),revision:e.number().int().positive(),state:e.enum(["requested","deploying","ready","degraded","deleting","deleted","failed"]),revoked:e.boolean(),lastReadyCheckAt:ba.nullable(),updatedAt:ba}).strict(),Jg=e.object({id:Z,modelId:Z,artifactId:Z,deploymentId:Z,revision:e.number().int().positive()}).strict(),Qg=e.object({requestId:Z,receipt:j,artifact:j,deploymentId:Z,poolId:Z,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),completedAt:ba}).strict(),Kg=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.trainingModelServing.v1"),teamId:Z,modelProjectId:Z,observedAt:ba,version:Lg,registry:Wg.nullable(),control:Ci.nullable(),cleanup:e.array(Ci).max(100),deployments:e.array(Gg).max(100),pools:e.array(Wt).max(100),bindings:e.array(Jg).max(100),lastVerifiedInference:Qg.nullable(),state:e.enum(["unpublished","qualification_pending","unavailable","inactive","starting","active","retiring"])}).strict(),nd=Kg.extend({contentHash:ed}).strict();function Xg(i){if(i.control?.desiredState==="stopped")return i.control.phase==="stopping"?"retiring":i.bindings.length?"unavailable":"inactive";if(i.control?.phase==="failed")return"unavailable";if(!i.registry)return"unpublished";if(!i.registry.qualified)return["evaluation_pending","post_training_pending"].includes(i.registry.reason)?"qualification_pending":"unavailable";let n=new Map(i.pools.map(t=>[t.id,t]));return i.bindings.some(t=>i.deployments.some(a=>a.id===t.deploymentId&&a.state==="ready"&&!a.revoked&&a.poolId&&n.get(a.poolId)?.state==="ready"&&n.get(a.poolId)?.endpointRecorded))?"active":i.control?.desiredState==="active"&&i.control.phase==="starting"||i.deployments.some(t=>["requested","deploying"].includes(t.state)||t.poolId&&["requested","provisioning"].includes(n.get(t.poolId)?.state??""))?"starting":i.deployments.some(t=>t.state==="deleting")||i.pools.some(t=>t.state==="deleting")?"retiring":i.bindings.length?"unavailable":"inactive"}d(Xg,"trainingModelServingState");async function ad(i,n){let t=nd.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"training"},t.control),await Jt(t.version,n);function s(){throw new h("training_model_serving_mismatch","Serving evidence differs from the exact saved Model, registry or deployment.")}d(s,"fail8"),(t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.version.contentHash!==n.versionHash||a!==await u(r)||t.state!==Xg(t))&&s();for(let v of[t.deployments,t.pools,t.bindings])new Set(v.map(f=>f.id)).size!==v.length&&s();let o=t.registry,c=t.control;if((new Set(t.cleanup.map(v=>v.operationId)).size!==t.cleanup.length||t.cleanup.some(v=>v.teamId!==n.teamId||v.modelProjectId!==n.modelProjectId||v.desiredState!=="stopped"))&&s(),c&&(c.teamId!==n.teamId||c.modelProjectId!==n.modelProjectId||c.versionHash!==t.version.contentHash&&!(c.desiredState==="stopped"&&c.phase==="stopped")||c.desiredState==="active"&&o&&(c.artifact.id!==o.artifact.id||c.artifact.contentHash!==o.artifact.contentHash))&&s(),!o)return(t.deployments.length||t.pools.length||t.bindings.length||t.lastVerifiedInference)&&s(),t;(o.source.jobId!==t.version.jobId||o.source.checkpointId!==t.version.candidate.checkpointId||o.source.artifact.id!==t.version.candidate.artifact.id||o.source.artifact.contentHash!==t.version.candidate.artifact.contentHash||o.qualified!==(o.reason==="qualified")||o.qualified&&(o.state!=="promotable"||o.revoked||o.deleted))&&s();let l=new Map(t.deployments.map(v=>[v.id,v])),p=new Map(t.pools.map(v=>[v.id,v]));(t.deployments.some(v=>v.artifactId!==o.artifact.id||v.poolId&&!p.has(v.poolId))||t.bindings.some(v=>v.artifactId!==o.artifact.id||!l.has(v.deploymentId))||t.pools.some(v=>v.workersMin>v.workersMax||!t.deployments.some(f=>f.poolId===v.id)))&&s();let g=t.lastVerifiedInference;return g&&(g.artifact.id!==o.artifact.id||g.artifact.contentHash!==o.artifact.contentHash||l.get(g.deploymentId)?.poolId!==g.poolId||p.get(g.poolId)?.workerImageDigest!==g.workerImageDigest||g.receipt.id!==g.requestId)&&s(),t}d(ad,"parseAndVerifyTrainingModelServing");function Yg(i){return{async modelServing(n,t){let a=Z.parse(n),r=td.parse(t);return ad(await i(`/v1/training/models/${encodeURIComponent(a)}/serving?${new URLSearchParams(r)}`),{modelProjectId:a,...r})}}}d(Yg,"createTrainingModelServingClient");var qt=e.string().regex(/^[a-f0-9]{64}$/),da=e.string().trim().min(1).max(500),Zg=e.object({savedModel:Wi.optional(),steering:lt.nullable().optional()}).strict();async function bS(i){let n=$n.parse(i);return await ot(n),{modelProjectId:n.modelProjectId,versionHash:n.contentHash}}d(bS,"savedSteeringModelSelection");var id=e.object({schemaVersion:e.literal("openpond.resolvedSteeringSelection.v1"),requested:e.enum(["inherit","off","override"]),savedModel:Wi.nullable(),defaultPublication:lt.nullable(),effectivePublication:lt.nullable(),profileHash:qt.nullable(),modelHash:qt,calibration:Ni.nullable()}).strict();async function rd(i,n){let t=id.parse(i),a=Zg.parse(n),r=a.steering===void 0?"inherit":a.steering===null?"off":"override",s=r==="inherit"?t.defaultPublication:a.steering??null;if(t.requested!==r||a.savedModel&&m(t.savedModel)!==m(a.savedModel)||m(t.effectivePublication)!==m(s)||t.effectivePublication===null!=(t.profileHash===null)||t.effectivePublication===null&&t.calibration!==null)throw new h("steering_selection_mismatch","The admitted steering selection differs from the exact request and default.");return t}d(rd,"parseAndVerifyResolvedSteeringSelection");var ef=e.object({schemaVersion:e.literal("openpond.steeringInferenceReceipt.v1"),teamId:da,requestId:da,requestHash:qt,selection:id,poolId:da,routingBinding:e.object({id:da,revision:e.number().int().positive()}).strict().nullable(),runtimeHash:qt,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),engineGeneration:e.number().int().positive(),cacheNamespace:qt,completedAt:e.iso.datetime()}).strict(),od=ef.extend({contentHash:qt}).strict();async function IS(i,n){let t=od.parse(i),{contentHash:a,...r}=t;if(await rd(t.selection,n.options),a!==await u(r)||t.teamId!==n.teamId||t.requestId!==n.requestId||t.requestHash!==n.requestHash||m(t.selection)!==m(n.selection)||t.poolId!==n.poolId||m(t.routingBinding)!==m(n.routingBinding)||t.runtimeHash!==n.runtimeHash||t.workerImageDigest!==n.workerImageDigest||t.engineGeneration!==n.engineGeneration||t.cacheNamespace!==n.cacheNamespace)throw new h("steering_inference_receipt_mismatch","The completed inference differs from its admitted steering, runtime or cache identity.");return t}d(IS,"parseAndVerifySteeringInferenceReceipt");var D=e.string().trim().min(1).max(240),on=e.string().regex(/^[a-f0-9]{64}$/),tf=e.object({id:D,revision:e.number().int().positive()}).strict(),sd=e.iso.datetime(),Zn=e.object({usageApproval:gt.optional(),schemaVersion:e.literal("openpond.steeringModelServingControlRequest.v1"),teamId:D,operationId:D,versionHash:on,expectedRevision:e.number().int().nonnegative(),action:e.enum(["activate","stop"]),defaultPublication:lt.nullable(),idleTimeoutSeconds:e.number().int().min(60).max(3600)}).strict(),SS=Zn.omit({operationId:!0}).extend({modelProjectId:D}).strict(),xS=e.object({modelProjectId:D,request:Zn}).strict(),qi=e.object({usage:ft.optional(),schemaVersion:e.literal("openpond.steeringModelServingControl.v1"),teamId:D,modelProjectId:D,versionHash:on,actorId:D,operationId:D,revision:e.number().int().positive(),defaultPublication:lt.nullable(),desiredState:e.enum(["active","stopped"]),phase:e.enum(["starting","active","stopping","stopped","failed"]),capacityState:e.enum(["pending","shared","retiring","released"]),modelId:D,poolId:D.nullable(),binding:tf.nullable(),activeRequests:e.number().int().nonnegative(),unsettledRequests:e.number().int().nonnegative(),idleTimeoutSeconds:e.number().int().min(60).max(3600),failureCode:D.nullable(),updatedAt:sd}).strict(),nf=e.object({id:D,revision:e.number().int().positive(),modelId:D,poolId:D,versionHash:on}).strict(),af=e.object({state:e.enum(["qualified","unavailable"]),reason:e.enum(["qualified","runtime_unavailable","calibration_unavailable","profile_archived","model_mismatch"]),runtimeHash:on.nullable()}).strict(),rf=e.object({usageBilling:vt.optional(),schemaVersion:e.literal("openpond.steeringModelServing.v1"),teamId:D,modelProjectId:D,observedAt:sd,version:$n,defaultPublication:lt.nullable(),availability:af,control:qi.nullable(),cleanup:e.array(qi).max(100),pools:e.array(Wt).max(100),bindings:e.array(nf).max(100),lastVerifiedInference:od.nullable(),state:e.enum(["unavailable","inactive","starting","active","retiring"])}).strict(),cd=rf.extend({contentHash:on}).strict(),of=e.discriminatedUnion("schemaVersion",[nd,cd,us,Fc,Cc,Dc]),sf=td,cf=e.object({schemaVersion:e.literal("openpond.steeringModelServingControlReceipt.v1"),teamId:D,modelProjectId:D,actorId:D,request:Zn,version:$n,control:qi}).strict(),df=cf.extend({contentHash:on}).strict();function Ct(i,n){return m(i)===m(n)}d(Ct,"sameRef");function zi(i){let{id:n,revision:t,contentHash:a}=i.publication;return{id:n,revision:t,contentHash:a}}d(zi,"publicationRef");function dd(i){return i.modelId===`personalized:model:${i.modelProjectId}`&&(!i.binding||i.poolId!==null)&&(i.phase!=="active"||i.desiredState==="active"&&i.poolId!==null&&i.binding!==null&&["pending","shared"].includes(i.capacityState))&&(i.phase!=="stopping"||i.desiredState==="stopped")&&(i.capacityState!=="released"||!i.binding&&i.activeRequests===0&&i.unsettledRequests===0)&&(i.phase!=="stopped"||i.desiredState==="stopped"&&!i.binding&&i.activeRequests===0&&i.unsettledRequests===0&&["shared","released"].includes(i.capacityState))}d(dd,"validControl5");function mf(i){let n=i.control;if(n?.phase==="stopping"||i.cleanup.some(a=>a.phase!=="stopped"||!["shared","released"].includes(a.capacityState)))return"retiring";if(i.availability.state!=="qualified"||n?.phase==="failed")return"unavailable";if(!n||n.desiredState==="stopped")return i.bindings.length?"unavailable":"inactive";let t=n.binding;return n.phase==="active"&&t&&i.bindings.some(a=>a.id===t.id&&a.revision===t.revision&&a.poolId===n.poolId&&i.pools.some(r=>r.id===a.poolId&&r.state==="ready"&&r.endpointRecorded))?"active":n.phase==="starting"?"starting":"unavailable"}d(mf,"steeringModelServingState");async function lf(i,n){let t=df.parse(i),a=Zn.parse(n.request),{contentHash:r,...s}=t,o=t.control;if(await ot(t.version,{teamId:a.teamId,modelProjectId:n.modelProjectId}),!Ot(a,o)||r!==await u(s)||m(t.request)!==m(a)||t.teamId!==a.teamId||t.modelProjectId!==n.modelProjectId||n.actorId&&t.actorId!==n.actorId||t.version.contentHash!==a.versionHash||a.defaultPublication!==null&&!Ct(a.defaultPublication,zi(t.version))||o.teamId!==t.teamId||o.modelProjectId!==t.modelProjectId||o.actorId!==t.actorId||o.operationId!==a.operationId||o.versionHash!==a.versionHash||o.revision!==a.expectedRevision+1||o.idleTimeoutSeconds!==a.idleTimeoutSeconds||!Ct(o.defaultPublication,a.defaultPublication)||o.desiredState!==(a.action==="activate"?"active":"stopped")||!dd(o)||a.action==="activate"&&!["starting","active"].includes(o.phase)||a.action==="stop"&&!["stopping","stopped"].includes(o.phase))throw new h("steering_serving_control_mismatch","The serving receipt differs from the exact saved steering Model, default or original command.");return t}d(lf,"parseAndVerifySteeringModelServingControl");async function uf(i,n){let t=cd.parse(i),{contentHash:a,...r}=t;await Ft(t.usageBilling,{...n,method:"steering"},t.control),await ot(t.version,n);function s(){throw new h("steering_model_serving_mismatch","The serving evidence differs from the exact saved steering Model or retained capacity.")}d(s,"fail8"),(a!==await u(r)||t.teamId!==n.teamId||t.modelProjectId!==n.modelProjectId||t.version.contentHash!==n.versionHash||t.defaultPublication!==null&&!Ct(t.defaultPublication,zi(t.version))||t.state!==mf(t)||t.availability.state==="qualified"!=(t.availability.reason==="qualified")||t.availability.state==="qualified"&&t.availability.runtimeHash===null)&&s();for(let l of[t.pools,t.bindings])new Set(l.map(p=>p.id)).size!==l.length&&s();for(let l of[...t.cleanup,...t.control?[t.control]:[]])(l.teamId!==n.teamId||l.modelProjectId!==n.modelProjectId||!dd(l))&&s();(new Set(t.cleanup.map(l=>l.operationId)).size!==t.cleanup.length||t.cleanup.some(l=>l.desiredState!=="stopped"))&&s();let o=t.control;o&&(o.versionHash!==n.versionHash&&!(o.phase==="stopped"&&o.desiredState==="stopped")||o.versionHash===n.versionHash&&!Ct(o.defaultPublication,t.defaultPublication))&&s(),t.bindings.some(l=>l.versionHash!==n.versionHash||l.modelId!==`personalized:model:${n.modelProjectId}`||!t.pools.some(p=>p.id===l.poolId))&&s(),o?.binding&&!t.bindings.some(l=>l.id===o.binding.id&&l.revision===o.binding.revision&&l.poolId===o.poolId&&l.modelId===o.modelId)&&s(),t.pools.some(l=>l.workersMin>l.workersMax)&&s();let c=t.lastVerifiedInference;if(c){let{contentHash:l,...p}=c;await rd(c.selection,{...c.selection.savedModel===null?{}:{savedModel:c.selection.savedModel},...c.selection.requested==="inherit"?{}:{steering:c.selection.requested==="off"?null:c.selection.effectivePublication}});let g=zi(t.version),v=t.version.publication.profile,f=v.normalization.mode==="fixed_residual_reference"?v.normalization.calibration:null;(c.selection.defaultPublication!==null&&!Ct(c.selection.defaultPublication,g)||Ct(c.selection.effectivePublication,g)&&(c.selection.profileHash!==v.contentHash||m(c.selection.calibration)!==m(f)))&&s(),(l!==await u(p)||c.teamId!==n.teamId||c.selection.savedModel?.modelProjectId!==n.modelProjectId||c.selection.savedModel.versionHash!==n.versionHash||c.selection.modelHash!==await u(t.version.publication.profile.model)||t.pools.some(S=>S.id===c.poolId&&S.workerImageDigest!==c.workerImageDigest))&&s()}return t}d(uf,"parseAndVerifySteeringModelServing");async function pf(i,n){let t=of.parse(i);return t.schemaVersion==="openpond.alphaEditModelServing.v1"?zc(t,n):t.schemaVersion==="openpond.neuronTrainingModelServing.v1"?Vc(t,n):t.schemaVersion==="openpond.trainingModelServing.v1"?ad(t,n):t.schemaVersion==="openpond.engramModelServing.v1"?Zd(t,n):t.schemaVersion==="openpond.decisionModelServing.v1"?Lc(t,n):uf(t,n)}d(pf,"parseAndVerifySavedModelServing");function hf(i){return{async savedModelServing(n,t){let a=D.parse(n),r=sf.parse(t);return pf(await i(`/v1/training/models/${encodeURIComponent(a)}/serving?${new URLSearchParams(r)}`),{modelProjectId:a,...r})},async controlSteeringModelServing(n,t){let a=D.parse(n),r=Zn.parse(t);return lf(await i(`/v1/training/models/${encodeURIComponent(a)}/serving`,{method:"POST",body:JSON.stringify(r)}),{modelProjectId:a,request:r})}}}d(hf,"createSavedModelServingClient");var Di=e.string().trim().min(1).max(500),md=e.string().regex(/^[a-f0-9]{64}$/),gf=e.object({schemaVersion:e.literal("openpond.neuronResidualCalibrationRequest.v1"),id:Di,revision:e.number().int().positive(),model:B,prompt:Gi,layers:e.array(e.number().int().nonnegative().max(511)).min(1).max(512),maximumForwardTokenWork:e.number().int().positive().max(1e6),maximumDurationSeconds:e.number().finite().positive().max(300)}).strict().superRefine((i,n)=>{(new Set(i.layers).size!==i.layers.length||i.layers.some(t=>t>=i.model.intermediateSizes.length))&&n.addIssue({code:"custom",path:["layers"],message:"Use unique layers inside the exact model."}),i.prompt.attentionMask.filter(Boolean).length<2&&n.addIssue({code:"custom",path:["prompt"],message:"Calibration requires a visible token after position zero."}),i.prompt.tokenIds.length>i.maximumForwardTokenWork&&n.addIssue({code:"custom",path:["maximumForwardTokenWork"],message:"The complete unsteered forward exceeds its declared budget."})}),ff=e.object({schemaVersion:e.literal("openpond.neuronResidualCalibrationExport.v1"),model:B,prompt:Gi,calibration:es,runtime:e.object({implementation:e.literal("torch_dense_serial_calibration_v1"),implementationHash:md,torchVersion:Di,device:Di}).strict()}).strict(),Pr=ff.extend({contentHash:md}).strict();async function ld(i,n){let t=Pr.parse(i),{contentHash:a,...r}=t,s=await Si(t.calibration,t.model),o=await u(t.prompt),c=t.prompt.attentionMask.filter(Boolean).length-1,l=a!==await u(r)||c<=0||s.source.id!==t.prompt.id||s.source.contentHash!==o||s.layers.some(p=>p.sampleCount!==c);if(n){let p=gf.parse(n);l||=m(t.model)!==m(p.model)||m(t.prompt)!==m(p.prompt)||s.id!==p.id||s.revision!==p.revision||m(s.layers.map(g=>g.layer).sort((g,v)=>g-v))!==m([...p.layers].sort((g,v)=>g-v))}if(l)throw new h("neuron_calibration_export_mismatch","The original residual calibration differs from its exact measured model, tokenized source or layers.");return t}d(ld,"parseAndVerifyNeuronResidualCalibrationExport");var q=e.string().trim().min(1).max(500),ze=e.string().regex(/^[a-f0-9]{64}$/),kr=e.string().trim().min(1).max(200),Ia=e.iso.datetime(),vf=e.object({schemaVersion:e.literal("openpond.neuronCalibrationRecord.v1"),teamId:q,ownerUserId:q,projectId:q.nullable(),name:kr,artifact:Pr,revision:e.number().int().positive(),archived:e.boolean(),createdAt:Ia,updatedAt:Ia}).strict(),ud=vf.extend({contentHash:ze}).strict(),pd=e.object({teamId:q,operationId:q,projectId:q.nullable(),name:kr,artifact:Pr}).strict(),_S=e.object({teamId:q}).strict(),hd=e.object({teamId:q,operationId:q,expectedRevision:e.number().int().positive(),contentHash:ze}).strict(),bf=e.object({schemaVersion:e.literal("openpond.neuronCalibrationReceipt.v1"),teamId:q,actorId:q,operationId:q,requestHash:ze,record:ud}).strict(),If=bf.extend({contentHash:ze}).strict(),gd=e.object({projectId:q.optional(),modelHash:ze.optional(),archived:e.boolean().default(!1),limit:e.number().int().min(1).max(100).default(25),cursor:e.string().min(1).max(2048).optional()}).strict(),Sf=e.object({reference:Ni,teamId:q,ownerUserId:q,projectId:q.nullable(),name:kr,exportHash:ze,modelHash:ze,source:e.object({id:q,contentHash:ze}).strict(),implementationHash:ze,layerCount:e.number().int().min(1).max(512),revision:e.number().int().positive(),archived:e.boolean(),createdAt:Ia,updatedAt:Ia}).strict(),xf=e.object({schemaVersion:e.literal("openpond.neuronCalibrationPage.v1"),teamId:q,ownerUserId:q,query:gd,items:e.array(Sf).max(100),nextCursor:e.string().min(1).max(2048).nullable()}).strict(),yf=xf.extend({contentHash:ze}).strict();async function fd(i,n={}){let t=ud.parse(i),{contentHash:a,...r}=t;if(await ld(t.artifact),a!==await u(r)||n.teamId&&t.teamId!==n.teamId||n.ownerUserId&&t.ownerUserId!==n.ownerUserId||n.id&&t.artifact.calibration.id!==n.id)throw new h("neuron_calibration_record_mismatch","The original calibration record differs from its artifact or authorized workspace.");return t}d(fd,"parseAndVerifyNeuronCalibrationRecord");async function Fo(i,n,t){let a=If.parse(i),{contentHash:r,...s}=a,o="artifact"in n,c=o?pd.parse(n):hd.parse(n);if(await fd(a.record,{teamId:c.teamId,ownerUserId:a.actorId,id:t}),r!==await u(s)||a.teamId!==c.teamId||a.operationId!==c.operationId||a.requestHash!==await u(o?c:{id:t,request:c}))throw new h("neuron_calibration_receipt_mismatch","Retry the original calibration custody command.");if("artifact"in c){if(m(a.record.artifact)!==m(c.artifact)||a.record.projectId!==c.projectId||a.record.name!==c.name||a.record.archived||a.record.revision!==1)throw new h("neuron_calibration_receipt_mismatch","The imported record differs from the original measured export.")}else if(!a.record.archived||a.record.revision!==c.expectedRevision+1||a.record.artifact.contentHash!==c.contentHash)throw new h("neuron_calibration_receipt_mismatch","The archive differs from the original artifact and record revision.");return a}d(Fo,"parseAndVerifyNeuronCalibrationReceipt");function wf(i){return{async importNeuronCalibration(n){let t=pd.parse(n);return await ld(t.artifact),Fo(await i("/v1/training/neuron-calibrations",{method:"POST",body:JSON.stringify(t)}),t)},async getNeuronCalibration(n,t){let a=q.parse(n),r=q.parse(t);return fd(await i(`/v1/training/neuron-calibrations/${encodeURIComponent(r)}?${new URLSearchParams({teamId:a})}`),{teamId:a,id:r})},async archiveNeuronCalibration(n,t){let a=q.parse(n),r=hd.parse(t);return Fo(await i(`/v1/training/neuron-calibrations/${encodeURIComponent(a)}/archive`,{method:"POST",body:JSON.stringify(r)}),r,a)},async listNeuronCalibrations(n,t={}){let a=q.parse(n),r=Object.fromEntries(Object.entries(gd.parse(t)).filter(([,p])=>p!==void 0)),s=new URLSearchParams({teamId:a});for(let[p,g]of Object.entries(r))g!==void 0&&s.set(p,String(g));let o=yf.parse(await i(`/v1/training/neuron-calibrations?${s}`)),{contentHash:c,...l}=o;if(o.teamId!==a||m(o.query)!==m(r)||c!==await u(l)||o.items.length>r.limit||new Set(o.items.map(p=>p.reference.id)).size!==o.items.length||o.nextCursor!==null&&(o.items.length!==r.limit||o.nextCursor===r.cursor))throw new h("neuron_calibration_page_mismatch","Refresh calibration history in its original workspace.");for(let[p,g]of o.items.entries())if(g.teamId!==a||g.ownerUserId!==o.ownerUserId||g.archived!==r.archived||r.projectId&&g.projectId!==r.projectId||r.modelHash&&g.modelHash!==r.modelHash||p&&o.items[p-1].reference.id>=g.reference.id)throw new h("neuron_calibration_page_mismatch","Calibration history returned a different creator or source scope.");return o}}}d(wf,"createNeuronCalibrationClient");var vd=d((i,n)=>{let t=i-n;return Number.isFinite(t)?t:null},"difference");function HS(i,n){let t=i.profile,a=n.profile,r=d(c=>{let{entries:l,contentHash:p,...g}=c;return m({...g,coordinates:l.map(({layer:v,neuron:f})=>`${v}:${f}`).sort()})},"settings"),s=t&&a&&r(t)!==r(a)?"Dose differences unavailable: model, hook, normalization, token scope or targeted coordinates differ.":null,o=new Map;for(let[c,l]of[[t,"reference"],[a,"candidate"]])for(let p of c?.entries??[]){let g=`${p.layer}:${p.neuron}`,v=o.get(g)??{layer:p.layer,neuron:p.neuron,reference:t===null?0:null,candidate:a===null?0:null};v[l]=p.dose,o.set(g,v)}return{reason:s,rows:[...o.values()].sort((c,l)=>c.layer-l.layer||c.neuron-l.neuron).map(c=>({...c,difference:!s&&c.reference!==null&&c.candidate!==null?vd(c.candidate,c.reference):null}))}}d(HS,"activationDoseComparison");function _f(i,n,t,a,r){let s=d(f=>JSON.stringify([f.promptId,f.tokenIndex,f.layer,f.neuron]),"captureKey"),o=new Map,c=new Map;for(let f of n.captures)f.variantId===t&&o.set(s(f),f),f.variantId===a&&c.set(s(f),f);let l=new Map(n.outcomes.map(f=>[JSON.stringify([f.promptId,f.variantId]),f])),g=i.prompts.filter(f=>r===null||f.id===r).map(f=>{let S=l.get(JSON.stringify([f.id,t])),b=l.get(JSON.stringify([f.id,a])),x=f.tokenIds.filter((w,P)=>f.attentionMask[P]===1),H=S?x.concat(S.generatedTokenIds):[],R=b?x.concat(b.generatedTokenIds):[],ee=0;for(;ee<Math.min(H.length,R.length)&&H[ee]===R[ee];)ee++;let y=Math.max(0,ee-x.length),I=!S||!b?"missing_outcome":S.generatedTokenIds.length===b.generatedTokenIds.length&&y===S.generatedTokenIds.length?"identical":"different";return{prompt:f,reference:S,candidate:b,inputTokenIds:x,referenceTokenIds:H,candidateTokenIds:R,sharedPrefix:ee,generatedStatus:I,generatedDifferencePosition:I==="different"?y:null}}),v=g.flatMap(f=>{let S=Math.max(f.referenceTokenIds.length,f.candidateTokenIds.length,f.inputTokenIds.length),b=[];for(let x=0;x<S;x++)for(let H of i.capture)for(let R of H.neurons){let ee=s({promptId:f.prompt.id,tokenIndex:x,layer:H.layer,neuron:R}),y=o.get(ee),I=c.get(ee),w=!y||!I?!y&&!I?"missing_both":y?"missing_candidate":"missing_reference":x>=f.sharedPrefix?"incompatible_context":"aligned";b.push({key:ee,promptId:f.prompt.id,tokenIndex:x,phase:x<f.inputTokenIds.length?"Prompt":"Generated",layer:H.layer,neuron:R,reference:y,candidate:I,status:w,difference:w==="aligned"?vd(I.after,y.after):null})}return b});return{pairs:g,captures:v,aligned:v.filter(f=>f.status==="aligned").length}}d(_f,"activationResultComparison");async function jS(i,n,t,a,r=null){let s=await It(i),o=await Ji(n,s);return _f(s,o,t,a,r)}d(jS,"verifyAndCompareActivationReferenceResult");var re=e.string().trim().min(1).max(240),dt=e.string().regex(/^[a-f0-9]{64}$/),Ar=8388608,Hf=e.object({schemaVersion:e.literal("openpond.modificationRecordingRequest.v1"),teamId:re,operationId:re,name:e.string().trim().min(1).max(500),projectId:re.nullable(),method:Oe,request:at,result:xa}).strict(),jf=e.object({schemaVersion:e.literal("openpond.modificationRecording.v1"),id:re,teamId:re,actorId:re,operationId:re,commandHash:dt,name:e.string().trim().min(1).max(500),projectId:re.nullable(),method:Oe,accountScopeHash:dt,custody:e.literal("local"),provenance:e.literal("external_observation"),measurementAttestation:e.literal("unattested"),model:at.shape.model,inputHash:dt,resultHash:dt,artifact:e.object({contentHash:dt,sizeBytes:e.number().int().positive().max(Ar)}).strict(),counts:e.object({prompts:e.number().int().positive().max(8),variants:e.number().int().positive().max(17),outcomes:e.number().int().positive().max(136),captures:e.number().int().nonnegative().max(32768)}).strict(),createdAt:e.iso.datetime()}).strict(),Cr=jf.extend({contentHash:dt}).strict(),Tf=e.object({request:at,result:xa}).strict(),Mf=e.object({recording:Cr,document:Tf}).strict(),MS=e.object({teamId:re}).strict(),Rf=e.object({teamId:re,projectId:re.optional(),search:e.string().trim().max(1e3).optional(),cursor:e.string().min(1).max(2e3).optional(),limit:e.number().int().min(1).max(100).default(30)}).strict(),Ef=e.object({teamId:re,actorId:re,accountScopeHash:dt,projectId:re.nullable(),items:e.array(Cr).max(100),nextCursor:e.string().min(1).max(2e3).nullable()}).strict();async function bd(i){let n=Hf.parse(i);if(new TextEncoder().encode(m(n)).byteLength>Ar)throw new h("modification_recording_too_large","The recording exceeds 8 MiB.");let t=await It(n.request);await Ji(n.result,t);let a=t.variants.filter(r=>r.profile!==null).length;if(n.method==="inspect_activations"?a>0:a===0||a===t.variants.length)throw new h("modification_recording_method_mismatch","Inspection must be unsteered; a steering comparison needs an explicit Off baseline and intervention.");return n}d(bd,"verifyModificationRecordingRequest");async function Ui(i,n,t){let a=Cr.parse(i),{contentHash:r,...s}=a;if(r!==await u(s)||n!==void 0&&a.teamId!==n||t!==void 0&&a.actorId!==t||a.id!==`observation-${await u({scope:a.accountScopeHash,operationId:a.operationId})}`||a.counts.outcomes!==a.counts.prompts*a.counts.variants)throw new h("modification_recording_scope_mismatch","The retained recording differs from its owner or immutable metadata.");return a}d(Ui,"verifyModificationRecording");async function Pf(i,n,t){let a=Mf.parse(i),r=await Ui(a.recording,n,t),s=await bd({schemaVersion:"openpond.modificationRecordingRequest.v1",teamId:r.teamId,operationId:r.operationId,name:r.name,projectId:r.projectId,method:r.method,...a.document}),o=new TextEncoder().encode(m(a.document)).byteLength;if(r.commandHash!==await u(s)||r.artifact.contentHash!==await u(a.document)||r.artifact.sizeBytes!==o||r.inputHash!==await u(a.document.request)||r.resultHash!==a.document.result.contentHash||m(r.model)!==m(s.request.model)||r.counts.prompts!==s.request.prompts.length||r.counts.variants!==s.request.variants.length||r.counts.outcomes!==s.result.outcomes.length||r.counts.captures!==s.result.captures.length)throw new h("modification_recording_artifact_mismatch","The retained observation differs from its request, output or capture inventory.");return{...a,recording:r}}d(Pf,"verifyModificationRecordingRead");function kf(i){return{async recordModificationObservation(n){let t=await bd(n),a=await Ui(await i("/v1/modification-recordings",{method:"POST",body:m(t)}),t.teamId);if(a.commandHash!==await u(t)||a.operationId!==t.operationId)throw new h("modification_recording_request_mismatch","The service retained another observation.");return a},async modificationRecording(n,t){let a=re.parse(n),r=re.parse(t.teamId),s=await Pf(await i(`/v1/modification-recordings/${encodeURIComponent(a)}?${new URLSearchParams({teamId:r})}`,void 0,Ar+65536),r);if(s.recording.id!==a)throw new h("modification_recording_scope_mismatch","The service returned another recording.");return s},async modificationRecordings(n){let t=Rf.parse(n),a=new URLSearchParams;for(let[s,o]of Object.entries(t))o!==void 0&&a.set(s,String(o));let r=Ef.parse(await i(`/v1/modification-recordings?${a}`));if(r.teamId!==t.teamId||r.projectId!==(t.projectId??null)||r.items.length>t.limit||new Set(r.items.map(s=>s.id)).size!==r.items.length||t.cursor&&r.nextCursor===t.cursor)throw new h("modification_recording_scope_mismatch","The recording list returned another scope or page.");for(let s of r.items)if(await Ui(s,t.teamId,r.actorId),s.accountScopeHash!==r.accountScopeHash||t.projectId&&s.projectId!==t.projectId)throw new h("modification_recording_scope_mismatch","The recording list returned another Project.");return r}}}d(kf,"createModificationRecordingsClient");var Oo=e.string().min(1).max(191).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/),Af=e.object({id:e.string().trim().min(1).max(256),name:e.string().trim().min(1).max(256),manufacturer:e.string().trim().min(1).max(100),memoryGb:e.number().int().positive(),secureCloud:e.boolean(),communityCloud:e.boolean(),maximumPerPod:e.object({secure:e.number().int().nonnegative(),community:e.number().int().nonnegative()}).strict()}).strict(),Id=e.object({schemaVersion:e.literal("openpond.trainingHardwareInventory.v1"),provider:Oo,source:Oo,version:e.string().regex(/^[a-f0-9]{64}$/),observedAt:e.iso.datetime(),refreshAfter:e.iso.datetime(),hardware:e.array(Af).max(1e3)}).strict(),Cf=e.object({schemaVersion:e.literal("openpond.trainingHardwareCatalog.v1"),inventory:Id,workerImageDigest:e.string().regex(/^sha256:[a-f0-9]{64}$/),eligibility:e.array(e.object({gpuTypeId:e.string().min(1).max(256),status:e.enum(["requires_live_workload_check","not_admitted"]),reason:e.enum(["candidate_for_current_runtime","gpu_type_not_enabled","secure_pods_unavailable","insufficient_memory"])}).strict()).max(1e3)}).strict();async function qf(i){let n=Id.parse(i),{version:t,observedAt:a,refreshAfter:r,...s}=n;if(t!==await u(s)||Date.parse(r)<=Date.parse(a)||new Set(n.hardware.map(o=>o.id)).size!==n.hardware.length)throw new h("training_hardware_inventory_mismatch","Hardware metadata could not be verified.");return n}d(qf,"parseAndVerifyTrainingHardwareInventory");async function zf(i){let n=Cf.parse(i);await qf(n.inventory);let t=new Set(n.inventory.hardware.map(a=>a.id));if(n.eligibility.length!==t.size||new Set(n.eligibility.map(a=>a.gpuTypeId)).size!==t.size||n.eligibility.some(a=>!t.has(a.gpuTypeId)||a.status==="requires_live_workload_check"!=(a.reason==="candidate_for_current_runtime")))throw new h("training_hardware_catalog_mismatch","Hardware eligibility does not match its inventory.");return n}d(zf,"parseAndVerifyTrainingHardwareCatalog");function Df(i){return{async hardwareCatalog(){return zf(await i("/v1/training/hardware-catalog"))}}}d(Df,"createTrainingHardwareCatalogClient");var Uf=e.object({schemaVersion:e.literal("openpond.trainingHarnessSourcePublication.v1"),harnessRelease:Oa,sourcePackageHash:e.string().regex(/^[a-f0-9]{64}$/),sizeBytes:e.number().int().positive().max(cn)}).strict();function Vf(i){let n=d(t=>{let a=Oa.parse(t);return`/v1/training/harness-sources/${encodeURIComponent(a.id)}/${a.contentHash}`},"route");return{async publishHarnessSource(t){jt(t,cn,"Training Harness source");let a=Lo(t),r=a.agentSnapshot.portability;if(!r.portable||r.blockers.length||r.localOnlyAssetRefs.length||r.hostPrivateAssetRefs.length||a.schemaVersion==="openpond.harnessSourcePackage.v1"&&a.harnessRelease.files.some(o=>o.visibility!=="policy"))throw new Error("Hosted training Harness publication requires portable, policy-visible source.");let s=Uf.parse(await i(n({id:a.harnessRelease.id,contentHash:a.harnessRelease.contentHash}),{method:"PUT",body:JSON.stringify(a)}));if(s.harnessRelease.id!==a.harnessRelease.id||s.harnessRelease.contentHash!==a.harnessRelease.contentHash||s.sourcePackageHash!==a.contentHash)throw new Error("Published Harness source differs from the selected immutable package.");return s},async getHarnessSource(t){let a=await i(n(t),void 0,cn);return jt(a,cn,"Training Harness source"),Lo(a,t)}}}d(Vf,"createTrainingHarnessSourceClient");function Lo(i,n){return typeof i=="object"&&i!==null&&Reflect.get(i,"schemaVersion")==="openpond.harnessPolicySourcePackage.v1"?bo(i,n):Io(i,n)}d(Lo,"validateSource");var et=e.string().trim().min(1).max(500),Nf=e.string().regex(/^[a-f0-9]{64}$/),qr=e.object({schemaVersion:e.literal("openpond.trainingCandidateDecisionRequest.v1"),teamId:et,jobId:et,artifact:j,evaluation:j,executionReceipt:j,decision:e.enum(["accepted","rejected"]),reason:e.string().trim().min(1).max(5e3),idempotencyKey:et,expectedDecision:j.nullable()}).strict(),$f=e.object({schemaVersion:e.literal("openpond.trainingCandidateDecision.v1"),id:et,request:qr,revision:e.number().int().positive(),actor:e.object({userId:et,kind:e.enum(["user","api_key","agent_delegate"]),id:et}).strict(),decidedAt:e.string().datetime({offset:!0}),contentHash:Nf}).strict().superRefine((i,n)=>{i.revision===1!=(i.request.expectedDecision===null)&&n.addIssue({code:"custom",path:["revision"],message:"A first decision has no predecessor; later decisions must reference the prior decision."}),i.request.expectedDecision?.id===i.id&&n.addIssue({code:"custom",path:["request","expectedDecision"],message:"A decision cannot supersede itself."})});async function Bf(i){let{contentHash:n,...t}=i;return u(t)}d(Bf,"trainingCandidateDecisionHash");async function Wo(i,n){jt(i,32768,"Training candidate decision");let t=$f.parse(i);if(t.contentHash!==await Bf(t))throw new h("content_hash_mismatch","Training candidate decision content hash does not match.");if(t.request.teamId!==n.teamId||t.request.jobId!==n.jobId||t.request.artifact.id!==n.artifact.id||t.request.artifact.contentHash!==n.artifact.contentHash)throw new h("candidate_decision_identity_mismatch","Training candidate decision belongs to a different team, Job or artifact.");if(n.request&&await u(t.request)!==await u(qr.parse(n.request)))throw new h("candidate_decision_request_mismatch","Training candidate decision does not match the submitted review.");return t}d(Wo,"parseAndVerifyTrainingCandidateDecision");function Ff(i){function n(t){return`/v1/training/jobs/${encodeURIComponent(et.parse(t.jobId))}/candidates/${encodeURIComponent(j.parse(t.artifact).id)}/decision`}return d(n,"route"),{async candidateDecision(t,a={}){et.parse(t.teamId);let r=a.decision?j.parse(a.decision):void 0,s=r?`?decisionId=${encodeURIComponent(r.id)}`:"",o=e.object({decision:e.unknown().nullable()}).strict().parse(await i(`${n(t)}${s}`));if(o.decision===null&&!r)return null;let c=await Wo(o.decision,t);if(r&&(c.id!==r.id||c.contentHash!==r.contentHash))throw new h("candidate_decision_identity_mismatch","Training candidate decision does not match the requested history entry.");return c},async recordCandidateDecision(t){let a=qr.parse(t),r=await i(n(a),{method:"POST",body:JSON.stringify(a)});return Wo(r,{...a,request:a})}}}d(Ff,"createTrainingCandidateDecisionClient");var Bt=e.string().trim().min(1).max(500),Sn=e.string().regex(/^[a-f0-9]{64}$/),Of=e.object({taskId:Bt,taskSha256:Sn,resultSha256:Sn,input:e.object({instruction:e.string().max(1e6),context:e.record(e.string(),e.unknown())}).strict(),output:e.string().max(1e6),outputSha256:Sn,score:e.number().finite().min(0).max(1),evidence:e.object({kind:e.enum(["worker_command","hosted_trace","local_trace"]),id:Bt}).strict()}).strict(),Lf=e.object({schemaVersion:e.literal("openpond.trainingEvaluationTaskPage.v1"),jobId:Bt,teamId:Bt,evaluation:j,kind:e.enum(["baseline","candidate"]),policyVersion:e.number().int().nonnegative(),taskset:F,panelSha256:Sn,offset:e.number().int().nonnegative(),total:e.number().int().min(1).max(1e4),tasks:e.array(Of).min(1).max(100),nextCursor:e.string().regex(/^[1-9]\d*$/).nullable(),contentHash:Sn}).strict().superRefine((i,n)=>{let t=i.offset+i.tasks.length,a=t<i.total?String(t):null;(t>i.total||i.nextCursor!==a)&&n.addIssue({code:"custom",path:["nextCursor"],message:"Evaluation pagination must cover consecutive task positions."}),new Set(i.tasks.map(r=>r.taskId)).size!==i.tasks.length&&n.addIssue({code:"custom",path:["tasks"],message:"Evaluation task identities must be unique."})});async function Wf(i){let{contentHash:n,...t}=i;return u(t)}d(Wf,"trainingEvaluationTaskPageHash");async function Gf(i,n){jt(i,na,"Training evaluation task page");let t=Lf.parse(i),a=j.parse(n.evaluation);if(t.jobId!==Bt.parse(n.jobId)||t.evaluation.id!==a.id||t.evaluation.contentHash!==a.contentHash||t.offset!==(n.offset??0)||n.teamId!==void 0&&t.teamId!==Bt.parse(n.teamId))throw new h("evaluation_page_identity_mismatch","Evaluation results differ from the requested Job, evaluation, or page.");if(await Wf(t)!==t.contentHash)throw new h("evaluation_page_hash_mismatch","Evaluation task page content hash did not match.");for(let r of t.tasks)if(await u(r.output)!==r.outputSha256)throw new h("evaluation_output_hash_mismatch","A retained evaluation output hash did not match.");return t}d(Gf,"parseAndVerifyTrainingEvaluationTaskPage");var Jf=/^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;function M(i){throw new h(`activation_form_${i}`,"The activation form cannot be compiled with these exact inputs.")}d(M,"fail7");function Sd(i){let n=i.trim();return Jf.test(n)||M("number_incomplete"),n}d(Sd,"decimal");function Vi(i){let n=Sd(i),t=Number(n);return(!Number.isFinite(t)||t===0&&/[1-9]/.test(n.split(/[eE]/)[0]))&&M("number_out_of_range"),t}d(Vi,"finite");function un(i,n,t){let a=Sd(i),r=a.startsWith("-"),s=a.replace(/^[+-]/,""),[o,c="0"]=s.split(/[eE]/),[l,p=""]=o.split("."),g=`${l}${p}`.replace(/^0+/,"");if(!g)return n<=0&&t>=0?0:M("integer_out_of_range");let v=BigInt(c)-BigInt(p.length);if(v<0n){let S=-v;(S>=BigInt(g.length)||S>BigInt(g.length-g.replace(/0+$/,"").length))&&M("integer_out_of_range"),g=g.slice(0,g.length-Number(S))}else BigInt(g.length)+v>BigInt(String(Math.max(Math.abs(n),Math.abs(t))).length)&&M("integer_out_of_range"),g+="0".repeat(Number(v));let f=+`${r?"-":""}${g}`;return(!Number.isSafeInteger(f)||f<n||f>t)&&M("integer_out_of_range"),f}d(un,"integer");function Qf(i){let n=i.trim(),t=n.includes(",")?n.split(","):n?n.split(/[\t-\r\x1c-\x20\x85\xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+/):[];(t.length<1||t.length>16)&&M("sweep_size_invalid");let a=t.map(Vi);return new Set(a).size!==a.length&&M("duplicate_multiplier"),a}d(Qf,"multipliers");async function AS(i,n){let t=ht.parse(i),a=B.parse(n.model),{method:r,tokenizer:s,calibrations:o=[],maximumAbsoluteDose:c=16}=n;r!=="neuron_steering"&&r!=="inspect_activations"&&M("method_unsupported"),(!t.prompts.length||!t.coordinates.length)&&M("rows_invalid"),(typeof c!="number"||!Number.isFinite(c)||c<=0)&&M("dose_limit_invalid");let l=T.parse(s.source),p=s.descriptor;(!t.baseModel||m(t.baseModel)!==m(l)||!l.revision||!l.tokenizerRevision||l.modelId!==a.modelId||l.revision!==a.revision||await u(p)!==a.tokenizerHash)&&M("tokenizer_identity_mismatch");let g=p.vocabSize,v=p.eosTokenIds;(typeof g!="number"||!Number.isInteger(g)||g<1||g>2147483648||!Array.isArray(v)||v.length>16||v.some(y=>typeof y!="number"||!Number.isInteger(y)||y<0||y>=g)||new Set(v).size!==v.length||typeof s.encode!="function")&&M("tokenizer_descriptor_invalid");let f=null;if(t.startingProfile){r!=="neuron_steering"&&M("saved_source_method_unsupported"),n.startingProfileVersion||M("saved_source_unresolved");let y=await sc(t.startingProfile,n.startingProfileVersion);if((m(y.publication.baseModel)!==m(t.baseModel)||m(y.publication.profile.model)!==m(a))&&M("saved_source_model_mismatch"),f=y.publication.profile,f.entries.some(I=>Math.abs(I.dose)>c)&&M("dose_limit_exceeded"),f.normalization.mode==="fixed_residual_reference"){let I=f.normalization.calibration,w=o.filter(K=>K.id===I.id&&K.revision===I.revision&&K.contentHash===I.contentHash);w.length!==1&&M("calibration_unavailable");let P=await Si(w[0],a,I);f.entries.some(K=>!P.layers.some(Fa=>Fa.layer===K.layer))&&M("calibration_incomplete")}}else n.startingProfileVersion&&M("saved_source_unrequested");let S=[],b=new Map,x=new Set;for(let y of t.coordinates){let I=un(y.layer,0,a.intermediateSizes.length-1),w=un(y.neuron,0,a.intermediateSizes[I]-1),P=`${I}:${w}`;x.has(P)&&M("duplicate_coordinate"),x.add(P);let K=b.get(I)??[];K.push(w),b.set(I,K),r==="neuron_steering"&&S.push({layer:I,neuron:w,dose:Vi(y.dose)})}let H=[{id:"baseline",profile:null}];if(f&&H.push({id:"saved-profile",profile:f}),r==="neuron_steering"){if(t.normalization.mode==="fixed_residual_reference"){let y=t.normalization.calibration;o.some(P=>!P||typeof P!="object"||Array.isArray(P))&&M("calibration_invalid");let I=o.filter(P=>P.id===y.id&&P.revision===y.revision&&P.contentHash===y.contentHash);I.length!==1&&M("calibration_unavailable");let w=await Si(I[0],a,y);S.some(P=>!w.layers.some(K=>K.layer===P.layer))&&M("calibration_incomplete")}for(let[y,I]of Qf(t.doseMultipliers).entries()){let w=S.map(K=>({...K,dose:K.dose*I}));w.some((K,Fa)=>!Number.isFinite(K.dose)||Math.abs(K.dose)>c||K.dose===0&&S[Fa].dose!==0&&I!==0)&&M("dose_limit_exceeded");let P=await jd({schemaVersion:"openpond.neuronSteeringProfile.v1",model:a,hook:"mlp.down_proj.input",operation:"add",normalization:t.normalization,tokenScope:t.tokenScope,entries:w});(!f||!H.some(K=>K.profile?.contentHash===P.contentHash))&&H.push({id:`strength-${y+1}`,profile:P})}}H.length>17&&M("variant_limit_exceeded");let R={maxNewTokens:un(t.maxNewTokens,0,128),maximumCapturedValues:un(t.maximumCapturedValues,1,65536),maximumForwardTokenWork:un(t.maximumForwardTokenWork,1,1e6),maximumDurationSeconds:Vi(t.maximumDurationSeconds)};(R.maximumDurationSeconds<=0||R.maximumDurationSeconds>300)&&M("number_out_of_range");let ee=[];for(let y of t.prompts){y.text||M("prompt_empty");let I;try{I=await s.encode(y.text)}catch{M("tokenization_failed")}(!Array.isArray(I)||I.length<1||I.length>4096||I.some(w=>typeof w!="number"||!Number.isInteger(w)||w<0||w>=g))&&M("tokenization_invalid"),ee.push({id:y.id,tokenIds:[...I],attentionMask:I.map(()=>1)})}return H.some(y=>y.profile?.normalization.mode==="baseline_prompt_residual_median")&&ee.some(y=>y.tokenIds.length<2)&&M("calibration_prompt_too_short"),It({schemaVersion:"openpond.activationReferenceRequest.v1",model:a,prompts:ee,variants:H,...t.startingProfile?{startingProfile:{...t.startingProfile,variantId:"saved-profile"}}:{},capture:Array.from(b,([y,I])=>({layer:y,neurons:I})),eosTokenIds:v,...R})}d(AS,"compileActivationForm");async function CS(i,n,t={}){let a=ht.parse(i),r=await ot(n,t);if(r.schemaVersion!=="openpond.steeringModelVersion.v1")throw new h("steering_experiment_source_mismatch","Choose a saved steering Model version.");let s=r.publication.profile;return ht.parse({...a,baseModel:r.publication.baseModel,coordinates:s.entries.map((o,c)=>({id:`saved-coordinate-${c+1}`,layer:String(o.layer),neuron:String(o.neuron),dose:String(o.dose)})),doseMultipliers:"1",normalization:s.normalization,tokenScope:s.tokenScope,startingProfile:fr(r)})}d(CS,"activationFormFromSteeringVersion");async function qS(i,n={}){let t=await ot(i,n);if(t.schemaVersion!=="openpond.steeringModelVersion.v1")throw new h("steering_experiment_source_mismatch","Choose a saved steering Model version.");let a=yt.parse({source:"steering",label:n.label??t.publication.name,inferenceModelId:null,baseModel:t.publication.baseModel,steering:fr(t)});if(a.source!=="steering")throw new h("steering_experiment_source_mismatch","Retain the saved steering source.");return a}d(qS,"experimentStartingModelFromSteeringVersion");var Ve=e.string().trim().min(1).max(500);function zS(i){let n=_o(i);return{postTraining:vo({request:n}),...iu(n),...xu(n),...Ig(n),...Tg(n),...Ag(n),...qg(n),...sm(n),...$g(n),...Yl(n),...Yg(n),...Og(n),...hf(n),...em(n),...wf(n),...gg(n),...Ro(n),...Df(n),...Wr(n),...bl(n),...kf(n),...Vf(n),...Ff(n),...lg(n),...Mu(n),...Ou(n),...lp(n),...kp(n),...eh(n),...yh(n),...Nl(n),...Ch(n),...Oh(n),...Nm(n),...Xh(n),...sg(n),...$d(n),async capabilities(){return mo.parse(Ne(await n("/v1/training/capabilities"),"capabilities"))},async stageArtifact(t){let a=await io(t);return ao.parse(Ne(await n("/v1/training/artifacts",{method:"POST",body:JSON.stringify(a)}),"artifact"))},async createJob(t){let a=await ia(t);return Le.parse(Ne(await n("/v1/training/jobs",{method:"POST",body:JSON.stringify(a)}),"job"))},async listJobs(t={}){let a=new URLSearchParams;t.modelProjectId&&a.set("modelProjectId",Ve.parse(t.modelProjectId)),t.cursor&&a.set("cursor",e.string().trim().min(1).max(2e3).parse(t.cursor)),t.limit!==void 0&&a.set("limit",String(e.number().int().min(1).max(1e3).parse(t.limit)));let r=a.size>0?`?${a.toString()}`:"";return oo.parse(await n(`/v1/training/jobs${r}`))},async getJob(t){return Le.parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}`),"job"))},async cancelJob(t,a){let r=Qa.parse({expectedVersion:a});return Le.parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/cancel`,{method:"POST",body:JSON.stringify(r)}),"job"))},async stopAfterGroup(t,a){let r=Qa.parse({expectedVersion:a});return Le.parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/stop-after-group`,{method:"POST",body:JSON.stringify(r)}),"job"))},async recoverCheckpoint(t,a){let r=to.parse(a);if(r.resourceApproval){let{approvalHash:s,...o}=r.resourceApproval;if(o.sourceJobId!==t||await u(o)!==s)throw new h("content_hash_mismatch","Recovery resource approval does not bind this source request.")}return Le.parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/recover`,{method:"POST",body:JSON.stringify(r)}),"job"))},async events(t){return e.array(so).parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/events`),"events"))},async outputs(t){return Ka.parse(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/outputs`))},async evaluationTasks(t,a,r={}){let s=Ve.parse(t),o=j.parse(a),c=new URLSearchParams,l=r.cursor===void 0?void 0:e.string().regex(/^[1-9]\d*$/).parse(r.cursor),p=l===void 0?0:e.number().int().min(1).max(9999).parse(Number(l));l!==void 0&&c.set("cursor",l),r.limit!==void 0&&c.set("limit",String(e.number().int().min(1).max(100).parse(r.limit)));let g=c.size?`?${c.toString()}`:"";return Gf(await n(`/v1/training/jobs/${encodeURIComponent(s)}/evaluations/${encodeURIComponent(o.id)}/tasks${g}`),{jobId:s,evaluation:o,offset:p})},async logs(t){return e.array(co).max(1e5).parse(Ne(await n(`/v1/training/jobs/${encodeURIComponent(Ve.parse(t))}/logs`),"logs"))}}}d(zS,"createTrainingClient");function Ne(i,n){return!i||typeof i!="object"||Array.isArray(i)?i:n in i?i[n]:i}d(Ne,"unwrapObject");export{wo as a,Za as b,oa as c,jo as d,To as e,Mo as f,_d as g,Jo as h,Qo as i,gt as j,ft as k,vt as l,Ft as m,Ot as n,ob as o,Ni as p,B as q,Hd as r,Ko as s,Xo as t,Yo as u,$i as v,jd as w,Zo as x,Td as y,es as z,Si as A,Fi as B,jn as C,Oi as D,ts as E,ns as F,Sa as G,Md as H,Rd as I,Lt as J,Ed as K,Pd as L,kd as M,as as N,Ad as O,is as P,Cd as Q,qd as R,Li as S,zd as T,Dd as U,Tn as V,rs as W,bt as X,os as Y,Ud as Z,Vd as _,Nd as $,$d as aa,ub as ba,Wt as ca,Bd as da,ss as ea,Fd as fa,cs as ga,ds as ha,Od as ia,ms as ja,hb as ka,Mn as la,gb as ma,fb as na,xi as oa,Wd as pa,Gd as qa,Jd as ra,us as sa,Qd as ta,Kd as ua,Xd as va,Yd as wa,Zd as xa,em as ya,lt as za,Wi as Aa,Rn as Ba,fs as Ca,vs as Da,Gi as Ea,at as Fa,It as Ga,tm as Ha,bs as Ia,nm as Ja,xa as Ka,Ji as La,Is as Ma,Ki as Na,am as Oa,St as Pa,Jt as Qa,im as Ra,rm as Sa,om as Ta,sm as Ua,pa as Va,fn as Wa,wn as Xa,ha as Ya,En as Za,Xi as _a,Yi as $a,cm as ab,Ss as bb,mn as cb,xs as db,Qt as eb,pm as fb,Kt as gb,yi as hb,Pn as ib,hm as jb,gm as kb,fm as lb,kn as mb,vm as nb,bm as ob,Rb as pb,Eb as qb,ya as rb,tr as sb,Im as tb,Sm as ub,nr as vb,ws as wb,_s as xb,kb as yb,Hs as zb,xm as Ab,ym as Bb,wm as Cb,_m as Db,js as Eb,Ts as Fb,Hm as Gb,Ms as Hb,jm as Ib,Tm as Jb,Mm as Kb,ar as Lb,ir as Mb,Rm as Nb,rr as Ob,Em as Pb,or as Qb,Pm as Rb,km as Sb,Am as Tb,zt as Ub,Cm as Vb,qm as Wb,Xt as Xb,Fe as Yb,zm as Zb,Cb as _b,Rs as $b,Dm as ac,Um as bc,Vm as cc,Nm as dc,Es as ec,$m as fc,Ps as gc,C as hc,As as ic,Bm as jc,Fm as kc,Om as lc,Lm as mc,qs as nc,Yt as oc,cr as pc,wa as qc,it as rc,_a as sc,Db as tc,Wm as uc,zs as vc,Ds as wc,Gm as xc,Vb as yc,Jm as zc,Us as Ac,Vs as Bc,Qm as Cc,Km as Dc,Xm as Ec,dr as Fc,Ym as Gc,mr as Hc,Ns as Ic,$s as Jc,_n as Kc,si as Lc,Bs as Mc,lr as Nc,An as Oc,Zm as Pc,el as Qc,Zt as Rc,Fs as Sc,Lb as Tc,tl as Uc,nl as Vc,Ha as Wc,al as Xc,il as Yc,rl as Zc,ol as _c,Os as $c,Ls as ad,sl as bd,cl as cd,ur as dd,dl as ed,pr as fd,Rt as gd,ll as hd,ul as id,pl as jd,ut as kd,Jb as ld,Cn as md,qn as nd,Oe as od,Ue as pd,hl as qd,gl as rd,fl as sd,vl as td,bl as ud,Sl as vd,Ws as wd,xl as xd,yl as yd,wl as zd,_l as Ad,Yb as Bd,Js as Cd,Hl as Dd,jl as Ed,Tl as Fd,Ml as Gd,Rl as Hd,Dn as Id,Zb as Jd,El as Kd,Un as Ld,Pl as Md,Vn as Nd,rt as Od,xt as Pd,kl as Qd,Al as Rd,eI as Sd,tI as Td,Cl as Ud,ql as Vd,zl as Wd,Dl as Xd,Ul as Yd,Vl as Zd,Nl as _d,ec as $d,hr as ae,tc as be,$l as ce,$n as de,nc as ee,ot as fe,Bl as ge,ac as he,ic as ie,Fl as je,Ol as ke,Ll as le,Wl as me,Uo as ne,rc as oe,Gl as pe,nI as qe,Jl as re,Ql as se,Kl as te,Xl as ue,Yl as ve,Zl as we,Ut as xe,eu as ye,tu as ze,gr as Ae,Vo as Be,nu as Ce,au as De,oc as Ee,ou as Fe,su as Ge,cu as He,du as Ie,mu as Je,lu as Ke,uu as Le,pu as Me,ht as Ne,pI as Oe,hI as Pe,hu as Qe,Vt as Re,gu as Se,fr as Te,sc as Ue,yt as Ve,fu as We,vu as Xe,bI as Ye,ct as Ze,bu as _e,Iu as $e,Su as af,II as bf,cc as cf,ja as df,dc as ef,SI as ff,xI as gf,vr as hf,yu as if,wu as jf,_u as kf,Hu as lf,ju as mf,_i as nf,Tu as of,Mu as pf,Ru as qf,Eu as rf,Pu as sf,br as tf,ku as uf,Ir as vf,Au as wf,Cu as xf,Bn as yf,Fn as zf,en as Af,qu as Bf,zu as Cf,xr as Df,Du as Ef,Uu as Ff,Vu as Gf,Nu as Hf,_I as If,lc as Jf,Re as Kf,$u as Lf,Bu as Mf,Fu as Nf,Ou as Of,Wu as Pf,Gu as Qf,pc as Rf,Ju as Sf,Qu as Tf,Ku as Uf,Xu as Vf,Yu as Wf,Ta as Xf,Zu as Yf,ep as Zf,tp as _f,np as $f,ji as ag,ap as bg,ip as cg,rp as dg,op as eg,sp as fg,cp as gg,dp as hg,gc as ig,di as jg,mp as kg,lp as lg,Ea as mg,pp as ng,hp as og,gp as pg,fp as qg,vp as rg,bp as sg,Ip as tg,Sp as ug,xp as vg,Pa as wg,yp as xg,wp as yg,_p as zg,Hp as Ag,Ti as Bg,jp as Cg,Tp as Dg,Mp as Eg,Ic as Fg,Sc as Gg,xc as Hg,MI as Ig,yc as Jg,Rp as Kg,wc as Lg,Ep as Mg,li as Ng,Pp as Og,kp as Pg,Cp as Qg,qp as Rg,Hc as Sg,zp as Tg,Dp as Ug,Up as Vg,Vp as Wg,Np as Xg,Ca as Yg,$p as Zg,Bp as _g,Fp as $g,Op as ah,Mi as bh,Lp as ch,Wp as dh,Gp as eh,Jp as fh,Qp as gh,Kp as hh,Xp as ih,Yp as jh,Tc as kh,pi as lh,Zp as mh,eh as nh,nh as oh,ah as ph,Rc as qh,ih as rh,rh as sh,oh as th,sh as uh,ch as vh,Da as wh,dh as xh,mh as yh,lh as zh,uh as Ah,Ri as Bh,ph as Ch,hh as Dh,gh as Eh,fh as Fh,vh as Gh,bh as Hh,Ih,Sh as Jh,Pc as Kh,gi as Lh,xh as Mh,yh as Nh,wh as Oh,Ac as Ph,Hr as Qh,_h as Rh,jr as Sh,AI as Th,jh as Uh,Qn as Vh,CI as Wh,qI as Xh,Ei as Yh,Th as Zh,Mh as _h,Rh as $h,Cc as ai,Eh as bi,Ph as ci,kh as di,Ah as ei,zc as fi,Ch as gi,zh as hi,Kn as ii,DI as ji,UI as ki,Pi as li,Dh as mi,Uh as ni,Vh as oi,Dc as pi,Nh as qi,$h as ri,Bh as si,Fh as ti,Vc as ui,Oh as vi,Wh as wi,Tr as xi,Gh as yi,Nc as zi,Jh as Ai,$c as Bi,Qh as Ci,Bc as Di,Kh as Ei,Xh as Fi,Zh as Gi,Xn as Hi,BI as Ii,FI as Ji,ki as Ki,eg as Li,tg as Mi,ng as Ni,Fc as Oi,ag as Pi,ig as Qi,rg as Ri,og as Si,Lc as Ti,sg as Ui,OI as Vi,LI as Wi,WI as Xi,GI as Yi,JI as Zi,QI as _i,cg as $i,dg as aj,mg as bj,Wc as cj,ug as dj,pg as ej,hg as fj,Mr as gj,fg as hj,nS as ij,vg as jj,bg as kj,aS as lj,iS as mj,rS as nj,Ig as oj,wg as pj,_g as qj,Kc as rj,Hg as sj,jg as tj,Xc as uj,Mg as vj,$a as wj,Yc as xj,Rg as yj,Zc as zj,Eg as Aj,Pg as Bj,kg as Cj,Ag as Dj,Cg as Ej,qg as Fj,Ba as Gj,mS as Hj,lS as Ij,zg as Jj,Dg as Kj,Ug as Lj,Vg as Mj,Ng as Nj,$g as Oj,Ci as Pj,Yn as Qj,hS as Rj,gS as Sj,Bg as Tj,Fg as Uj,Og as Vj,td as Wj,Lg as Xj,Wg as Yj,Gg as Zj,Jg as _j,Qg as $j,Kg as ak,nd as bk,Xg as ck,ad as dk,Yg as ek,Zg as fk,bS as gk,id as hk,rd as ik,ef as jk,od as kk,IS as lk,Zn as mk,SS as nk,xS as ok,qi as pk,nf as qk,af as rk,rf as sk,cd as tk,of as uk,sf as vk,cf as wk,df as xk,mf as yk,lf as zk,uf as Ak,pf as Bk,hf as Ck,gf as Dk,ff as Ek,Pr as Fk,ld as Gk,vf as Hk,ud as Ik,pd as Jk,_S as Kk,hd as Lk,bf as Mk,If as Nk,gd as Ok,Sf as Pk,xf as Qk,yf as Rk,fd as Sk,Fo as Tk,wf as Uk,HS as Vk,_f as Wk,jS as Xk,Ar as Yk,Hf as Zk,jf as _k,Cr as $k,Tf as al,Mf as bl,MS as cl,Rf as dl,Ef as el,bd as fl,Ui as gl,Pf as hl,kf as il,Af as jl,Id as kl,Cf as ll,qf as ml,zf as nl,Df as ol,Uf as pl,qr as ql,$f as rl,Bf as sl,Wo as tl,Of as ul,Lf as vl,Wf as wl,Gf as xl,AS as yl,CS as zl,qS as Al,zS as Bl};
|