openpond 0.2.67 → 0.2.68

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.
Files changed (564) hide show
  1. package/dist/app-server.d.ts +668 -1
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/{account-context-TIJOM22A.js → account-context-MWB6HN6I.js} +1 -1
  4. package/dist/chunks/{acp-NASAJV5E.js → acp-2OIXATRY.js} +1 -1
  5. package/dist/chunks/{acp-agent-C3CRF6DT.js → acp-agent-PAGX2B47.js} +1 -1
  6. package/dist/chunks/actions-command-2VE6YI4W.js +2 -0
  7. package/dist/chunks/{app-layer-XIEZ6ALX.js → app-layer-YNEUEOEP.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-IB6M35NS.js → app-server-connected-apps-TZOAUOYR.js} +1 -1
  9. package/dist/chunks/app-server-evaluations-RRLYWLPK.js +2 -0
  10. package/dist/chunks/app-server-harness-services-XXM336NU.js +2 -0
  11. package/dist/chunks/app-server-runtime-GBX65JJ7.js +2 -0
  12. package/dist/chunks/apps-RSFEJOQN.js +2 -0
  13. package/dist/chunks/chunk-2PXKSAG6.js +2 -0
  14. package/dist/chunks/{chunk-XEU4J4GJ.js → chunk-2TGHZXJE.js} +2 -2
  15. package/dist/chunks/{chunk-AXO6OHJB.js → chunk-3A2Y7UK3.js} +1 -1
  16. package/dist/chunks/chunk-3Z4VM2LF.js +4 -0
  17. package/dist/chunks/{chunk-V3T2OJBZ.js → chunk-4BUM6JEC.js} +2 -2
  18. package/dist/chunks/chunk-4G3GTEVS.js +23 -0
  19. package/dist/chunks/{chunk-43QYVOYA.js → chunk-4KNPCJR4.js} +1 -1
  20. package/dist/chunks/chunk-4KTGYHCE.js +2 -0
  21. package/dist/chunks/chunk-4PUOWSDE.js +13 -0
  22. package/dist/chunks/chunk-55YD4UTW.js +2 -0
  23. package/dist/chunks/chunk-5G7BQAUA.js +2 -0
  24. package/dist/chunks/chunk-65FJWWXG.js +2 -0
  25. package/dist/chunks/{chunk-4EZI4KCT.js → chunk-65WRWLUD.js} +1 -1
  26. package/dist/chunks/chunk-6D3FI2XT.js +2 -0
  27. package/dist/chunks/chunk-73TW6BKK.js +6 -0
  28. package/dist/chunks/{chunk-5TPYBXWM.js → chunk-7NCM6GBN.js} +1 -1
  29. package/dist/chunks/chunk-7OFD6TFD.js +2 -0
  30. package/dist/chunks/chunk-7OKZCJHS.js +3 -0
  31. package/dist/chunks/{chunk-ADOCQA4D.js → chunk-7PKDJHT6.js} +1 -1
  32. package/dist/chunks/chunk-7RJOCGQ6.js +2 -0
  33. package/dist/chunks/{chunk-YR5URT73.js → chunk-7RSQOC5M.js} +3 -3
  34. package/dist/chunks/{chunk-FVK4W27G.js → chunk-AFH462DO.js} +1 -1
  35. package/dist/chunks/{chunk-GUG2SWRZ.js → chunk-AFKFN25T.js} +1 -1
  36. package/dist/chunks/chunk-AFYYIJ6K.js +2 -0
  37. package/dist/chunks/{chunk-U3MVH2YT.js → chunk-APKXXAUF.js} +1 -1
  38. package/dist/chunks/chunk-AQUZCWM3.js +2 -0
  39. package/dist/chunks/chunk-AUO5DCEU.js +2 -0
  40. package/dist/chunks/chunk-AYOMVI7J.js +2 -0
  41. package/dist/chunks/{chunk-RWRKUO5D.js → chunk-B66QCXH2.js} +1 -1
  42. package/dist/chunks/{chunk-SODAOLAP.js → chunk-BHKXPWFB.js} +1 -1
  43. package/dist/chunks/chunk-BU6MW65V.js +10 -0
  44. package/dist/chunks/{chunk-P6NQYXN6.js → chunk-CCZ276IA.js} +1 -1
  45. package/dist/chunks/{chunk-YONDU5TN.js → chunk-CIZI6Z7D.js} +1 -1
  46. package/dist/chunks/{chunk-ATFV2NA4.js → chunk-CO23RRN7.js} +1 -1
  47. package/dist/chunks/{chunk-QAFXQHHG.js → chunk-D6L6UNUQ.js} +2 -2
  48. package/dist/chunks/chunk-DDOIPTOM.js +2 -0
  49. package/dist/chunks/{chunk-CSU7RDA5.js → chunk-DKOVZ6R2.js} +3 -3
  50. package/dist/chunks/chunk-DRLP7GIU.js +2 -0
  51. package/dist/chunks/{chunk-DAEUVT2I.js → chunk-DRTHKWHK.js} +1 -1
  52. package/dist/chunks/{chunk-XDFXKRTI.js → chunk-DWF3FCY4.js} +1 -1
  53. package/dist/chunks/{chunk-W3ZILZUL.js → chunk-DWM5G7BU.js} +1 -1
  54. package/dist/chunks/chunk-DXJC3QW7.js +2 -0
  55. package/dist/chunks/{chunk-IDILAYCW.js → chunk-E2JB5OCO.js} +1 -1
  56. package/dist/chunks/{chunk-GI7LTJV3.js → chunk-EDYCSW22.js} +1 -1
  57. package/dist/chunks/{chunk-4JYTFEND.js → chunk-EFP75UEX.js} +1 -1
  58. package/dist/chunks/{chunk-CX7HKSQ4.js → chunk-EGP6DF34.js} +2 -2
  59. package/dist/chunks/{chunk-D5OFN47Z.js → chunk-ESYPMD7Q.js} +1 -1
  60. package/dist/chunks/{chunk-PWKJ5KLZ.js → chunk-EXYSD45J.js} +1 -1
  61. package/dist/chunks/{chunk-R6VI7MX5.js → chunk-EYTTZ5H4.js} +1 -1
  62. package/dist/chunks/chunk-FKUWCJ73.js +161 -0
  63. package/dist/chunks/{chunk-WD6ANOLL.js → chunk-FNGZ4UDZ.js} +1 -1
  64. package/dist/chunks/{chunk-JFZ6USNQ.js → chunk-G7X73SBG.js} +1 -1
  65. package/dist/chunks/{chunk-36FNNR5N.js → chunk-GEYZVOGD.js} +1 -1
  66. package/dist/chunks/{chunk-ULJZ7NUF.js → chunk-GY7YSD6J.js} +1 -1
  67. package/dist/chunks/{chunk-CWAQOFLP.js → chunk-GYYJ47GX.js} +1 -1
  68. package/dist/chunks/chunk-HG2YFMVU.js +4 -0
  69. package/dist/chunks/{chunk-YQBL5P6R.js → chunk-HKVFU3B3.js} +1 -1
  70. package/dist/chunks/{chunk-VEXJV5H5.js → chunk-IIT66347.js} +4 -4
  71. package/dist/chunks/{chunk-B2K5WQZE.js → chunk-IO5DZUKL.js} +1 -1
  72. package/dist/chunks/chunk-J256AEEE.js +2 -0
  73. package/dist/chunks/{chunk-CRDKBFRN.js → chunk-JEMECEQH.js} +1 -1
  74. package/dist/chunks/{chunk-7P5SH3CI.js → chunk-JPUSTFZC.js} +1 -1
  75. package/dist/chunks/{chunk-YMCF5GR2.js → chunk-JQOVC35K.js} +1 -1
  76. package/dist/chunks/{chunk-6LFTQBXP.js → chunk-JT5YQ52I.js} +1 -1
  77. package/dist/chunks/chunk-JVMSN7LH.js +2 -0
  78. package/dist/chunks/{chunk-HORMGT2Q.js → chunk-JXYJQT5Q.js} +1 -1
  79. package/dist/chunks/{chunk-WDKZMXIU.js → chunk-K7KBFM2T.js} +1 -1
  80. package/dist/chunks/{chunk-UBTP3QWI.js → chunk-KCLMA2IH.js} +1 -1
  81. package/dist/chunks/chunk-KDER7R45.js +2 -0
  82. package/dist/chunks/{chunk-IXZ5ZGIL.js → chunk-KOC3YJEU.js} +2 -2
  83. package/dist/chunks/{chunk-R6MMWEH4.js → chunk-KP2MYTP5.js} +1 -1
  84. package/dist/chunks/{chunk-TV2LE2BD.js → chunk-KU4TPDPH.js} +2 -2
  85. package/dist/chunks/{chunk-WJSJXK2N.js → chunk-KUE46HTH.js} +1 -1
  86. package/dist/chunks/chunk-LVXL7T5O.js +2 -0
  87. package/dist/chunks/{chunk-TSQ2I6XV.js → chunk-M4A7G4S5.js} +2 -2
  88. package/dist/chunks/{chunk-MX7KV5DA.js → chunk-M4ZHFDRJ.js} +1 -1
  89. package/dist/chunks/{chunk-26ID6A5C.js → chunk-MEJLWNRS.js} +1 -1
  90. package/dist/chunks/{chunk-XT5WUQGT.js → chunk-MIFVX5PK.js} +1 -1
  91. package/dist/chunks/{chunk-4VZJQRQI.js → chunk-MOXIGLN2.js} +1 -1
  92. package/dist/chunks/{chunk-UKSSFB4Q.js → chunk-N5EAVX4G.js} +1 -1
  93. package/dist/chunks/{chunk-4B7EGNYX.js → chunk-NMMHXYDJ.js} +1 -1
  94. package/dist/chunks/{chunk-EBOTNBUS.js → chunk-NRYC4NH6.js} +1 -1
  95. package/dist/chunks/chunk-NSSZ2ZIU.js +2 -0
  96. package/dist/chunks/{chunk-4TTXNVCE.js → chunk-OFJPOTES.js} +1 -1
  97. package/dist/chunks/chunk-OIH2LPIT.js +2 -0
  98. package/dist/chunks/chunk-OUJ63LMU.js +2 -0
  99. package/dist/chunks/{chunk-SD2XDZQW.js → chunk-P4QM63L3.js} +1 -1
  100. package/dist/chunks/chunk-PACLKDTN.js +2 -0
  101. package/dist/chunks/{chunk-VPAEFG7X.js → chunk-PAYFJHPO.js} +1 -1
  102. package/dist/chunks/{chunk-OPTJYDZN.js → chunk-PHZZBXDO.js} +1 -1
  103. package/dist/chunks/{chunk-HPTEJBP4.js → chunk-PKJHN666.js} +1 -1
  104. package/dist/chunks/{chunk-HNDAGZCF.js → chunk-PLROXHG2.js} +1 -1
  105. package/dist/chunks/{chunk-UNE52L3Y.js → chunk-PNPV2LDE.js} +1 -1
  106. package/dist/chunks/{chunk-2RSGVLZT.js → chunk-PSY6IRJE.js} +8 -8
  107. package/dist/chunks/{chunk-SVNEPXU3.js → chunk-Q73RKX7I.js} +1 -1
  108. package/dist/chunks/{chunk-IF5A3XWP.js → chunk-Q7FBVLLB.js} +1 -1
  109. package/dist/chunks/{chunk-V5AOM5MZ.js → chunk-Q7P34B2O.js} +1 -1
  110. package/dist/chunks/{chunk-375PADDM.js → chunk-QLGP2OAQ.js} +1 -1
  111. package/dist/chunks/{chunk-QQLS5FB7.js → chunk-QUNQM2E3.js} +1 -1
  112. package/dist/chunks/chunk-R2FYCJL6.js +2 -0
  113. package/dist/chunks/{chunk-6HQUIKC5.js → chunk-R4EEGWXB.js} +1 -1
  114. package/dist/chunks/chunk-RBTDSI4L.js +11 -0
  115. package/dist/chunks/chunk-RCQYEHHD.js +2 -0
  116. package/dist/chunks/{chunk-TGULVWPV.js → chunk-RFQD6B44.js} +1 -1
  117. package/dist/chunks/{chunk-3WJQ4IGK.js → chunk-RPM4FDRX.js} +1 -1
  118. package/dist/chunks/{chunk-MCBRB5D6.js → chunk-RY46UPBO.js} +4 -4
  119. package/dist/chunks/{chunk-K3LS5SK7.js → chunk-SDHG6CKU.js} +1 -1
  120. package/dist/chunks/{chunk-XKZ4PFMQ.js → chunk-SO4GMSNP.js} +1 -1
  121. package/dist/chunks/{chunk-O6ZYDHEJ.js → chunk-SSHE6B7Z.js} +1 -1
  122. package/dist/chunks/{chunk-SH7POUVX.js → chunk-SV7ZBEK2.js} +6 -6
  123. package/dist/chunks/{chunk-BJXPQIVD.js → chunk-U7D6Q744.js} +1 -1
  124. package/dist/chunks/chunk-U7X5ZLAL.js +2 -0
  125. package/dist/chunks/{chunk-N54CPLVD.js → chunk-UANH7U3Y.js} +1 -1
  126. package/dist/chunks/{chunk-BUZ7CBJC.js → chunk-UGFSAG4U.js} +1 -1
  127. package/dist/chunks/chunk-ULTV6INR.js +2 -0
  128. package/dist/chunks/{chunk-V3ILZQER.js → chunk-UMAVVMXL.js} +7 -7
  129. package/dist/chunks/chunk-V24VHT76.js +2 -0
  130. package/dist/chunks/chunk-VEBW7NKD.js +2 -0
  131. package/dist/chunks/chunk-VJR2GNRY.js +2 -0
  132. package/dist/chunks/{chunk-JD76ANPN.js → chunk-VJYOKU3C.js} +1 -1
  133. package/dist/chunks/{chunk-H2XG5N7D.js → chunk-VWWKWYSQ.js} +1 -1
  134. package/dist/chunks/chunk-WCNPGKST.js +2 -0
  135. package/dist/chunks/chunk-WD4KAKEX.js +2 -0
  136. package/dist/chunks/chunk-WGQ3FMRF.js +2 -0
  137. package/dist/chunks/{chunk-6C3CXME7.js → chunk-WNXUSELC.js} +1 -1
  138. package/dist/chunks/{chunk-RS526BG7.js → chunk-WZ35ICTE.js} +3 -3
  139. package/dist/chunks/chunk-XHACK2KR.js +2 -0
  140. package/dist/chunks/chunk-XOPHFUUY.js +2 -0
  141. package/dist/chunks/{chunk-YKTJPCYZ.js → chunk-XQAUHXL4.js} +4 -4
  142. package/dist/chunks/{chunk-ZVMQLIRA.js → chunk-XT4CSKHM.js} +1 -1
  143. package/dist/chunks/{chunk-KQD36SBJ.js → chunk-XY7HFXLH.js} +1 -1
  144. package/dist/chunks/{chunk-UXO33ST5.js → chunk-XYZV3FKD.js} +1 -1
  145. package/dist/chunks/{chunk-GC6RJBRZ.js → chunk-Y2WNZWT2.js} +1 -1
  146. package/dist/chunks/chunk-Y4I6CFZJ.js +2 -0
  147. package/dist/chunks/chunk-YDZBX4XQ.js +2 -0
  148. package/dist/chunks/chunk-YI6ME6PU.js +22 -0
  149. package/dist/chunks/{chunk-H42UW6IF.js → chunk-YXMYK5P7.js} +1 -1
  150. package/dist/chunks/{chunk-QFL2VQKX.js → chunk-Z33RVGP6.js} +1 -1
  151. package/dist/chunks/{chunk-OY4B7Y3T.js → chunk-ZDEIVUUI.js} +1 -1
  152. package/dist/chunks/{chunk-XGJG2ZKE.js → chunk-ZIQJDTQB.js} +1 -1
  153. package/dist/chunks/{chunk-IR2Y2VQY.js → chunk-ZYLLPRPU.js} +1 -1
  154. package/dist/chunks/cli-R7TAP6Z2.js +2 -0
  155. package/dist/chunks/{command-NWOZXU57.js → command-LNOVZQSK.js} +3 -3
  156. package/dist/chunks/{configuration-command-ZEIBQKB3.js → configuration-command-CNITTZRP.js} +1 -1
  157. package/dist/chunks/connected-app-executor-FGWCLOJO.js +2 -0
  158. package/dist/chunks/connected-evidence-5VZBYNWN.js +2 -0
  159. package/dist/chunks/{connected-starting-assets-66Y46ZPM.js → connected-starting-assets-KWOFEIE4.js} +1 -1
  160. package/dist/chunks/{connection-GDWPMHPC.js → connection-VMBXW5PD.js} +1 -1
  161. package/dist/chunks/{continual-TNPTWTKK.js → continual-FVOLGGOE.js} +1 -1
  162. package/dist/chunks/core-commands-BPYXVT7O.js +2 -0
  163. package/dist/chunks/dataset-preparation-authoring-UUYFWWCT.js +4 -0
  164. package/dist/chunks/datasets-E5TXSVIY.js +2 -0
  165. package/dist/chunks/desktop-test-FX7DTY4N.js +3 -0
  166. package/dist/chunks/dist-2MKJC6HN.js +2 -0
  167. package/dist/chunks/{dist-GR56E3QK.js → dist-DKE7RJZN.js} +1 -1
  168. package/dist/chunks/evaluation-coordination-KUTZEEPB.js +2 -0
  169. package/dist/chunks/experiment-improvements-PQNR5YHN.js +2 -0
  170. package/dist/chunks/experiments-Z4BJWT3Y.js +2 -0
  171. package/dist/chunks/experiments-signal-3GCLKUWZ.js +2 -0
  172. package/dist/chunks/{extension-UH34ZF7N.js → extension-3EKIT6BB.js} +1 -1
  173. package/dist/chunks/{help-O53DTZGN.js → help-K6YLZ3KL.js} +1 -1
  174. package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +2 -0
  175. package/dist/chunks/host-profile-external-dataset-KSEPXY2S.js +2 -0
  176. package/dist/chunks/hosted-app-server-composition-LA3BZ4SE.js +2 -0
  177. package/dist/chunks/hosted-experiment-improvement-VG2WE7XZ.js +3 -0
  178. package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +2 -0
  179. package/dist/chunks/hosted-profile-candidate-PTGQLPZO.js +3 -0
  180. package/dist/chunks/hosted-profile-compiler-FS5R6CHJ.js +2 -0
  181. package/dist/chunks/hosted-profile-evaluation-control-UUEZEMXU.js +2 -0
  182. package/dist/chunks/hosted-profile-evaluation-inspection-4F7OEF4T.js +3 -0
  183. package/dist/chunks/hosted-profile-evaluation-preparation-LIJJZDHQ.js +3 -0
  184. package/dist/chunks/hosted-tasksets-NXVF4AQA.js +2 -0
  185. package/dist/chunks/human-review-2ZOB7CJZ.js +2 -0
  186. package/dist/chunks/{import-OBAKUJPM.js → import-YHYKZ6JN.js} +2 -2
  187. package/dist/chunks/{learning-CRR6NRPN.js → learning-LAXMGWSQ.js} +1 -1
  188. package/dist/chunks/learning-Y3UKNUGE.js +2 -0
  189. package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +2 -0
  190. package/dist/chunks/local-harness-taskset-review-XQHQ6JCR.js +2 -0
  191. package/dist/chunks/{model-projects-HP4DELCP.js → model-projects-6YWVD2TS.js} +1 -1
  192. package/dist/chunks/opchat-XXI2ZM53.js +3 -0
  193. package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +2 -0
  194. package/dist/chunks/organizations-W7HI2JA4.js +2 -0
  195. package/dist/chunks/{profile-3WZJ65CT.js → profile-P2SJPBOJ.js} +1 -1
  196. package/dist/chunks/project-action-payload-LTIQBX77.js +2 -0
  197. package/dist/chunks/project-agent-XRIXMXQK.js +2 -0
  198. package/dist/chunks/published-experiment-source-SDXUVPE7.js +2 -0
  199. package/dist/chunks/refiner-profile-service-56VYLZQJ.js +2 -0
  200. package/dist/chunks/{runtime-XP4DEGR3.js → runtime-Q7JUJO4D.js} +2 -2
  201. package/dist/chunks/sandbox-command-HVA5FJU4.js +2 -0
  202. package/dist/chunks/{sandbox-template-YFMHEMUQ.js → sandbox-template-U536EEWY.js} +1 -1
  203. package/dist/chunks/saved-work-KSIQPXC2.js +2 -0
  204. package/dist/chunks/{send-turn-D3GTSSHI.js → send-turn-YLY3YNEQ.js} +1 -1
  205. package/dist/chunks/setup-RMZ2BHLM.js +2 -0
  206. package/dist/chunks/{src-GQPWOPYA.js → src-C3ZUESMK.js} +1 -1
  207. package/dist/chunks/src-SGQYVBNQ.js +424 -0
  208. package/dist/chunks/standalone-experiment-turn-owner-TW5MTWIO.js +2 -0
  209. package/dist/chunks/store-chat-resources-IRHBW2EC.js +2 -0
  210. package/dist/chunks/{store-continual-support-reviews-VVRQO2JK.js → store-continual-support-reviews-3KK42L4I.js} +1 -1
  211. package/dist/chunks/store-conversation-serving-IVURK52V.js +2 -0
  212. package/dist/chunks/{store-create-improve-2XI36AET.js → store-create-improve-UTCLBXF2.js} +1 -1
  213. package/dist/chunks/{store-datasets-UFY422NG.js → store-datasets-4AQOVAQY.js} +1 -1
  214. package/dist/chunks/store-evaluation-results-PK2P3IMH.js +7 -0
  215. package/dist/chunks/{store-harness-workspaces-SGUEYDO2.js → store-harness-workspaces-YEXB4IRV.js} +1 -1
  216. package/dist/chunks/store-human-review-O4BVHP25.js +7 -0
  217. package/dist/chunks/store-learned-preference-migration-validation-44SVX6YB.js +2 -0
  218. package/dist/chunks/{store-learning-BFOT4QVT.js → store-learning-SIUQIY5C.js} +1 -1
  219. package/dist/chunks/{store-learning-credentials-DYTMWQTC.js → store-learning-credentials-BUHR7SN6.js} +1 -1
  220. package/dist/chunks/store-local-experiments-BHVTKPPE.js +97 -0
  221. package/dist/chunks/store-model-batch-review-RVAYUVK2.js +2 -0
  222. package/dist/chunks/{store-model-configuration-NJFWSYSA.js → store-model-configuration-6L3OYXF4.js} +1 -1
  223. package/dist/chunks/store-model-project-preparation-AAEKCF6V.js +2 -0
  224. package/dist/chunks/store-modification-recordings-LCPK6K2T.js +9 -0
  225. package/dist/chunks/{store-preference-comparison-MZAYONCK.js → store-preference-comparison-5YVIQNVB.js} +1 -1
  226. package/dist/chunks/{store-sidebar-file-bookmarks-J3JEVAYR.js → store-sidebar-file-bookmarks-WLMYDA4E.js} +1 -1
  227. package/dist/chunks/{store-sidebar-preferences-2JHTFXJK.js → store-sidebar-preferences-AFMYIDWT.js} +1 -1
  228. package/dist/chunks/{store-subagents-PUBQVWSU.js → store-subagents-KFPVSTRO.js} +1 -1
  229. package/dist/chunks/{store-task-inbox-3BREANOX.js → store-task-inbox-L6IQTY26.js} +1 -1
  230. package/dist/chunks/{store-task-inventory-5HRZCDUT.js → store-task-inventory-QWS2C656.js} +1 -1
  231. package/dist/chunks/store-taskset-drafts-FRFL6ITK.js +9 -0
  232. package/dist/chunks/{store-training-S3FXWLT6.js → store-training-FYXZU2FE.js} +1 -1
  233. package/dist/chunks/{store-training-jobs-2LCXPA7G.js → store-training-jobs-3N3VKPIY.js} +1 -1
  234. package/dist/chunks/{store-training-models-7AMKS7ZW.js → store-training-models-VOFVGPZR.js} +1 -1
  235. package/dist/chunks/{taskset-PLKWRT4X.js → taskset-UDDLFYKV.js} +1 -1
  236. package/dist/chunks/taskset-catalog-RZYEBCRQ.js +2 -0
  237. package/dist/chunks/taskset-packages-T6B6HYKZ.js +2 -0
  238. package/dist/chunks/taskset-packages-WMG5DUBN.js +2 -0
  239. package/dist/chunks/{teams-bot-VQXUA7U4.js → teams-bot-MPWL2PP4.js} +1 -1
  240. package/dist/chunks/tool-learning-ZQ6NSJ5K.js +2 -0
  241. package/dist/chunks/training-5NT2YB2L.js +2 -0
  242. package/dist/chunks/training-5UMT45UL.js +2 -0
  243. package/dist/chunks/training-UY6KRG4M.js +2 -0
  244. package/dist/chunks/{training-error-LQKCOQDJ.js → training-error-WF463UNZ.js} +1 -1
  245. package/dist/chunks/{training-hardware-ESXRWUIK.js → training-hardware-UWQCRDMV.js} +1 -1
  246. package/dist/chunks/training-hosted-CKSDRVL6.js +2 -0
  247. package/dist/chunks/training-hosted-alphaedit-HSMRDJTD.js +2 -0
  248. package/dist/chunks/training-hosted-decision-7JALOU6O.js +2 -0
  249. package/dist/chunks/training-hosted-engram-SXO75MFG.js +2 -0
  250. package/dist/chunks/{training-hosted-learning-WQ2IP5FP.js → training-hosted-learning-E2N32YU5.js} +1 -1
  251. package/dist/chunks/training-hosted-modification-comparison-TXFDJFTG.js +2 -0
  252. package/dist/chunks/training-hosted-neuron-training-J42WK4EH.js +2 -0
  253. package/dist/chunks/training-hosted-serving-report-BAEABGJH.js +2 -0
  254. package/dist/chunks/training-hosted-steering-T556BUBG.js +2 -0
  255. package/dist/chunks/training-model-start-P3PXDWNT.js +2 -0
  256. package/dist/chunks/web-search-ZEKJHZW4.js +2 -0
  257. package/dist/chunks/{workspaces-MCS2AQX6.js → workspaces-EK62ANTB.js} +1 -1
  258. package/dist/cli.js +1 -1
  259. package/dist/index.js +1 -1
  260. package/dist/sandbox/types/billing.d.ts +87 -6
  261. package/dist/sandbox/types/io.d.ts +3 -0
  262. package/dist/sandbox-template/manifest.js +1 -1
  263. package/dist/skills/manifest.json +3 -3
  264. package/dist/skills/openpond-cli/references/experiments-and-training.md +461 -1
  265. package/dist/web/assets/App-CCuh99JW.js +54 -0
  266. package/dist/web/assets/{AppDialog-BvskhHE9.js → AppDialog-CxjDHVk9.js} +1 -1
  267. package/dist/web/assets/AppTerminalPanel-CKJIVpKa.js +2 -0
  268. package/dist/web/assets/{AppToastContext-D2788RqX.js → AppToastContext-EpiT1dHs.js} +1 -1
  269. package/dist/web/assets/AppsView-BsMyPX_3.js +1 -0
  270. package/dist/web/assets/{AttachmentTypeIcon-DVluUHuc.js → AttachmentTypeIcon-BXvZy5gB.js} +1 -1
  271. package/dist/web/assets/BrowserSidebar-BIIV4aq4.js +1 -0
  272. package/dist/web/assets/{CartesianChart-DdBZ69lI.js → CartesianChart-brqLBqnF.js} +1 -1
  273. package/dist/web/assets/ChatTimelineEntry-CwZbn16X.js +8 -0
  274. package/dist/web/assets/{CollaborationTabs-ba6WupeJ.js → CollaborationTabs-BU4uc4tZ.js} +1 -1
  275. package/dist/web/assets/{CommandMenu-D7wTaEgl.js → CommandMenu-DkWpXR55.js} +1 -1
  276. package/dist/web/assets/CommunityView-CsSxJZGn.js +1 -0
  277. package/dist/web/assets/{ComposerAttachments-aO90qXYz.js → ComposerAttachments-BdJGCYzI.js} +1 -1
  278. package/dist/web/assets/{ComposerCreateImproveStrip-BPUJBSyS.js → ComposerCreateImproveStrip-CWy0j1vv.js} +1 -1
  279. package/dist/web/assets/{ConversationImportsSettings-Bo836wKJ.js → ConversationImportsSettings-DCmiakbZ.js} +1 -1
  280. package/dist/web/assets/DatasetReviewImport-DEnF_pGu.js +1 -0
  281. package/dist/web/assets/ExperimentTrainingDataWorkspace-WhwQ0QBi.js +2 -0
  282. package/dist/web/assets/{FilePagePreview-C6wIp6uX.js → FilePagePreview-BRhhz99q.js} +2 -2
  283. package/dist/web/assets/{GetStartedView-CxMv8q-h.js → GetStartedView-CLVD-qEi.js} +1 -1
  284. package/dist/web/assets/{GettingStartedDialog-CEb0cS-o.js → GettingStartedDialog-CMxaAMg-.js} +1 -1
  285. package/dist/web/assets/HostedModelLearningReview-Cn-j-rDo.js +1 -0
  286. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +1 -0
  287. package/dist/web/assets/{HtmlVisual-CCuUkYT8.js → HtmlVisual-D5y2WG9L.js} +10 -10
  288. package/dist/web/assets/LabModelVersionDetailPage-BxRmYD6h.js +1 -0
  289. package/dist/web/assets/{TrainingRunLineage-PXzWR65d.css → LabModelWorkspace-DOrgCk9Z.css} +1 -1
  290. package/dist/web/assets/LabModelWorkspace-u2Ulm_z4.js +1 -0
  291. package/dist/web/assets/{LabSkillSidebar-CFROlATQ.js → LabSkillSidebar-C7IceJTJ.js} +1 -1
  292. package/dist/web/assets/LabsRoute-C9Y0GU34.css +1 -0
  293. package/dist/web/assets/LabsRoute-CbztQaEf.js +74 -0
  294. package/dist/web/assets/LearningBatchesPage-B1NZTBSv.css +1 -0
  295. package/dist/web/assets/LearningBatchesPage-CJqgZNvM.js +26 -0
  296. package/dist/web/assets/MainChatThread-DNMfrrRq.js +2 -0
  297. package/dist/web/assets/{MainPane-BOWkynGB.css → MainPane-BZlNLfTM.css} +1 -1
  298. package/dist/web/assets/MainPane-CQQxSDPS.js +13 -0
  299. package/dist/web/assets/ModelProjectPageHeader-Dge19aE1.js +1 -0
  300. package/dist/web/assets/NativeSetupTerminal-D4JnbpyD.js +2 -0
  301. package/dist/web/assets/{NativeSkillSidebar-MAJWS4mL.js → NativeSkillSidebar-Jzx1BeKV.js} +1 -1
  302. package/dist/web/assets/{NewProjectDialog-MQiUBVx3.js → NewProjectDialog-DcnGzEd9.js} +1 -1
  303. package/dist/web/assets/{OutputsPage-DpF-aRTu.js → OutputsPage-Cmk15Vt_.js} +1 -1
  304. package/dist/web/assets/{PageChrome-8gH2hyDb.js → PageChrome-Cz_fCqtn.js} +1 -1
  305. package/dist/web/assets/{ProjectsPage-BQ98oGyu.js → ProjectsPage-BZ3Eo3Mz.js} +1 -1
  306. package/dist/web/assets/RightChatPanelStack-C6H2vU9N.js +1 -0
  307. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +1 -0
  308. package/dist/web/assets/{ScheduledWorkPage-CGCqZz_H.js → ScheduledWorkPage-CAkSwM0T.js} +1 -1
  309. package/dist/web/assets/{SettingsView-CqpMFLxy.js → SettingsView-DvQXGw3_.js} +3 -3
  310. package/dist/web/assets/{TasksetDraftEditorPrimitives-DJvIvzBb.js → TasksetDraftEditorPrimitives-JuU1k8vr.js} +1 -1
  311. package/dist/web/assets/TeamChatView-DmHjr8W9.js +1 -0
  312. package/dist/web/assets/{TerminalOverlay-D--M876l.js → TerminalOverlay-DlaM9d8F.js} +1 -1
  313. package/dist/web/assets/{TrainingCreationPanel-DDUoHQHU.js → TrainingCreationPanel-ClpylNsr.js} +1 -1
  314. package/dist/web/assets/{TrainingDraftPanel-CwLXn3Z7.js → TrainingDraftPanel-6tH2xSDj.js} +1 -1
  315. package/dist/web/assets/{UsageSettingsSection-CGwPregx.js → UsageSettingsSection-CzDqxOYM.js} +2 -2
  316. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +1 -0
  317. package/dist/web/assets/WorkspaceDiffPanel-B4e0lyF7.js +11 -0
  318. package/dist/web/assets/WorkspaceEnvironmentMenu-D01ZkZZF.js +35 -0
  319. package/dist/web/assets/{WorkspaceFileLocation-D-ctFM4d.js → WorkspaceFileLocation-C5s_njZb.js} +1 -1
  320. package/dist/web/assets/{WorkspaceGitDialogs-CQ28j3R7.js → WorkspaceGitDialogs-DjPZ6KIh.js} +1 -1
  321. package/dist/web/assets/{WorkspaceMonacoEditor-BrZs6-EW.js → WorkspaceMonacoEditor-CC4sfOiU.js} +3 -3
  322. package/dist/web/assets/{WorkspacePdfPreview-CU6PSjjN.js → WorkspacePdfPreview-vszQqFa4.js} +2 -2
  323. package/dist/web/assets/{WorkspacePresentationPreview-IjXVXpIy.js → WorkspacePresentationPreview-DQTvhaRD.js} +1 -1
  324. package/dist/web/assets/api-client-DJRVOFzS.js +1 -0
  325. package/dist/web/assets/{app-models-CKXrDTEU.js → app-models-BUdzQbXo.js} +1 -1
  326. package/dist/web/assets/bot-Doyx3T4j.js +1 -0
  327. package/dist/web/assets/{browser-sidebar-links-D9v2cyJa.js → browser-sidebar-links-PVPCrsDJ.js} +1 -1
  328. package/dist/web/assets/chat-resources-Beh5lB36.js +1 -0
  329. package/dist/web/assets/chevron-down-DX1hzujj.js +1 -0
  330. package/dist/web/assets/chevron-right-DHN0y3KC.js +1 -0
  331. package/dist/web/assets/chevron-up-_QrW88NF.js +1 -0
  332. package/dist/web/assets/{chunk-TLSP5JKG-BrrVo5rJ.js → chunk-3BYFS4RO-ztZjcMmt.js} +1 -1
  333. package/dist/web/assets/chunk-AG6UJ3DI-D9KZjTYP.js +1 -0
  334. package/dist/web/assets/chunk-C3TS766N-ppRhs95p.js +1 -0
  335. package/dist/web/assets/chunk-GCUWJUUM-Dy6oUNJ6.js +9 -0
  336. package/dist/web/assets/chunk-GS5HEE4M-C0RLeIsy.js +1 -0
  337. package/dist/web/assets/{chunk-H3JZ3P5T-CzpTARDY.js → chunk-H3JZ3P5T-DolwEJXo.js} +2 -2
  338. package/dist/web/assets/chunk-Q4RGCEOI-Cr-dg4Nk.js +1 -0
  339. package/dist/web/assets/client-DwZ92xtu.js +1 -0
  340. package/dist/web/assets/{client-choice-storage-DUWsS4X0.js → client-choice-storage-DitqKiIT.js} +1 -1
  341. package/dist/web/assets/cloud-upload-HdzNTgr2.js +1 -0
  342. package/dist/web/assets/common-BWVSBnpX.js +1 -0
  343. package/dist/web/assets/copy-DTQhoBNg.js +1 -0
  344. package/dist/web/assets/create-pipeline-DsZzNkt9.js +1 -0
  345. package/dist/web/assets/{cssMode-SclUkqPt.js → cssMode-BRTtfXxU.js} +1 -1
  346. package/dist/web/assets/dataset-workspaces-BTPi71mz.js +1 -0
  347. package/dist/web/assets/external-link-H1629UU6.js +1 -0
  348. package/dist/web/assets/folder-open-CAGdWOrr.js +1 -0
  349. package/dist/web/assets/folder-plus-C14cs2mE.js +1 -0
  350. package/dist/web/assets/git-commit-horizontal-DFUfuVvF.js +1 -0
  351. package/dist/web/assets/{htmlMode-X3mQtOeh.js → htmlMode-BVaCcL76.js} +1 -1
  352. package/dist/web/assets/icons-Bk2b68aC.js +1 -0
  353. package/dist/web/assets/image-0DPVY6Ev.js +1 -0
  354. package/dist/web/assets/{index-LXNhSUEL.js → index-B6XX_0h3.js} +2 -2
  355. package/dist/web/assets/info-C8b_tafZ.js +1 -0
  356. package/dist/web/assets/{intake-contracts-wCkD2ErR.js → intake-contracts-B8JZKYwb.js} +1 -1
  357. package/dist/web/assets/{jsonMode-BoKiIdHd.js → jsonMode-BCKKQmmV.js} +1 -1
  358. package/dist/web/assets/loader-circle-y-SSPwpk.js +1 -0
  359. package/dist/web/assets/{lspLanguageFeatures-CO2mzpy1.js → lspLanguageFeatures-DozmNUOx.js} +1 -1
  360. package/dist/web/assets/maximize-2-CByk9-zN.js +1 -0
  361. package/dist/web/assets/message-square-C889vRqm.js +1 -0
  362. package/dist/web/assets/{monaco.contribution-wacA5FjV.js → monaco.contribution-B9q6qbbo.js} +2 -2
  363. package/dist/web/assets/{monaco.contribution-CVe3mWSY.js → monaco.contribution-BITdsRbn.js} +2 -2
  364. package/dist/web/assets/{monaco.contribution-hrusiaZi.js → monaco.contribution-BqA-XZ44.js} +2 -2
  365. package/dist/web/assets/{monaco.contribution-C7CAQIKF.js → monaco.contribution-DxAV1oS5.js} +2 -2
  366. package/dist/web/assets/monitor-BtxlcLuI.js +1 -0
  367. package/dist/web/assets/paperclip-BeIdaspf.js +1 -0
  368. package/dist/web/assets/{pdf-Ct3M2mVw.js → pdf-perlzwEB.js} +1 -1
  369. package/dist/web/assets/play-CHXXdkuO.js +1 -0
  370. package/dist/web/assets/plus-DFFWjhPw.js +1 -0
  371. package/dist/web/assets/{ponder-desktop-D-zB6X4L.js → ponder-desktop-Ca-9KggQ.js} +1 -1
  372. package/dist/web/assets/presentation-0bzvu6_u.js +1 -0
  373. package/dist/web/assets/{profile-ref-CCxrOCio.js → profile-ref-D8lxL7dW.js} +1 -1
  374. package/dist/web/assets/{python-C0-pUUAU.js → python-B9hOnkOI.js} +1 -1
  375. package/dist/web/assets/refresh-cw-D61-Ozk3.js +1 -0
  376. package/dist/web/assets/{requests-DjSt-duM.js → requests-DmeUYik4.js} +1 -1
  377. package/dist/web/assets/reward-checks-DJJZYgf8.js +7 -0
  378. package/dist/web/assets/save-iEMNZoPe.js +1 -0
  379. package/dist/web/assets/schemas-Brv9Vmnk.js +64 -0
  380. package/dist/web/assets/settings-BC-bzgk6.js +21 -0
  381. package/dist/web/assets/settings-lists-C84qxFmP.js +5 -0
  382. package/dist/web/assets/square-BE_4JMR3.js +1 -0
  383. package/dist/web/assets/square-terminal-Djpzo2Qs.js +1 -0
  384. package/dist/web/assets/{submit-issue-command-Gk3RKrY-.js → submit-issue-command-HfKzyxg5.js} +1 -1
  385. package/dist/web/assets/{toggleHighContrast-BnYUBgZB.js → toggleHighContrast-ClsXu39R.js} +1 -1
  386. package/dist/web/assets/training-DWfghwfZ.js +1 -0
  387. package/dist/web/assets/{training-model-data-CxR3xpmK.js → training-model-data-CIysl8wH.js} +4 -4
  388. package/dist/web/assets/{tsMode-BVNyOY8h.js → tsMode-nbmaMc-D.js} +1 -1
  389. package/dist/web/assets/upload-C6ug8RD-.js +1 -0
  390. package/dist/web/assets/{useAccountSettings-4_XfwJQi.js → useAccountSettings-Dr9h4Qz_.js} +1 -1
  391. package/dist/web/assets/{useAgentInventory-CVuamyT3.js → useAgentInventory-ByCk2JAv.js} +1 -1
  392. package/dist/web/assets/useChatContextSelection-C0eMm2g6.js +1 -0
  393. package/dist/web/assets/{useLocalAgentSchedules-CmwN4ohy.js → useLocalAgentSchedules-Do0y_leJ.js} +1 -1
  394. package/dist/web/assets/useQuery-D2MQ7e5U.js +1 -0
  395. package/dist/web/assets/wifi-off-Dr-CapyW.js +1 -0
  396. package/dist/web/assets/work-outputs-D_8TovAK.js +1 -0
  397. package/dist/web/assets/{workers-CjtQ2aBD.js → workers-DKvM2NdM.js} +1 -1
  398. package/dist/web/assets/x-Jx2jlP9u.js +1 -0
  399. package/dist/web/assets/{yaml-N1KUjBZ8.js → yaml-C02vq4ar.js} +1 -1
  400. package/dist/web/index.html +1 -1
  401. package/docs/command-reference.md +93 -3
  402. package/package.json +1 -1
  403. package/dist/chunks/actions-command-BYPLSGZL.js +0 -2
  404. package/dist/chunks/app-server-evaluations-5YZUFXQ2.js +0 -2
  405. package/dist/chunks/app-server-harness-services-N5F5QVZI.js +0 -2
  406. package/dist/chunks/app-server-runtime-HJ2N57DL.js +0 -2
  407. package/dist/chunks/apps-WJTW64NW.js +0 -2
  408. package/dist/chunks/chunk-263WS3TB.js +0 -2
  409. package/dist/chunks/chunk-2UZHLO2V.js +0 -23
  410. package/dist/chunks/chunk-2W22IXHB.js +0 -2
  411. package/dist/chunks/chunk-46RMTR2Z.js +0 -2
  412. package/dist/chunks/chunk-4JJ4RYIB.js +0 -6
  413. package/dist/chunks/chunk-4NN5OLKW.js +0 -161
  414. package/dist/chunks/chunk-543QHE3D.js +0 -2
  415. package/dist/chunks/chunk-5QOFUGYQ.js +0 -2
  416. package/dist/chunks/chunk-5ZNE43XC.js +0 -10
  417. package/dist/chunks/chunk-6IS5OLI5.js +0 -2
  418. package/dist/chunks/chunk-7HAGSE7L.js +0 -2
  419. package/dist/chunks/chunk-AXYAEWWA.js +0 -2
  420. package/dist/chunks/chunk-B7XJBP4U.js +0 -2
  421. package/dist/chunks/chunk-BBIA24GD.js +0 -10
  422. package/dist/chunks/chunk-CJDGLPNX.js +0 -4
  423. package/dist/chunks/chunk-FCXDPVGJ.js +0 -3
  424. package/dist/chunks/chunk-FE2ENE3U.js +0 -2
  425. package/dist/chunks/chunk-H6EUFJJK.js +0 -2
  426. package/dist/chunks/chunk-IOSBGCRT.js +0 -2
  427. package/dist/chunks/chunk-K6DB5QWG.js +0 -2
  428. package/dist/chunks/chunk-LI56PPCN.js +0 -2
  429. package/dist/chunks/chunk-OE2OOWEQ.js +0 -2
  430. package/dist/chunks/chunk-OYIFH2OM.js +0 -2
  431. package/dist/chunks/chunk-QOUOU7FE.js +0 -22
  432. package/dist/chunks/chunk-R5GRESW3.js +0 -2
  433. package/dist/chunks/chunk-TERKCK4I.js +0 -2
  434. package/dist/chunks/chunk-TS5HNRZB.js +0 -2
  435. package/dist/chunks/chunk-V3KEG6MI.js +0 -2
  436. package/dist/chunks/chunk-WGISITX6.js +0 -4
  437. package/dist/chunks/chunk-XD4ZIQZ2.js +0 -2
  438. package/dist/chunks/chunk-XHU4BZQY.js +0 -13
  439. package/dist/chunks/chunk-ZWEY66RT.js +0 -2
  440. package/dist/chunks/cli-HV32F7HD.js +0 -2
  441. package/dist/chunks/connected-app-executor-DFHWNMRM.js +0 -2
  442. package/dist/chunks/connected-evidence-WOM6N5HO.js +0 -2
  443. package/dist/chunks/core-commands-GWRHH53F.js +0 -2
  444. package/dist/chunks/dataset-preparation-authoring-WJ2XEUO7.js +0 -4
  445. package/dist/chunks/datasets-XIMF54QN.js +0 -2
  446. package/dist/chunks/desktop-test-HF42V2EP.js +0 -3
  447. package/dist/chunks/dist-T6ES2TSM.js +0 -2
  448. package/dist/chunks/evaluation-coordination-WZT6FDMS.js +0 -2
  449. package/dist/chunks/experiment-improvements-H35VS6XZ.js +0 -2
  450. package/dist/chunks/experiments-F54C32EE.js +0 -2
  451. package/dist/chunks/experiments-signal-ONIGTGYR.js +0 -2
  452. package/dist/chunks/host-profile-evaluation-tools-LMCJ3MDJ.js +0 -2
  453. package/dist/chunks/host-profile-external-dataset-4HOXANWK.js +0 -2
  454. package/dist/chunks/hosted-app-server-composition-Y64A2A2B.js +0 -2
  455. package/dist/chunks/hosted-experiment-improvement-B2V2WIUI.js +0 -3
  456. package/dist/chunks/hosted-harness-runtime-C7I4KSDK.js +0 -2
  457. package/dist/chunks/hosted-profile-candidate-CXPVEEYQ.js +0 -3
  458. package/dist/chunks/hosted-profile-compiler-FGCI2VRW.js +0 -2
  459. package/dist/chunks/hosted-profile-evaluation-control-INNUYMBD.js +0 -2
  460. package/dist/chunks/hosted-profile-evaluation-inspection-UPTBRYMS.js +0 -3
  461. package/dist/chunks/hosted-profile-evaluation-preparation-TIQSVKLQ.js +0 -3
  462. package/dist/chunks/hosted-tasksets-7VMYOTIO.js +0 -2
  463. package/dist/chunks/human-review-7XC77NQP.js +0 -2
  464. package/dist/chunks/learning-3XDGIYUL.js +0 -2
  465. package/dist/chunks/local-harness-improvement-runtime-UIKQSAMM.js +0 -2
  466. package/dist/chunks/local-harness-taskset-review-6KJN3EQL.js +0 -2
  467. package/dist/chunks/opchat-NWYWWIA7.js +0 -3
  468. package/dist/chunks/opchat-bounded-chat-ICURZM6R.js +0 -2
  469. package/dist/chunks/organizations-7DBQGCCV.js +0 -2
  470. package/dist/chunks/project-action-payload-7DRABTHY.js +0 -2
  471. package/dist/chunks/project-agent-AXJOWXRU.js +0 -2
  472. package/dist/chunks/published-experiment-source-YBBPLNF2.js +0 -2
  473. package/dist/chunks/refiner-profile-service-ATEFPF5O.js +0 -2
  474. package/dist/chunks/sandbox-command-CF2PJCFX.js +0 -2
  475. package/dist/chunks/saved-work-3OAVRBH3.js +0 -2
  476. package/dist/chunks/setup-RHIMFI2Y.js +0 -2
  477. package/dist/chunks/src-V236S6MV.js +0 -424
  478. package/dist/chunks/standalone-experiment-turn-owner-CDRMGLWW.js +0 -2
  479. package/dist/chunks/store-chat-resources-P4EKCLSY.js +0 -2
  480. package/dist/chunks/store-conversation-serving-YFEZYQD3.js +0 -2
  481. package/dist/chunks/store-evaluation-results-VBH4R2U7.js +0 -7
  482. package/dist/chunks/store-human-review-RFCVZ3HP.js +0 -7
  483. package/dist/chunks/store-learned-preference-migration-validation-FNBGGZU6.js +0 -2
  484. package/dist/chunks/store-local-experiments-XPXGYXNM.js +0 -97
  485. package/dist/chunks/store-model-batch-review-J2L5JQV2.js +0 -2
  486. package/dist/chunks/store-model-project-preparation-OCLIFKI2.js +0 -2
  487. package/dist/chunks/store-taskset-drafts-BNKUVHPA.js +0 -9
  488. package/dist/chunks/taskset-packages-SXBLYHSP.js +0 -2
  489. package/dist/chunks/taskset-packages-V5T4V7YN.js +0 -2
  490. package/dist/chunks/tool-learning-47XQKELE.js +0 -2
  491. package/dist/chunks/training-7VQNCOGH.js +0 -2
  492. package/dist/chunks/training-VKLPNCMC.js +0 -2
  493. package/dist/chunks/training-hosted-NNE6BP6S.js +0 -2
  494. package/dist/chunks/training-hosted-serving-report-VZ4SMLMG.js +0 -2
  495. package/dist/chunks/training-model-start-G7YDZ7ZG.js +0 -2
  496. package/dist/chunks/web-search-56QRZGPR.js +0 -2
  497. package/dist/web/assets/App-DmEA-Lia.js +0 -53
  498. package/dist/web/assets/AppTerminalPanel-ScQKJV4z.js +0 -2
  499. package/dist/web/assets/AppsView-B1uNg9IQ.js +0 -1
  500. package/dist/web/assets/BrowserSidebar-DfVQoJHn.js +0 -1
  501. package/dist/web/assets/ChatTimelineEntry-Bbc6HRks.js +0 -8
  502. package/dist/web/assets/CommunityView-mO58f2B0.js +0 -1
  503. package/dist/web/assets/HostedModelLearningReview-BQIS7hkd.js +0 -1
  504. package/dist/web/assets/HostedModelLearningSettings-BQ-YeFMT.js +0 -1
  505. package/dist/web/assets/LabModelVersionDetailPage-BkHeVbAx.js +0 -1
  506. package/dist/web/assets/LabsRoute-CE45yAXJ.css +0 -1
  507. package/dist/web/assets/LabsRoute-YA9YckKj.js +0 -101
  508. package/dist/web/assets/MainChatThread-DpyPgGKW.js +0 -2
  509. package/dist/web/assets/MainPane-WOeodByM.js +0 -10
  510. package/dist/web/assets/NativeSetupTerminal-fmG2c65K.js +0 -2
  511. package/dist/web/assets/RightChatPanelStack-Bs7A4dLs.js +0 -1
  512. package/dist/web/assets/RightSidebarHomePanel-C-D4kba2.js +0 -1
  513. package/dist/web/assets/TeamChatView-DjmIaLO1.js +0 -1
  514. package/dist/web/assets/TrainingRunLineage-CtYe1KGX.js +0 -1
  515. package/dist/web/assets/WorkSidebarPanel-C6wWuo7U.js +0 -1
  516. package/dist/web/assets/WorkspaceDiffPanel-JDOUmrC-.js +0 -11
  517. package/dist/web/assets/WorkspaceEnvironmentMenu-sfL5LZeB.js +0 -35
  518. package/dist/web/assets/api-client-Dgz-fOMl.js +0 -1
  519. package/dist/web/assets/bot-Cd761lRF.js +0 -1
  520. package/dist/web/assets/chat-resources-BUDXdoG0.js +0 -1
  521. package/dist/web/assets/chevron-down-DEbd6Ek-.js +0 -1
  522. package/dist/web/assets/chevron-right-DLYNg_Oq.js +0 -1
  523. package/dist/web/assets/chevron-up-DFJJccDl.js +0 -1
  524. package/dist/web/assets/chunk-GHPCQXG5-DKDBSd8H.js +0 -9
  525. package/dist/web/assets/chunk-GJRXJL6G-luaxRTYI.js +0 -1
  526. package/dist/web/assets/chunk-JDQVAG3R-C0-rh1aR.js +0 -1
  527. package/dist/web/assets/chunk-XMVSQIK4-BBU7r_NH.js +0 -1
  528. package/dist/web/assets/client-BNjO4Xi8.js +0 -1
  529. package/dist/web/assets/cloud-upload-CoM1FGeB.js +0 -1
  530. package/dist/web/assets/common-CFsO2ppZ.js +0 -1
  531. package/dist/web/assets/copy-BGOhV6Pk.js +0 -1
  532. package/dist/web/assets/create-pipeline-DRR0Qeec.js +0 -1
  533. package/dist/web/assets/createLucideIcon-Bv-_eGcE.js +0 -1
  534. package/dist/web/assets/external-link-CVXsNeO3.js +0 -1
  535. package/dist/web/assets/folder-open-MnOmh19D.js +0 -1
  536. package/dist/web/assets/folder-plus-BRddLBtO.js +0 -1
  537. package/dist/web/assets/git-commit-horizontal-Bm4rkXug.js +0 -1
  538. package/dist/web/assets/icons-CZxmQtZs.js +0 -1
  539. package/dist/web/assets/image-BViGUAiq.js +0 -1
  540. package/dist/web/assets/info-DYPIbKKD.js +0 -1
  541. package/dist/web/assets/loader-circle-JFgFNsP5.js +0 -1
  542. package/dist/web/assets/maximize-2-DXZCQO0b.js +0 -1
  543. package/dist/web/assets/message-square-cOCAL8J1.js +0 -1
  544. package/dist/web/assets/models-route-CWcJuOd0.js +0 -1
  545. package/dist/web/assets/monitor-B35XSAvn.js +0 -1
  546. package/dist/web/assets/paperclip-CKgDxioG.js +0 -1
  547. package/dist/web/assets/play-DzqLr7fM.js +0 -1
  548. package/dist/web/assets/plus-Ddp1vXnw.js +0 -1
  549. package/dist/web/assets/presentation-B0S9v7ib.js +0 -1
  550. package/dist/web/assets/refresh-cw-D45mW-vs.js +0 -1
  551. package/dist/web/assets/reward-checks-D139zwha.js +0 -7
  552. package/dist/web/assets/save-Gu4R_82E.js +0 -1
  553. package/dist/web/assets/schemas-C9IwV7NS.js +0 -64
  554. package/dist/web/assets/settings-DdonLCIN.js +0 -21
  555. package/dist/web/assets/settings-lists-CFHFtO0D.js +0 -5
  556. package/dist/web/assets/square-Dqduqyyu.js +0 -1
  557. package/dist/web/assets/square-terminal-DS3zwi6X.js +0 -1
  558. package/dist/web/assets/training-QBuGBGJd.js +0 -2
  559. package/dist/web/assets/upload-ABSJxuUM.js +0 -1
  560. package/dist/web/assets/useQuery-CCjwL8VI.js +0 -1
  561. package/dist/web/assets/wifi-off-DGJH7Pke.js +0 -1
  562. package/dist/web/assets/work-outputs-CnbRtTLg.js +0 -1
  563. package/dist/web/assets/x-B-_zJVOZ.js +0 -1
  564. /package/dist/chunks/{chunk-SFR32TMJ.js → chunk-JXLDEYRW.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as a}from"./chunk-Q7P34B2O.js";import"./chunk-EICS777E.js";import"./chunk-65WRWLUD.js";import"./chunk-UOFDKMRU.js";import"./chunk-EYTTZ5H4.js";import"./chunk-XY7HFXLH.js";import"./chunk-DKOVZ6R2.js";import"./chunk-AFKFN25T.js";import"./chunk-G4747MOW.js";import"./chunk-KCJVFLBB.js";import"./chunk-OFJPOTES.js";import"./chunk-BL3CZWWD.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-LZPCA6DH.js";import"./chunk-L3KS6MOV.js";import"./chunk-XGY4OQLC.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-GY7YSD6J.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{a as createStandaloneExperimentTurnOwner};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as O,b as D}from"./chunk-UANH7U3Y.js";import{b as _,c as R,d as l,e as d}from"./chunk-SO4GMSNP.js";import{a as L}from"./chunk-KCJVFLBB.js";import{mc as c,nc as w}from"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import{p as m,s as f}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as y}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as g}from"./chunk-FTQLQJQV.js";import{randomUUID as H}from"node:crypto";var E=c.omit({workspace:!0}).extend({workspace:c.shape.workspace.omit({files:!0})}),k=class extends L{static{g(this,"SqliteChatResourceStore")}datasetListings=new Map;datasetListingDataVersion=null;async listChatHostedExperiments(){return await this.ready,await this.writeQueue,this.database.all("SELECT payload FROM chat_hosted_experiments ORDER BY id",[]).map(e=>JSON.parse(e.payload))}async readChatHostedExperiment(e){await this.ready,await this.writeQueue;let a=this.database.get("SELECT payload FROM chat_hosted_experiments WHERE id=?",[e]);return a?JSON.parse(a.payload):null}async retainChatHostedExperiment(e,a,s,t){await this.ready;let r=this.writeQueue.then(()=>{let i=this.database.get("SELECT owner_hash,configuration_hash FROM chat_hosted_experiments WHERE id=?",[e]);if(i&&(i.owner_hash!==a||i.configuration_hash!==s))throw new Error("The retained hosted Experiment changed owner or configuration.");this.database.run("INSERT INTO chat_hosted_experiments(id,owner_hash,configuration_hash,payload) VALUES(?,?,?,?) ON CONFLICT(id) DO UPDATE SET payload=excluded.payload",[e,a,s,JSON.stringify(t)])});return this.writeQueue=r.then(()=>{},()=>{}),r}async readChatExperimentGroup(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT request_hash,payload FROM chat_experiment_groups WHERE operation_id=?",[e]);if(!s)return null;if(a&&s.request_hash!==a)throw new Error("Experiment operation ID was reused with different inputs.");return JSON.parse(s.payload)}async prepareChatExperimentGroup(e,a,s){await this.ready;let t=this.writeQueue.then(()=>{this.database.run("INSERT OR IGNORE INTO chat_experiment_groups(operation_id,request_hash,payload) VALUES(?,?,?)",[e,a,JSON.stringify(s)]);let r=this.database.get("SELECT request_hash,payload FROM chat_experiment_groups WHERE operation_id=?",[e]);if(r.request_hash!==a)throw new Error("Experiment operation ID was reused with different inputs.");return JSON.parse(r.payload)});return this.writeQueue=t.then(()=>{},()=>{}),t}async localResourceOwnerId(){await this.ready;let e=this.writeQueue.then(()=>(this.database.run("INSERT OR IGNORE INTO local_resource_owner(singleton,id) VALUES(1,?)",[`local-owner-${H()}`]),this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]).id));return this.writeQueue=e.then(()=>{},()=>{}),e}async readLocalDataset(e,a){await this.ready,await this.writeQueue;let s=this.database.get(a===void 0?"SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?":"SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",a===void 0?[e]:[e,a]);return s?d(this.database,s.payload):null}async readLocalDatasetByWorkspaceHash(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND json_extract(r.payload,'$.workspace.contentHash')=?",[e,a]);return s?d(this.database,s.payload):null}async listLocalDatasets(e=!1){if(e){let a=(await this.listLocalDatasetListings()).filter(t=>t.sync);return(await Promise.all(a.map(t=>this.readLocalDataset(t.workspace.draft.id)))).filter(t=>t!==null)}return await this.ready,await this.writeQueue,this.database.all("SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash ORDER BY w.updated_at DESC",[]).map(a=>d(this.database,a.payload))}async listLocalDatasetListings(){await this.ready,await this.writeQueue;let e=this.database.get("PRAGMA data_version",[]).data_version;this.datasetListingDataVersion!==e&&this.datasetListings.clear(),this.datasetListingDataVersion=e;let a=this.database.all("SELECT id,revision,updated_at FROM local_dataset_workspaces ORDER BY updated_at DESC",[]),s=new Set(a.map(t=>t.id));for(let t of this.datasetListings.keys())s.has(t)||this.datasetListings.delete(t);return a.map(t=>{let r=`${t.revision}:${t.updated_at}`,i=this.datasetListings.get(t.id);if(i?.stamp===r)return structuredClone(i.value);let o=this.database.get("SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[t.id]).payload,n=E.parse(l(this.database,o));return this.datasetListings.set(t.id,{stamp:r,value:n}),structuredClone(n)})}async readLocalDatasetListing(e,a){await this.ready,await this.writeQueue;let s=a===void 0?"local_dataset_workspaces":"local_dataset_versions",t=this.database.get(`SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM ${s} w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?${a===void 0?"":" AND w.revision=?"}`,a===void 0?[e]:[e,a]);return t?E.parse(l(this.database,t.payload)):null}async readLocalDatasetProjection(e,a,s){await this.ready,await this.writeQueue;let t=s.workspaceHash?"w.id=? AND json_extract(r.payload,'$.workspace.contentHash')=?":s.revision===void 0?"w.id=?":"w.id=? AND w.revision=?",r=s.workspaceHash||s.revision!==void 0?"local_dataset_versions":"local_dataset_workspaces",i=s.workspaceHash?[e,s.workspaceHash]:s.revision===void 0?[e]:[e,s.revision],o=`${r} w JOIN local_dataset_records r ON r.record_hash=w.record_hash`,n=this.database.get(`SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM ${o} WHERE ${t}`,i);if(!n)return null;let h=E.parse(l(this.database,n.payload)),{paths:I,policyPaths:N}=D(h.workspace.draft,a),p=[...N],u=[...I],S=p.length?`json_extract(file.value,'$.path') NOT IN (${p.map(()=>"?").join(",")})`:"1",b=u.length?` OR json_extract(file.value,'$.path') IN (${u.map(()=>"?").join(",")})`:"",v=this.database.all(`SELECT file.value AS payload FROM ${o},json_each(r.payload,'$.workspace.files') file WHERE ${t} AND (${S}${b})`,[...i,...p,...u]).map(x=>m.parse(R(this.database,JSON.parse(x.payload)))),T=h.workspace.contentHash,C=O({...h.workspace,files:v},a);return{record:c.parse({...h,workspace:C}),sourceWorkspaceHash:T}}async recoverLocalDatasetOperation(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT w.request_hash,r.payload FROM local_dataset_operations w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.operation_id=?",[e]);if(!s)return null;if(s.request_hash!==a)throw new Error("Dataset operation ID was reused with different input.");return d(this.database,s.payload)}async saveLocalDataset(e){let a=c.parse(e.record);if(f(a.workspace,Number.POSITIVE_INFINITY),a.workspace.draft.profileId!==a.ownerId||a.workspace.draft.modelScope!==null)throw new Error("Independent local Dataset ownership cannot change.");await this.ready;let s=this.writeQueue.then(()=>{this.database.exec("BEGIN IMMEDIATE");try{let t=this.database.get("SELECT w.request_hash,r.payload FROM local_dataset_operations w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.operation_id=?",[e.operationId]);if(t){if(t.request_hash!==e.requestHash)throw new Error("Dataset operation ID was reused with different input.");let n=d(this.database,t.payload);return this.database.exec("COMMIT"),n}let r=a.workspace.draft.id,i=this.database.get("SELECT w.revision,r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[r]);if((i?.revision??0)!==e.expectedRevision)throw new Error("Dataset changed. Reload its saved revision before editing.");if(a.workspace.draft.revision!==e.expectedRevision+1)throw new Error("Dataset revisions must advance once per saved edit.");if(i){let n=d(this.database,i.payload);if(n.ownerId!==a.ownerId||n.projectId!==a.projectId||n.workspace.draft.createdAt!==a.workspace.draft.createdAt)throw new Error("Dataset ownership and origin cannot change.");a.sync=n.sync}let o=_(this.database,a);return this.database.run("INSERT INTO local_dataset_workspaces(id,revision,record_hash,updated_at) VALUES(?,?,?,?) ON CONFLICT(id) DO UPDATE SET revision=excluded.revision,record_hash=excluded.record_hash,updated_at=excluded.updated_at",[r,a.workspace.draft.revision,o,a.workspace.draft.updatedAt]),this.database.run("INSERT INTO local_dataset_versions(id,revision,record_hash) VALUES(?,?,?)",[r,a.workspace.draft.revision,o]),this.database.run("INSERT INTO local_dataset_operations(operation_id,request_hash,record_hash) VALUES(?,?,?)",[e.operationId,e.requestHash,o]),this.database.exec("COMMIT"),this.datasetListings.delete(r),a}catch(t){throw this.database.exec("ROLLBACK"),t}});return this.writeQueue=s.then(()=>{},()=>{}),s}async updateLocalDatasetMetadata(e,a,s){await this.ready;let t=this.writeQueue.then(()=>{this.database.exec("BEGIN IMMEDIATE");try{let r=this.database.get("SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[e]);if(!r)throw new Error("Local Dataset was not found.");let i=d(this.database,r.payload);if(y(i)!==a)throw new Error("Dataset state changed. Retry against its latest saved state.");let o=c.parse(s(i));if(o.ownerId!==i.ownerId||o.projectId!==i.projectId||o.workspace.contentHash!==i.workspace.contentHash)throw new Error("Metadata updates cannot edit Dataset bytes or ownership.");let n=_(this.database,o);return this.database.run("UPDATE local_dataset_workspaces SET record_hash=? WHERE id=?",[n,e]),this.database.run("UPDATE local_dataset_versions SET record_hash=? WHERE id=? AND revision=?",[n,e,o.workspace.draft.revision]),this.database.exec("COMMIT"),this.datasetListings.delete(e),o}catch(r){throw this.database.exec("ROLLBACK"),r}});return this.writeQueue=t.then(()=>{},()=>{}),t}async linkChatResource(e,a,s){let t=w.parse(s);await this.upsertPayload("INSERT INTO chat_resource_links(session_id,turn_id,kind,resource_id,revision,payload) VALUES(?,?,?,?,?,?) ON CONFLICT(session_id,turn_id,kind,resource_id) DO UPDATE SET revision=excluded.revision,payload=excluded.payload WHERE excluded.revision>=chat_resource_links.revision",[e,a,t.kind,t.id,t.revision,JSON.stringify(t)])}async chatResourceLinks(e){await this.ready,await this.writeQueue;let a=[],s=[];return e.sessionId&&(a.push("session_id=?"),s.push(e.sessionId)),e.kind&&(a.push("kind=?"),s.push(e.kind)),e.id&&(a.push("resource_id=?"),s.push(e.id)),this.database.all(`SELECT session_id,turn_id,payload FROM chat_resource_links${a.length?` WHERE ${a.join(" AND ")}`:""}`,s).map(t=>({sessionId:t.session_id,turnId:t.turn_id,summary:w.parse(JSON.parse(t.payload))}))}};export{k as SqliteChatResourceStore};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as r}from"./chunk-KCJVFLBB.js";import"./chunk-CJDGLPNX.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-GD3RCUDH.js";import{F as s,G as t}from"./chunk-FCXDPVGJ.js";import"./chunk-UTIELP6F.js";import"./chunk-5TPYBXWM.js";import"./chunk-FYWQWKVS.js";import"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-543QHE3D.js";import"./chunk-LI56PPCN.js";import"./chunk-GI7LTJV3.js";import"./chunk-6LFTQBXP.js";import"./chunk-XGY4OQLC.js";import"./chunk-VPAEFG7X.js";import"./chunk-SFR32TMJ.js";import"./chunk-AXYAEWWA.js";import"./chunk-QOUOU7FE.js";import"./chunk-WJSJXK2N.js";import"./chunk-TS5HNRZB.js";import"./chunk-5ZNE43XC.js";import"./chunk-HIQPGYVH.js";import"./chunk-263WS3TB.js";import"./chunk-SD2XDZQW.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-6FA3GG5B.js";import"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as n}from"./chunk-FTQLQJQV.js";var d=class extends r{static{n(this,"SqliteContinualBenchReviewStore")}async saveContinualLearningDailyBatch(i){let e=s.parse(i),a=await this.getContinualLearningDailyBatch(e.id);if(a&&(a.seriesId!==e.seriesId||a.scheduleEntryId!==e.scheduleEntryId||a.dayOrdinal!==e.dayOrdinal||JSON.stringify(a.sourceTaskset)!==JSON.stringify(e.sourceTaskset)||e.revision!==a.revision+1)){if(JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("A daily learning batch update must preserve its intake identity and use the next revision.")}return await this.upsertPayload(`INSERT INTO continual_learning_daily_batches
2
+ import{a as r}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import{F as s,G as t}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as n}from"./chunk-FTQLQJQV.js";var d=class extends r{static{n(this,"SqliteContinualBenchReviewStore")}async saveContinualLearningDailyBatch(i){let e=s.parse(i),a=await this.getContinualLearningDailyBatch(e.id);if(a&&(a.seriesId!==e.seriesId||a.scheduleEntryId!==e.scheduleEntryId||a.dayOrdinal!==e.dayOrdinal||JSON.stringify(a.sourceTaskset)!==JSON.stringify(e.sourceTaskset)||e.revision!==a.revision+1)){if(JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("A daily learning batch update must preserve its intake identity and use the next revision.")}return await this.upsertPayload(`INSERT INTO continual_learning_daily_batches
3
3
  (id, series_id, schedule_entry_id, day_ordinal, status, revision, payload, created_at, updated_at)
4
4
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
5
5
  ON CONFLICT(id) DO UPDATE SET status = excluded.status, revision = excluded.revision, payload = excluded.payload, updated_at = excluded.updated_at`,[e.id,e.seriesId,e.scheduleEntryId,e.dayOrdinal,e.status,e.revision,JSON.stringify(e),e.createdAt,e.updatedAt]),e}async getContinualLearningDailyBatch(i){return this.getParsedPayload("SELECT payload FROM continual_learning_daily_batches WHERE id = ?",[i],s.parse)}async listContinualLearningDailyBatches(i={}){return i.seriesId?this.listParsedPayloads("SELECT payload FROM continual_learning_daily_batches WHERE series_id = ? ORDER BY day_ordinal ASC",[i.seriesId],s.parse):this.listParsedPayloads("SELECT payload FROM continual_learning_daily_batches ORDER BY series_id, day_ordinal ASC",[],s.parse)}async saveContinualBenchIssueReview(i){let e=t.parse(i),a=await this.getContinualBenchIssueReview(e.id);if(a&&(a.seriesId!==e.seriesId||a.passLabel!==e.passLabel||a.packet.contentHash!==e.packet.contentHash||e.revision!==a.revision+1)){if(JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("A Continual Support review update must preserve its sealed packet and use the next revision.")}return await this.upsertPayload(`INSERT INTO continual_bench_issue_reviews (id, series_id, pass_label, status, revision, payload, created_at, updated_at)
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as s,b as o}from"./chunk-K7KBFM2T.js";import{a as u}from"./chunk-KCJVFLBB.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as l}from"./chunk-FTQLQJQV.js";var T=class extends u{static{l(this,"SqliteConversationServingStore")}conversationTables=null;async ensureConversationTables(){if(await this.ready,!this.conversationTables){let e=this.writeQueue.then(async()=>{await this.exec("CREATE TABLE IF NOT EXISTS conversation_serving_grants (id TEXT PRIMARY KEY, revision INTEGER NOT NULL, payload TEXT NOT NULL)"),await this.exec("CREATE TABLE IF NOT EXISTS conversation_serving_executions (id TEXT PRIMARY KEY, grant_id TEXT NOT NULL, revision INTEGER NOT NULL, payload TEXT NOT NULL)")});this.writeQueue=e.catch(()=>{}),this.conversationTables=e}await this.conversationTables}async listConversationServingGrants(){return await this.ensureConversationTables(),await this.writeQueue,(await this.all("SELECT payload FROM conversation_serving_grants ORDER BY id",[])).map(e=>s.parse(JSON.parse(e.payload)))}async listConversationServingExecutions(e){return await this.ensureConversationTables(),await this.writeQueue,(await this.all("SELECT payload FROM conversation_serving_executions WHERE grant_id = ? ORDER BY id",[e])).map(i=>o.parse(JSON.parse(i.payload)))}async saveConversationServingGrant(e,i){let n=s.parse(e);return await this.saveConversationServingRow("conversation_serving_grants",n.id,n.revision,n,i),n}async saveConversationServingExecution(e,i){let n=o.parse(e);return await this.saveConversationServingRow("conversation_serving_executions",n.id,n.revision,n,i,n.grantId),n}async saveConversationServingRow(e,i,n,t,v,c){if(n!==v+1)throw new Error("Conversation serving revision is invalid.");await this.ensureConversationTables();let d=this.writeQueue.then(async()=>{await this.exec("BEGIN IMMEDIATE");try{let r=await this.get(`SELECT revision, payload FROM ${e} WHERE id = ?`,[i]);if((r?.revision??0)!==v)throw new Error("Conversation serving authority changed.");if(r){let a=JSON.parse(r.payload),g=t;if((e==="conversation_serving_grants"?["id","ownerInstanceId","teamId","profileId","projectId","hostedModelId","role","roleTargetId"]:["id","grantId","jobId","artifactHash","priorBindingId","leaseId","canarySeconds","createdAt"]).some(E=>a[E]!==g[E]))throw new Error("The retained serving identity cannot be replaced.")}if(e==="conversation_serving_grants"){let a=s.parse(t);if(a.enabled&&await this.get("SELECT id FROM conversation_serving_grants WHERE id != ? AND json_extract(payload, '$.enabled') = 1 AND json_extract(payload, '$.profileId') = ? AND json_extract(payload, '$.role') = ? AND json_extract(payload, '$.roleTargetId') = ? LIMIT 1",[i,a.profileId,a.role,a.roleTargetId]))throw new Error("This native serving target already has an enabled owner grant. Revoke it before registering another.")}r?await this.run(`UPDATE ${e} SET revision = ?, payload = ? WHERE id = ?`,[n,JSON.stringify(t),i]):c?await this.run(`INSERT INTO ${e} (id, grant_id, revision, payload) VALUES (?, ?, ?, ?)`,[i,c,n,JSON.stringify(t)]):await this.run(`INSERT INTO ${e} (id, revision, payload) VALUES (?, ?, ?)`,[i,n,JSON.stringify(t)]),await this.exec("COMMIT")}catch(r){throw await this.exec("ROLLBACK").catch(()=>{}),r}});this.writeQueue=d.catch(()=>{}),await d}};export{T as SqliteConversationServingStore};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as c}from"./chunk-KCJVFLBB.js";import"./chunk-CJDGLPNX.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-GD3RCUDH.js";import"./chunk-FCXDPVGJ.js";import"./chunk-UTIELP6F.js";import"./chunk-5TPYBXWM.js";import"./chunk-FYWQWKVS.js";import{h as d}from"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-543QHE3D.js";import"./chunk-LI56PPCN.js";import"./chunk-GI7LTJV3.js";import"./chunk-6LFTQBXP.js";import"./chunk-XGY4OQLC.js";import"./chunk-VPAEFG7X.js";import"./chunk-SFR32TMJ.js";import"./chunk-AXYAEWWA.js";import"./chunk-QOUOU7FE.js";import"./chunk-WJSJXK2N.js";import"./chunk-TS5HNRZB.js";import"./chunk-5ZNE43XC.js";import"./chunk-HIQPGYVH.js";import"./chunk-263WS3TB.js";import"./chunk-SD2XDZQW.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-6FA3GG5B.js";import"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";var l=class extends c{static{p(this,"SqliteCreateImproveStore")}async getCreateImproveRun(e){await this.ready,await this.writeQueue;let t=await this.get("SELECT payload FROM create_improve_runs WHERE id = ?",[e]);return t?d.parse(JSON.parse(t.payload)):null}async listCreateImproveRuns(e={}){await this.ready,await this.writeQueue;let t=[],a=[];e.profileId&&(t.push("profile_id = ?"),a.push(e.profileId)),e.conversationId&&(t.push("conversation_id = ?"),a.push(e.conversationId)),e.targetKind&&(t.push("target_kind = ?"),a.push(e.targetKind)),e.targetId&&(t.push("target_id = ?"),a.push(e.targetId));let o=Array.isArray(e.state)?e.state:e.state?[e.state]:[];o.length>0&&(t.push(`state IN (${o.map(()=>"?").join(", ")})`),a.push(...o));let s=Math.max(1,Math.min(1e3,Math.trunc(e.limit??250)));return a.push(s),(await this.all(`SELECT payload
2
+ import{a as c}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import{h as d}from"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";var l=class extends c{static{p(this,"SqliteCreateImproveStore")}async getCreateImproveRun(e){await this.ready,await this.writeQueue;let t=await this.get("SELECT payload FROM create_improve_runs WHERE id = ?",[e]);return t?d.parse(JSON.parse(t.payload)):null}async listCreateImproveRuns(e={}){await this.ready,await this.writeQueue;let t=[],a=[];e.profileId&&(t.push("profile_id = ?"),a.push(e.profileId)),e.conversationId&&(t.push("conversation_id = ?"),a.push(e.conversationId)),e.targetKind&&(t.push("target_kind = ?"),a.push(e.targetKind)),e.targetId&&(t.push("target_id = ?"),a.push(e.targetId));let o=Array.isArray(e.state)?e.state:e.state?[e.state]:[];o.length>0&&(t.push(`state IN (${o.map(()=>"?").join(", ")})`),a.push(...o));let s=Math.max(1,Math.min(1e3,Math.trunc(e.limit??250)));return a.push(s),(await this.all(`SELECT payload
3
3
  FROM create_improve_runs
4
4
  ${t.length>0?`WHERE ${t.join(" AND ")}`:""}
5
5
  ORDER BY updated_at DESC
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as u}from"./chunk-BJXPQIVD.js";import{a as l}from"./chunk-KCJVFLBB.js";import"./chunk-CJDGLPNX.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-GD3RCUDH.js";import{d as i}from"./chunk-FCXDPVGJ.js";import"./chunk-UTIELP6F.js";import"./chunk-5TPYBXWM.js";import"./chunk-FYWQWKVS.js";import"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-543QHE3D.js";import"./chunk-LI56PPCN.js";import"./chunk-GI7LTJV3.js";import"./chunk-6LFTQBXP.js";import"./chunk-XGY4OQLC.js";import"./chunk-VPAEFG7X.js";import"./chunk-SFR32TMJ.js";import"./chunk-AXYAEWWA.js";import"./chunk-QOUOU7FE.js";import"./chunk-WJSJXK2N.js";import"./chunk-O6ZYDHEJ.js";import"./chunk-TS5HNRZB.js";import{o as r,w as o}from"./chunk-5ZNE43XC.js";import"./chunk-HIQPGYVH.js";import"./chunk-263WS3TB.js";import"./chunk-SD2XDZQW.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-6FA3GG5B.js";import"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as n}from"./chunk-FTQLQJQV.js";var c=class extends l{static{n(this,"SqliteDatasetStore")}async listDatasetCatalogTasksets(e){return await this.ready,await this.writeQueue,(await this.all(`SELECT
2
+ import{a as l}from"./chunk-KCJVFLBB.js";import{a as u}from"./chunk-U7D6Q744.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import{d as i}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-SSHE6B7Z.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{o as r,w as o}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as n}from"./chunk-FTQLQJQV.js";var c=class extends l{static{n(this,"SqliteDatasetStore")}async listDatasetCatalogTasksets(e){return await this.ready,await this.writeQueue,(await this.all(`SELECT
3
3
  id AS taskset_id,
4
4
  CAST(json_extract(payload, '$.revision') AS INTEGER) AS taskset_revision,
5
5
  json_extract(payload, '$.datasetArtifact.id') AS artifact_id,
@@ -0,0 +1,7 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as m}from"./chunk-KDER7R45.js";import{a as k}from"./chunk-KCJVFLBB.js";import{v as f}from"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import{Hb as E,Ib as O,O as v,Ob as h,Pb as C,Q as y,f as R,h as p,m as H}from"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import{Ka as P,m as _}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as s,o as c}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as g}from"./chunk-FTQLQJQV.js";var w=class extends k{static{g(this,"SqliteEvaluationResultStore")}async saveProfileEvaluationGrade(a){let e=P.parse(a);c(e,"Profile evaluation grade");let n=await this.getProfileEvaluationGrade(e.contentHash);return n||(await this.upsertPayload("INSERT INTO profile_evaluation_grades (content_hash, payload) VALUES (?, ?) ON CONFLICT(content_hash) DO NOTHING",[e.contentHash,JSON.stringify(e)]),e)}async getProfileEvaluationGrade(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_grades WHERE content_hash = ?",[a],P.parse)}async saveProfileEvaluationReceipt(a){let e=R.parse(a);H(e);let n=await this.getProfileEvaluationReceipt(e.id);if(n){if(n.contentHash!==e.contentHash)throw new Error(`Profile evaluation receipt ${e.id} is immutable.`);return n}return await this.upsertPayload("INSERT INTO profile_evaluation_receipts (id, run_id, payload) VALUES (?, ?, ?)",[e.id,e.runManifest.id,JSON.stringify(e)]),e}async getProfileEvaluationReceipt(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_receipts WHERE id = ?",[a],R.parse)}async saveProfileEvaluationRun(a){let e=m.parse(a);c(e,"Profile evaluation run"),c(e.manifest,"Profile evaluation run manifest"),_(e.metric);let n=e.manifest.profileEvaluation;if(!n||n.profileId!==e.profileRef.profileId||e.metric.runManifest.id!==e.manifest.id||e.metric.runManifest.contentHash!==e.manifest.contentHash||s(e.receiptRefs)!==s(e.metric.receiptRefs))throw new Error("Profile evaluation run differs from its manifest or metric receipts.");if(e.receiptRefs.length!==e.manifest.population.length||e.gradeRefs.length!==e.receiptRefs.length)throw new Error("Profile evaluation run has an incomplete receipt or grade population.");for(let[t,u]of e.manifest.population.entries()){let d=e.receiptRefs[t],r=await this.getProfileEvaluationReceipt(d.id);if(!r||r.contentHash!==d.contentHash||r.runManifest.id!==e.manifest.id||r.runManifest.contentHash!==e.manifest.contentHash||r.id!==u.receiptId||r.taskId!==u.taskId||r.seed!==u.seed)throw new Error("Profile evaluation run references a missing or mismatched receipt.");let l=e.gradeRefs[t],o=await this.getProfileEvaluationGrade(l.contentHash);if(!o||o.contentHash!==l.contentHash||!r.graderEvidenceRefs.some(S=>S.id===l.id&&S.contentHash===l.contentHash))throw new Error("Profile evaluation run references a missing or mismatched grade.")}let i=await this.getProfileEvaluationRun(e.manifest.id);if(i){if(i.contentHash!==e.contentHash)throw new Error(`Profile evaluation run ${e.manifest.id} is immutable.`);return i}return await this.upsertPayload("INSERT INTO profile_evaluation_runs (id, profile_key, taskset_id, payload, created_at) VALUES (?, ?, ?, ?, ?)",[e.manifest.id,s(e.profileRef),e.manifest.tasksetRelease.id,JSON.stringify(e),e.completedAt]),e}async getProfileEvaluationRun(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_runs WHERE id = ?",[a],m.parse)}async listProfileEvaluationRuns(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_runs WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],m.parse)}async saveProfileEvaluationComparison(a,e){let n=f.parse(a),i=E.parse(e);c(i,"Profile evaluation comparison");let t=[];for(let d of i.members){let r=await this.getProfileEvaluationRun(d.runManifest.id);if(!r||s(r.profileRef)!==s(n)||r.manifest.contentHash!==d.runManifest.contentHash||r.metric.contentHash!==d.metricResultHash)throw new Error("Profile evaluation comparison references a missing or mismatched run.");t.push({manifest:r.manifest,result:r.metric})}if(O({id:i.id,members:t,createdAt:i.createdAt}).contentHash!==i.contentHash)throw new Error("Profile evaluation comparison differs from retained run evidence.");let u=await this.getProfileEvaluationComparison(i.id);if(u){if(u.contentHash!==i.contentHash)throw new Error(`Profile evaluation comparison ${i.id} is immutable.`);return u}return await this.upsertPayload("INSERT INTO profile_evaluation_comparisons (id, profile_key, payload, created_at) VALUES (?, ?, ?, ?)",[i.id,s(n),JSON.stringify(i),i.createdAt]),i}async getProfileEvaluationComparison(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_comparisons WHERE id = ?",[a],E.parse)}async listProfileEvaluationComparisons(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_comparisons WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],E.parse)}async saveProfileEvaluationSuiteRun(a,e,n){let i=f.parse(a),t=h.parse(n);c(t,"Profile evaluation suite run");let u=[];for(let l of t.members){let o=await this.getProfileEvaluationRun(l.runManifest.id);if(!o||s(o.profileRef)!==s(i)||o.manifest.contentHash!==l.runManifest.contentHash||o.contentHash!==l.runHash||o.passed!==l.passed||o.metric.value!==l.score)throw new Error("Profile evaluation suite references a missing or mismatched run.");u.push({definitionId:l.definitionId,manifest:o.manifest,runHash:o.contentHash,passed:o.passed,score:o.metric.value})}if(C({id:t.id,suiteId:t.suiteId,catalog:e,members:u,createdAt:t.createdAt,completedAt:t.completedAt}).contentHash!==t.contentHash)throw new Error("Profile evaluation suite differs from retained run evidence.");let r=await this.getProfileEvaluationSuiteRun(t.id);if(r){if(r.contentHash!==t.contentHash)throw new Error(`Profile evaluation suite run ${t.id} is immutable.`);return r}return await this.upsertPayload("INSERT INTO profile_evaluation_suite_runs (id, profile_key, payload, created_at) VALUES (?, ?, ?, ?)",[t.id,s(i),JSON.stringify(t),t.createdAt]),t}async getProfileEvaluationSuiteRun(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_suite_runs WHERE id = ?",[a],h.parse)}async listProfileEvaluationSuiteRuns(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_suite_runs WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],h.parse)}async saveBenchmarkRun(a){let e=v.parse(a.run);return c(e,"Benchmark run"),await this.upsertPayload(`INSERT INTO benchmark_runs (id, taskset_id, phase, payload, created_at)
3
+ VALUES (?, ?, ?, ?, ?)
4
+ ON CONFLICT(id) DO NOTHING`,[e.id,a.tasksetId,e.phase,JSON.stringify(e),e.createdAt]),e}async listBenchmarkRuns(a){return this.listParsedPayloads("SELECT payload FROM benchmark_runs WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",[a],v.parse)}async saveBenchmarkComparison(a){let e=y.parse(a.comparison);return c(e,"Benchmark comparison"),await this.upsertPayload(`INSERT INTO benchmark_comparisons (id, taskset_id, payload, created_at)
5
+ VALUES (?, ?, ?, ?)
6
+ ON CONFLICT(id) DO NOTHING`,[e.id,a.tasksetId,JSON.stringify(e),e.createdAt]),e}async listBenchmarkComparisons(a){return this.listParsedPayloads("SELECT payload FROM benchmark_comparisons WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",[a],y.parse)}async saveEvaluationResult(a){let e=p.parse(a.result);if(c(e,"Evaluation result"),e.metadata.sourceTasksetId!==a.tasksetId)throw new Error("Evaluation result does not match the supplied Taskset identity.");let n=await this.getEvaluationResult(e.id);if(n){if(n.contentHash!==e.contentHash)throw new Error(`Evaluation result ${e.id} is immutable and already has another content hash.`);return n}return await this.upsertPayload(`INSERT INTO evaluation_results (id, taskset_id, kind, payload, created_at)
7
+ VALUES (?, ?, ?, ?, ?)`,[e.id,a.tasksetId,a.kind,JSON.stringify(e),a.createdAt]),e}async getEvaluationResult(a){return this.getParsedPayload("SELECT payload FROM evaluation_results WHERE id = ?",[a],p.parse)}async listEvaluationResults(a,e){return this.listParsedPayloads(e?"SELECT payload FROM evaluation_results WHERE taskset_id = ? AND kind = ? ORDER BY created_at DESC, id ASC":"SELECT payload FROM evaluation_results WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",e?[a,e]:[a],p.parse)}};export{m as LocalProfileEvaluationRunSchema,w as SqliteEvaluationResultStore};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b}from"./chunk-GUG2SWRZ.js";import{a}from"./chunk-G4747MOW.js";import"./chunk-KCJVFLBB.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-HVM2GUM3.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{a as LocalHarnessReleaseRecordSchema,b as SqliteHarnessWorkspaceStore};
2
+ import{b}from"./chunk-AFKFN25T.js";import{a}from"./chunk-G4747MOW.js";import"./chunk-KCJVFLBB.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-HVM2GUM3.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{a as LocalHarnessReleaseRecordSchema,b as SqliteHarnessWorkspaceStore};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as h,b as d,c as p,h as N}from"./chunk-M4ZHFDRJ.js";import"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as T}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import{Aa as I,F as u}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as l}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as c}from"./chunk-FTQLQJQV.js";function L(o,e){let i=d(o,e.scope,e.executionId);if(i.ownerActorId!==e.actorId||!i.completedAt)throw new Error("human_local_publication_source_denied");return o.exec("CREATE TABLE IF NOT EXISTS human_local_publications(scope TEXT NOT NULL,actor_id TEXT NOT NULL,execution_id TEXT NOT NULL,operation_id TEXT NOT NULL,execution_hash TEXT NOT NULL,publication TEXT NOT NULL,PRIMARY KEY(scope,actor_id,execution_id,operation_id))"),i}c(L,"setup");function w(o,e){if(L(o,e).executionHash!==e.executionHash)throw new Error("human_local_publication_source_changed");let t=o.get("SELECT publication,execution_hash FROM human_local_publications WHERE scope=? AND actor_id=? AND execution_id=? AND operation_id=?",[e.scope,e.actorId,e.executionId,e.operationId]);if(t){if(t.execution_hash!==e.executionHash||l(JSON.parse(t.publication))!==l(e.publication))throw new Error("human_local_publication_operation_conflict");return}o.run("INSERT INTO human_local_publications VALUES(?,?,?,?,?,?)",[e.scope,e.actorId,e.executionId,e.operationId,e.executionHash,JSON.stringify(e.publication)])}c(w,"retainHumanLocalPublication");function O(o,e){let i=L(o,e);return o.all("SELECT publication,execution_hash FROM human_local_publications WHERE scope=? AND actor_id=? AND execution_id=? ORDER BY operation_id LIMIT 1001",[e.scope,e.actorId,e.executionId]).map(t=>{if(t.execution_hash!==i.executionHash)throw new Error("human_local_publication_source_changed");return JSON.parse(t.publication)})}c(O,"readHumanLocalPublications");function _(o,e){let i=d(o,e.teamId,e.executionId);if(i.ownerActorId!==e.actorId)throw new Error("live_agent_account_denied");let t=o.get("SELECT owner_id FROM local_experiment_executions WHERE team_id=? AND id=?",[e.teamId,e.executionId]),n=p(o,e.teamId,e.executionId).find(g=>g.receiptId===e.receiptId);if(!n||n.admission.request.model.providerId!=="claude-code")throw new Error("live_agent_case_denied");let a=o.get("SELECT payload FROM local_experiment_events WHERE team_id=? AND execution_id=? AND case_id=? AND type='external.start' ORDER BY sequence LIMIT 1",[e.teamId,e.executionId,e.receiptId]);if(!a||JSON.parse(a.payload).sessionId!==e.sessionId)throw new Error("live_agent_session_stale");o.exec("CREATE TABLE IF NOT EXISTS human_live_controls(team_id TEXT NOT NULL,actor_id TEXT NOT NULL,operation_id TEXT NOT NULL,request_hash TEXT NOT NULL,state TEXT NOT NULL,PRIMARY KEY(team_id,actor_id,operation_id))");let{phase:r,ownerId:R,...E}=e,m=l(E),s=o.get("SELECT request_hash,state FROM human_live_controls WHERE team_id=? AND actor_id=? AND operation_id=?",[e.teamId,e.actorId,e.operationId]);if(s&&s.request_hash!==m)throw new Error("live_agent_operation_conflict");if(e.phase==="inspect")return s?{replay:!0,state:s.state}:null;if(N(o,e.ownerId),t?.owner_id!==e.ownerId)throw new Error("live_agent_execution_lease_lost");if(e.phase==="acknowledge"){if(!s)throw new Error("live_agent_operation_missing");return s.state==="acknowledged"?{replay:!0,state:"acknowledged"}:(v(o,e,"external.control_receipt",{sessionId:e.sessionId,operationId:e.operationId,action:e.action,transport:"process_stdin",state:"acknowledged",occurredAt:new Date().toISOString()}),o.run("UPDATE human_live_controls SET state='acknowledged' WHERE team_id=? AND actor_id=? AND operation_id=?",[e.teamId,e.actorId,e.operationId]),{replay:!1,state:"acknowledged"})}if(s)return{replay:!0,state:s.state};if(o.get("SELECT c.operation_id FROM human_live_controls c JOIN local_experiment_events e ON e.team_id=c.team_id AND json_extract(e.payload,'$.actorId')=c.actor_id AND json_extract(e.payload,'$.operationId')=c.operation_id WHERE c.team_id=? AND c.actor_id=? AND c.state='prepared' AND e.execution_id=? AND e.case_id=? AND e.type='external.human_intervention' LIMIT 1",[e.teamId,e.actorId,e.executionId,e.receiptId]))throw new Error("live_agent_prior_delivery_unknown");if(n.status!=="running"||i.completedAt)throw new Error("live_agent_already_sealed");return o.run("INSERT INTO human_live_controls VALUES(?,?,?,?,'prepared')",[e.teamId,e.actorId,e.operationId,m]),v(o,e,"external.human_intervention",{...E,occurredAt:new Date().toISOString()}),{replay:!1,state:"prepared"}}c(_,"writeHumanLiveControl");function v(o,e,i,t){let n=JSON.stringify(t),a=Buffer.byteLength(n),r=o.get("SELECT event_count,byte_count FROM local_experiment_trace_budgets WHERE team_id=? AND execution_id=?",[e.teamId,e.executionId]);if(a>1048576||(r?.event_count??0)>=2e4||(r?.byte_count??0)+a>67108864)throw new Error("live_agent_control_too_large");o.run("INSERT INTO local_experiment_events(team_id,execution_id,case_id,type,payload) VALUES(?,?,?,?,?)",[e.teamId,e.executionId,e.receiptId,i,n]),o.run("INSERT INTO local_experiment_trace_budgets(team_id,execution_id,event_count,byte_count) VALUES(?,?,1,?) ON CONFLICT(team_id,execution_id) DO UPDATE SET event_count=event_count+1,byte_count=byte_count+excluded.byte_count",[e.teamId,e.executionId,a])}c(v,"appendControlEvent");var y=`
3
+ CREATE TABLE IF NOT EXISTS human_review_revisions(scope TEXT NOT NULL,id TEXT NOT NULL,revision INTEGER NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id,revision));
4
+ CREATE TABLE IF NOT EXISTS human_reviews(scope TEXT NOT NULL,id TEXT NOT NULL,revision INTEGER NOT NULL,project_id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id));
5
+ CREATE INDEX IF NOT EXISTS human_reviews_project_idx ON human_reviews(scope,project_id,id);
6
+ CREATE TABLE IF NOT EXISTS human_review_operations(scope TEXT NOT NULL,id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id));
7
+ `,x=class extends T{static{c(this,"SqliteHumanReviewStore")}async humanLiveControl(e){await this.ready;let i=this.writeQueue.then(()=>{let t=this.database;t.exec("BEGIN IMMEDIATE");try{let n=_(t,e);return t.exec("COMMIT"),n}catch(n){throw t.exec("ROLLBACK"),n}});return this.writeQueue=i.then(()=>{},()=>{}),i}async humanLiveControlReceipt(e){return await this.ready,await this.writeQueue,_(this.database,{...e,phase:"inspect"})}async rememberHumanLocalPublication(e){await this.ready;let i=this.writeQueue.then(()=>{let t=this.database;t.exec("BEGIN IMMEDIATE");try{w(t,e),t.exec("COMMIT")}catch(n){throw t.exec("ROLLBACK"),n}});return this.writeQueue=i.then(()=>{},()=>{}),i}async forgetHumanLocalPublication(e){await this.ready;let i=this.writeQueue.then(()=>{if(this.database.get("SELECT name FROM sqlite_master WHERE type='table' AND name='human_local_publications'"))return this.database.run("DELETE FROM human_local_publications WHERE scope=? AND actor_id=? AND json_extract(publication,'$.id')=?",[e.scope,e.actorId,e.publicationId])});return this.writeQueue=i.then(()=>{},()=>{}),i}async humanLocalPublications(e){return await this.ready,await this.writeQueue,O(this.database,e)}humanReviewRepository(){return{transaction:c(async(e,i)=>{await this.ready;let t=this.writeQueue.then(async()=>{let n=this.database;n.exec(y),n.exec("BEGIN IMMEDIATE");let a=!0;try{let r=await i(S(n,e,()=>{if(!a)throw new Error("human_transaction_closed")}));return n.exec("COMMIT"),r}catch(r){throw n.exec("ROLLBACK"),r}finally{a=!1}});return this.writeQueue=t.then(()=>{},()=>{}),t},"transaction")}}humanReviewLocalEvidence(e,i){let t=d(this.database,e,i),n=h(this.database,e,t.definition.id,t.definition.revision);return{execution:t,released:n,cases:p(this.database,e,i)}}};function S(o,e,i){return{async get(t,n){i();let a=n===void 0?o.get("SELECT payload FROM human_reviews WHERE scope=? AND id=?",[e,t]):o.get("SELECT payload FROM human_review_revisions WHERE scope=? AND id=? AND revision=?",[e,t,n]);return a?u.parse(JSON.parse(a.payload)):null},async put(t,n){i();let a=u.parse(t),r=o.get("SELECT revision FROM human_reviews WHERE scope=? AND id=?",[e,a.id]);if(a.scope!==e||a.revision!==n+1||(r?.revision??0)!==n)throw new I("human_revision_conflict",409);o.run("INSERT INTO human_review_revisions(scope,id,revision,payload) VALUES(?,?,?,?)",[e,a.id,a.revision,JSON.stringify(a)]),o.run("INSERT INTO human_reviews(scope,id,revision,project_id,payload) VALUES(?,?,?,?,?) ON CONFLICT(scope,id) DO UPDATE SET revision=excluded.revision,payload=excluded.payload",[e,a.id,a.revision,a.projectId,JSON.stringify(a)])},async list(t){i();let n=o.all(`SELECT payload FROM human_reviews WHERE scope=? ${t.projectId?"AND project_id=?":""} ${t.afterId?"AND id>?":""} ORDER BY id LIMIT ?`,[e,...t.projectId?[t.projectId]:[],...t.afterId?[t.afterId]:[],t.limit+1]),a=n.slice(0,t.limit).map(r=>u.parse(JSON.parse(r.payload)));return{items:a,nextCursor:n.length>t.limit?a.at(-1).id:null}},async operation(t){i();let n=o.get("SELECT payload FROM human_review_operations WHERE scope=? AND id=?",[e,t]);return n?JSON.parse(n.payload):null},async saveOperation(t,n){i(),o.run("INSERT INTO human_review_operations(scope,id,payload) VALUES(?,?,?)",[e,t,JSON.stringify(n)])}}}c(S,"createHumanReviewTransaction");export{y as HUMAN_REVIEW_SQL,x as SqliteHumanReviewStore,S as createHumanReviewTransaction};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import{H as d}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as s}from"./chunk-FTQLQJQV.js";function f(e){if(Array.isArray(e)){let r=!1,n=e.map(c=>{let t=f(c);return r||=t.changed,t.value});return{value:r?n:e,changed:r}}if(!u(e))return{value:e,changed:!1};let o=!1,i={};for(let[r,n]of Object.entries(e)){if(r==="learnedPreference"&&n!==null){let t=u(n)?Object.fromEntries(Object.entries(n).filter(([l])=>l!=="qualificationKind")):n,a=d.safeParse(t);i[r]=a.success?a.data:null,o||=!a.success||t!==n;continue}let c=f(n);i[r]=c.value,o||=c.changed}return{value:o?i:e,changed:o}}s(f,"sanitizeUnverifiableLearnedPreferenceBindings");function u(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}s(u,"isRecord");export{f as sanitizeUnverifiableLearnedPreferenceBindings};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-B2K5WQZE.js";import"./chunk-KCJVFLBB.js";import"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{a as SqliteLearningStore,b as createLearningTransaction,c as putLearningResourceInTransaction};
2
+ import{a,b,c}from"./chunk-IO5DZUKL.js";import"./chunk-KCJVFLBB.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{a as SqliteLearningStore,b as createLearningTransaction,c as putLearningResourceInTransaction};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-UXO33ST5.js";import"./chunk-UKSSFB4Q.js";import{a as u}from"./chunk-KCJVFLBB.js";import{a as s}from"./chunk-BUZ7CBJC.js";import"./chunk-HIQPGYVH.js";import"./chunk-SD2XDZQW.js";import"./chunk-MTP3B2SU.js";import"./chunk-XHU4BZQY.js";import{Aa as c}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as l}from"./chunk-FTQLQJQV.js";var p=class extends u{static{l(this,"SqliteLearningCredentialStore")}async credentialTransaction(t){await this.ready;let n=this.writeQueue.then(()=>{let e=this.database;e.exec("BEGIN IMMEDIATE");try{let r=t(e);return e.exec("COMMIT"),r}catch(r){throw e.exec("ROLLBACK"),r}});return this.writeQueue=n.then(()=>{},()=>{}),n}async createLearningSourceCredential(t,n,e){let r=s.parse(t);return this.credentialTransaction(a=>{let i=a.get("SELECT payload, request_hash FROM learning_source_credentials WHERE id = ?",[r.id]);if(i){if(i.request_hash!==e)throw new c("learning_credential_operation_conflict",409);return s.parse(JSON.parse(i.payload))}if(a.get("SELECT id FROM learning_source_credentials WHERE key_hash = ?",[n]))throw new c("learning_credential_secret_reused",409);return a.run("INSERT INTO learning_source_credentials (id, scope, source_id, key_hash, request_hash, payload) VALUES (?, ?, ?, ?, ?, ?)",[r.id,r.scope,r.sourceId,n,e,JSON.stringify(r)]),r})}async findLearningSourceCredential(t){await this.ready,await this.writeQueue;let n=this.database.get("SELECT payload FROM learning_source_credentials WHERE key_hash = ?",[t]);return n?s.parse(JSON.parse(n.payload)):null}async listLearningSourceCredentials(t,n,e,r){if(!Number.isInteger(e)||e<1||e>100)throw new Error("learning_credential_page_invalid");await this.ready,await this.writeQueue;let a=this.database.all("SELECT payload FROM learning_source_credentials WHERE scope = ? AND source_id = ? AND id > ? ORDER BY id LIMIT ?",[t,n,r??"",e+1]),i=a.slice(0,e).map(o=>s.parse(JSON.parse(o.payload)));return{items:i,nextCursor:a.length>e?i.at(-1).id:null}}async revokeLearningSourceCredential(t,n,e,r){return this.credentialTransaction(a=>{let i=a.get("SELECT payload FROM learning_source_credentials WHERE scope = ? AND source_id = ? AND id = ?",[t,n,e]);if(!i)return null;let o=s.parse(JSON.parse(i.payload));if(o.revokedAt!==null)return o;let d=s.parse({...o,revokedAt:r});return a.run("UPDATE learning_source_credentials SET payload = ? WHERE scope = ? AND source_id = ? AND id = ?",[JSON.stringify(d),t,n,e]),d})}};export{p as SqliteLearningCredentialStore};
2
+ import"./chunk-XYZV3FKD.js";import"./chunk-N5EAVX4G.js";import{a as u}from"./chunk-KCJVFLBB.js";import{a as s}from"./chunk-UGFSAG4U.js";import"./chunk-HIQPGYVH.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-4PUOWSDE.js";import{Aa as c}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as l}from"./chunk-FTQLQJQV.js";var p=class extends u{static{l(this,"SqliteLearningCredentialStore")}async credentialTransaction(t){await this.ready;let n=this.writeQueue.then(()=>{let e=this.database;e.exec("BEGIN IMMEDIATE");try{let r=t(e);return e.exec("COMMIT"),r}catch(r){throw e.exec("ROLLBACK"),r}});return this.writeQueue=n.then(()=>{},()=>{}),n}async createLearningSourceCredential(t,n,e){let r=s.parse(t);return this.credentialTransaction(a=>{let i=a.get("SELECT payload, request_hash FROM learning_source_credentials WHERE id = ?",[r.id]);if(i){if(i.request_hash!==e)throw new c("learning_credential_operation_conflict",409);return s.parse(JSON.parse(i.payload))}if(a.get("SELECT id FROM learning_source_credentials WHERE key_hash = ?",[n]))throw new c("learning_credential_secret_reused",409);return a.run("INSERT INTO learning_source_credentials (id, scope, source_id, key_hash, request_hash, payload) VALUES (?, ?, ?, ?, ?, ?)",[r.id,r.scope,r.sourceId,n,e,JSON.stringify(r)]),r})}async findLearningSourceCredential(t){await this.ready,await this.writeQueue;let n=this.database.get("SELECT payload FROM learning_source_credentials WHERE key_hash = ?",[t]);return n?s.parse(JSON.parse(n.payload)):null}async listLearningSourceCredentials(t,n,e,r){if(!Number.isInteger(e)||e<1||e>100)throw new Error("learning_credential_page_invalid");await this.ready,await this.writeQueue;let a=this.database.all("SELECT payload FROM learning_source_credentials WHERE scope = ? AND source_id = ? AND id > ? ORDER BY id LIMIT ?",[t,n,r??"",e+1]),i=a.slice(0,e).map(o=>s.parse(JSON.parse(o.payload)));return{items:i,nextCursor:a.length>e?i.at(-1).id:null}}async revokeLearningSourceCredential(t,n,e,r){return this.credentialTransaction(a=>{let i=a.get("SELECT payload FROM learning_source_credentials WHERE scope = ? AND source_id = ? AND id = ?",[t,n,e]);if(!i)return null;let o=s.parse(JSON.parse(i.payload));if(o.revokedAt!==null)return o;let d=s.parse({...o,revokedAt:r});return a.run("UPDATE learning_source_credentials SET payload = ? WHERE scope = ? AND source_id = ? AND id = ?",[JSON.stringify(d),t,n,e]),d})}};export{p as SqliteLearningCredentialStore};
@@ -0,0 +1,97 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as D,c as J}from"./chunk-XVDFJ3ZF.js";import{a as N,b as u,c as R,d as E,e as w,f as v,g as P,h as x,i as j}from"./chunk-M4ZHFDRJ.js";import{h as c}from"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as M}from"./chunk-KCJVFLBB.js";import{Xb as f,_b as h,bc as O,cc as W,vc as F}from"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{ja as L}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{e as y}from"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as d}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as I}from"./chunk-X2J2P5ZT.js";import{a as _}from"./chunk-FTQLQJQV.js";function Y(s,e){let t=s.all(`SELECT e.id,e.payload,
3
+ COALESCE(json_extract(c.payload,'$.configuration.request.name'),json_extract(d.payload,'$.configuration.request.name')) AS name,
4
+ count(*) OVER () AS total FROM local_experiment_executions e
5
+ LEFT JOIN local_experiment_configurations c ON c.team_id=e.team_id AND c.execution_id=e.id
6
+ JOIN local_experiment_definitions d ON d.team_id=e.team_id AND d.id=e.definition_id AND d.revision=e.definition_revision
7
+ WHERE e.team_id=? AND json_extract(e.payload,'$.ownerActorId')=?
8
+ AND json_extract(e.payload,'$.status') IN ('queued','running','cancelling')
9
+ ${e.projectId?"AND COALESCE(json_extract(c.payload,'$.configuration.request.project.id'),json_extract(d.payload,'$.configuration.request.project.id'))=?":""}
10
+ ORDER BY json_extract(e.payload,'$.updatedAt') DESC,e.id DESC LIMIT ?`,[e.teamId,e.actorId,...e.projectId?[e.projectId]:[],e.limit]);return{count:Number(t[0]?.total??0),items:t.map(i=>{let n=JSON.parse(i.payload);return{kind:"experiment",location:"local",id:i.id,name:i.name??"Experiment",phase:n.status,updatedAt:n.updatedAt??n.startedAt??n.createdAt}})}}_(Y,"readLocalExecutionActivity");var B=`
11
+ CREATE TABLE IF NOT EXISTS local_experiment_owner (
12
+ singleton INTEGER PRIMARY KEY CHECK(singleton=1), owner_id TEXT NOT NULL,
13
+ pid INTEGER NOT NULL, lease_until INTEGER NOT NULL
14
+ );
15
+ CREATE TABLE IF NOT EXISTS local_experiment_definitions (
16
+ team_id TEXT NOT NULL, id TEXT NOT NULL, revision INTEGER NOT NULL,
17
+ content_hash TEXT NOT NULL, project_id TEXT, payload TEXT NOT NULL, package_payload TEXT NOT NULL,
18
+ PRIMARY KEY (team_id,id,revision)
19
+ );
20
+ CREATE TABLE IF NOT EXISTS local_experiment_operations (
21
+ team_id TEXT NOT NULL, operation_id TEXT NOT NULL, kind TEXT NOT NULL,
22
+ intent_hash TEXT NOT NULL, receipt TEXT NOT NULL, PRIMARY KEY (team_id,operation_id)
23
+ );
24
+ CREATE TABLE IF NOT EXISTS local_experiment_executions (
25
+ team_id TEXT NOT NULL, id TEXT NOT NULL, definition_id TEXT NOT NULL, definition_revision INTEGER NOT NULL,
26
+ owner_id TEXT NOT NULL, payload TEXT NOT NULL, PRIMARY KEY (team_id,id)
27
+ );
28
+ CREATE TABLE IF NOT EXISTS local_experiment_cases (
29
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, receipt_id TEXT NOT NULL, ordinal INTEGER NOT NULL,
30
+ status TEXT NOT NULL, admission TEXT NOT NULL, result TEXT, error TEXT,
31
+ PRIMARY KEY (team_id,execution_id,receipt_id), UNIQUE (team_id,execution_id,ordinal),
32
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
33
+ );
34
+ CREATE TABLE IF NOT EXISTS local_experiment_configurations (
35
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, payload TEXT NOT NULL, package_payload TEXT NOT NULL,
36
+ PRIMARY KEY(team_id,execution_id),
37
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
38
+ );
39
+ CREATE TABLE IF NOT EXISTS local_experiment_charges (
40
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, request_id TEXT NOT NULL, case_id TEXT NOT NULL,
41
+ maximum_usd REAL NOT NULL CHECK(maximum_usd >= 0), cost_usd REAL CHECK(cost_usd >= 0),
42
+ status TEXT NOT NULL, usage TEXT,
43
+ PRIMARY KEY(team_id,execution_id,request_id),
44
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
45
+ );
46
+ CREATE TABLE IF NOT EXISTS local_experiment_scoring_selections (
47
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, source_execution_id TEXT NOT NULL,
48
+ package_payload TEXT NOT NULL, graders TEXT NOT NULL,
49
+ PRIMARY KEY(team_id,execution_id),
50
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
51
+ );
52
+ CREATE TABLE IF NOT EXISTS local_experiment_judge_budgets (
53
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, calls TEXT NOT NULL,
54
+ PRIMARY KEY(team_id,execution_id),
55
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
56
+ );
57
+ CREATE TABLE IF NOT EXISTS local_experiment_events (
58
+ sequence INTEGER PRIMARY KEY AUTOINCREMENT, team_id TEXT NOT NULL, execution_id TEXT NOT NULL,
59
+ case_id TEXT NOT NULL, type TEXT NOT NULL, payload TEXT NOT NULL,
60
+ FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
61
+ );
62
+ CREATE TABLE IF NOT EXISTS local_experiment_trace_budgets (
63
+ team_id TEXT NOT NULL, execution_id TEXT NOT NULL, event_count INTEGER NOT NULL, byte_count INTEGER NOT NULL,
64
+ PRIMARY KEY(team_id,execution_id), FOREIGN KEY (team_id,execution_id) REFERENCES local_experiment_executions(team_id,id)
65
+ );
66
+ CREATE INDEX IF NOT EXISTS local_experiment_case_events ON local_experiment_events(team_id,execution_id,case_id,sequence);
67
+ CREATE INDEX IF NOT EXISTS local_experiment_definition_project ON local_experiment_definitions(team_id,project_id,id);
68
+ CREATE INDEX IF NOT EXISTS local_experiment_execution_definition ON local_experiment_executions(team_id,definition_id,id);
69
+ `;import{randomUUID as oe}from"node:crypto";var C=I.string().regex(/^[a-f0-9]{64}$/),H=I.object({scopeHash:C,action:I.string().trim().min(1).max(100),intentHash:C}).strict(),$=F.options,G=`CREATE TABLE IF NOT EXISTS evaluation_operation_intents (
70
+ scope_hash TEXT NOT NULL,action TEXT NOT NULL,intent_hash TEXT NOT NULL,
71
+ operation_id TEXT NOT NULL,created_at TEXT NOT NULL,acknowledged_at TEXT,
72
+ PRIMARY KEY(scope_hash,action,intent_hash)
73
+ );
74
+ CREATE TABLE IF NOT EXISTS evaluation_operation_reviewed_payloads (
75
+ scope_hash TEXT NOT NULL,action TEXT NOT NULL,intent_hash TEXT NOT NULL,
76
+ operation_id TEXT NOT NULL,payload TEXT NOT NULL,command TEXT,phase TEXT NOT NULL,
77
+ PRIMARY KEY(scope_hash,action,intent_hash)
78
+ );
79
+ CREATE TABLE IF NOT EXISTS evaluation_operation_acknowledged_history (
80
+ scope_hash TEXT NOT NULL,action TEXT NOT NULL,intent_hash TEXT NOT NULL,
81
+ operation_id TEXT PRIMARY KEY,created_at TEXT NOT NULL,acknowledged_at TEXT NOT NULL,
82
+ payload TEXT,command TEXT,phase TEXT
83
+ );`;function U(s,e){let t=[e.scopeHash,e.action,e.intentHash,e.id];return s.get("SELECT i.operation_id,i.created_at,i.acknowledged_at,p.payload,p.command,p.phase FROM evaluation_operation_intents i LEFT JOIN evaluation_operation_reviewed_payloads p USING(scope_hash,action,intent_hash,operation_id) WHERE i.scope_hash=? AND i.action=? AND i.intent_hash=? AND i.operation_id=?",t)??s.get("SELECT operation_id,created_at,acknowledged_at,payload,command,phase FROM evaluation_operation_acknowledged_history WHERE scope_hash=? AND action=? AND intent_hash=? AND operation_id=?",t)}_(U,"retainedRow");function K(s,e,t){s.run("INSERT OR IGNORE INTO evaluation_operation_acknowledged_history(scope_hash,action,intent_hash,operation_id,created_at,acknowledged_at,payload,command,phase) SELECT i.scope_hash,i.action,i.intent_hash,i.operation_id,i.created_at,i.acknowledged_at,p.payload,p.command,p.phase FROM evaluation_operation_intents i LEFT JOIN evaluation_operation_reviewed_payloads p USING(scope_hash,action,intent_hash,operation_id) WHERE i.scope_hash=? AND i.action=? AND i.intent_hash=? AND i.operation_id=? AND i.acknowledged_at IS NOT NULL",[e.scopeHash,e.action,e.intentHash,t])}_(K,"archiveAcknowledged");function V(s){return s==="training:prepare-modification"||s==="training:start-modification"||s==="training:cancel-modification"}_(V,"activationOperation");function b(s,e){let t=JSON.stringify(s),i=V(e)?1064960:1048576;if(t===void 0||Buffer.byteLength(t,"utf8")>i)throw new Error("Reviewed operation payload exceeds its bounded journal limit.");return t}_(b,"bounded");function k(s){if(!$.some(e=>e===s))throw new Error("This action does not admit recoverable reviewed payloads.")}_(k,"retainable");function Q(s,e){let t=H.parse({scopeHash:e.scopeHash,action:e.action,intentHash:e.intentHash}),i;if(e.reviewedIntent!==void 0){if(k(t.action),d(e.reviewedIntent)!==t.intentHash)throw new Error("Reviewed intent changed its exact hash.");i=b(e.reviewedIntent,t.action)}let n=s.get("SELECT operation_id,created_at,acknowledged_at FROM evaluation_operation_intents WHERE scope_hash=? AND action=? AND intent_hash=?",[t.scopeHash,t.action,t.intentHash]);if((!n||n.acknowledged_at)&&$.some(r=>r===t.action)&&s.get("SELECT i.operation_id FROM evaluation_operation_intents i LEFT JOIN evaluation_operation_reviewed_payloads p USING(scope_hash,action,intent_hash,operation_id) WHERE i.scope_hash=? AND i.action=? AND i.acknowledged_at IS NULL AND (p.phase='dispatching' OR p.payload IS NULL) LIMIT 1",[t.scopeHash,t.action]))throw new Error("Recover the original uncertain operation before preparing another reviewed intent.");let a=n&&!n.acknowledged_at?n.operation_id:oe(),o=n&&!n.acknowledged_at?n.created_at:new Date().toISOString();if((!n||n.acknowledged_at)&&(n?.acknowledged_at&&K(s,t,n.operation_id),s.run("INSERT INTO evaluation_operation_intents(scope_hash,action,intent_hash,operation_id,created_at) VALUES(?,?,?,?,?) ON CONFLICT(scope_hash,action,intent_hash) DO UPDATE SET operation_id=excluded.operation_id,created_at=excluded.created_at,acknowledged_at=NULL",[t.scopeHash,t.action,t.intentHash,a,o]),s.run("DELETE FROM evaluation_operation_reviewed_payloads WHERE scope_hash=? AND action=? AND intent_hash=?",[t.scopeHash,t.action,t.intentHash])),i!==void 0){let r=s.get("SELECT operation_id,payload FROM evaluation_operation_reviewed_payloads WHERE scope_hash=? AND action=? AND intent_hash=?",[t.scopeHash,t.action,t.intentHash]);if(r&&(r.operation_id!==a||d(JSON.parse(r.payload))!==t.intentHash))throw new Error("The retained reviewed payload belongs to another exact operation.");r||s.run("INSERT INTO evaluation_operation_reviewed_payloads(scope_hash,action,intent_hash,operation_id,payload,phase) VALUES(?,?,?,?,?,'reviewed')",[t.scopeHash,t.action,t.intentHash,a,i])}return{id:a,createdAt:o}}_(Q,"prepareEvaluationOperation");function z(s,e){k(e.action);let t=H.parse({scopeHash:e.scopeHash,action:e.action,intentHash:e.intentHash}),i=b(e.command,e.action),n=U(s,{...t,id:e.id});if(!n?.payload||d(JSON.parse(n.payload))!==t.intentHash)throw new Error("The reviewed command requires its exact retained operation.");if(n.command&&d(JSON.parse(n.command))!==d(e.command))throw new Error("The reviewed command is immutable.");if(Buffer.byteLength(n.payload,"utf8")+Buffer.byteLength(i,"utf8")>(V(t.action)?2129920:1048576))throw new Error("Reviewed intent and command exceed the bounded journal limit.");let a=n.phase==="dispatching"?"dispatching":e.phase;if(n.acknowledged_at){if(!n.command||n.phase!=="dispatching")throw new Error("The original reviewed command was discarded before dispatch.");return{retained:!0,phase:n.phase??a}}return s.run("UPDATE evaluation_operation_reviewed_payloads SET command=?,phase=? WHERE scope_hash=? AND action=? AND intent_hash=? AND operation_id=?",[i,a,t.scopeHash,t.action,t.intentHash,e.id]),{retained:!0,phase:a}}_(z,"retainEvaluationOperation");function Z(s,e){k(e.action);let t=C.parse(e.scopeHash),i=I.number().int().min(1).max(100).parse(e.limit??100),n=s.all("SELECT i.operation_id,i.intent_hash,i.created_at,p.payload,p.command,p.phase FROM evaluation_operation_intents i LEFT JOIN evaluation_operation_reviewed_payloads p USING(scope_hash,action,intent_hash,operation_id) WHERE i.scope_hash=? AND i.action=? AND i.acknowledged_at IS NULL AND i.operation_id>? ORDER BY i.operation_id LIMIT ?",[t,e.action,e.cursor??"",i]);return{items:n.map(a=>({id:a.operation_id,action:e.action,intentHash:a.intent_hash,createdAt:a.created_at,reviewedIntent:a.payload?JSON.parse(a.payload):null,command:a.command?JSON.parse(a.command):null,phase:a.phase,recoveryReady:!!(a.payload&&a.command)})),nextCursor:n.length===i?n.at(-1).operation_id:null}}_(Z,"pendingEvaluationOperations");function ee(s,e){let t=U(s,e);if(!t?.payload||!t.phase)throw new Error("The original reviewed operation payload is unavailable; recover its actual canonical receipt.");let i=JSON.parse(t.payload);if(d(i)!==e.intentHash)throw new Error("Retained reviewed intent hash changed.");return{reviewedIntent:i,command:t.command?JSON.parse(t.command):null,phase:t.phase}}_(ee,"readPendingEvaluationOperation");function te(s,e){let t=H.parse({scopeHash:e.scopeHash,action:e.action,intentHash:e.intentHash}),i=U(s,{...t,id:e.id});if(!i)throw new Error("This acknowledgement does not own the retained operation intent.");if(e.expectedPhase&&i.phase!==e.expectedPhase)throw new Error("The reviewed command crossed dispatch; recover its canonical receipt before acknowledgement.");return i.acknowledged_at?{acknowledged:!0}:(s.run("UPDATE evaluation_operation_intents SET acknowledged_at=COALESCE(acknowledged_at,?) WHERE scope_hash=? AND action=? AND intent_hash=? AND operation_id=?",[new Date().toISOString(),t.scopeHash,t.action,t.intentHash,e.id]),K(s,t,e.id),{acknowledged:!0})}_(te,"acknowledgeEvaluationOperation");function q(s,e){if(e.kind!=="target")throw new c("local_experiment_not_found","This id names a scoring pass, not an Experiment.",404);let t=s.get("SELECT payload,package_payload FROM local_experiment_configurations WHERE team_id=? AND execution_id=?",[e.teamId,e.id]);if(t){let p=O.parse(JSON.parse(t.payload)),T=L(JSON.parse(t.package_payload));if(p.packageHash!==T.contentHash||p.packageHash!==e.packageHash)throw new c("local_package_pin_conflict","The retained Experiment package differs from its admission.");return{snapshot:p,package:T}}let i=N(s,e.teamId,e.definition.id,e.definition.revision),n=i.definition,a=L(i.package),{contentHash:o,...r}=n;if(d(r)!==o)throw new c("local_configuration_pin_conflict","The retained configuration bytes differ from their sealed hash.");if(n.contentHash!==e.definition.contentHash||n.ownerActorId!==e.ownerActorId||n.teamId!==e.teamId||n.packageHash!==e.packageHash||a.contentHash!==e.packageHash)throw new c("local_configuration_pin_conflict","The retained Experiment configuration differs from its owner or immutable admission.");let m=n.configuration,g={configuration:{operationId:e.operationId,request:{...m.request,operationId:e.operationId},maximumCostUsd:m.maximumCostUsd,...m.graders?{graders:m.graders}:{}},model:n.model,packageHash:n.packageHash,graders:n.graders,availableGraders:n.availableGraders,retainedConfigurationHash:n.contentHash},l=O.parse({...g,configurationHash:d(g)});return X(s,e,l,a),{snapshot:l,package:a}}_(q,"localFlatSnapshot");function X(s,e,t,i){s.run("INSERT INTO local_experiment_configurations(team_id,execution_id,payload,package_payload) VALUES(?,?,?,?)",[e.teamId,e.id,JSON.stringify(t),JSON.stringify(i)])}_(X,"writeLocalFlatSnapshot");function S(s,e,t){let i=u(s,e,t),{snapshot:n}=q(s,i),{definition:a,...o}=i;return W.parse({...o,...n})}_(S,"localFlatRecord");var ie=class extends M{static{_(this,"SqliteLocalExperimentStore")}localTablesReady=!1;async localWrite(e){await this.ready;let t=this.writeQueue.then(()=>{let i=this.database;this.localTablesReady||(i.exec(B),i.exec(G),this.localTablesReady=!0),i.exec("BEGIN IMMEDIATE");try{let n=e(i);return i.exec("COMMIT"),n}catch(n){throw i.exec("ROLLBACK"),n}});return this.writeQueue=t.then(()=>{},()=>{}),t}async prepareEvaluationOperation(e){return this.localWrite(t=>Q(t,e))}async retainEvaluationOperation(e){return this.localWrite(t=>z(t,e))}async readPendingEvaluationOperation(e){return this.localWrite(t=>ee(t,e))}async pendingEvaluationOperations(e){return this.localWrite(t=>Z(t,e))}async acknowledgeEvaluationOperation(e){return this.localWrite(t=>te(t,e))}async claimLocalExperimentOwner(e,t=process.pid){return this.localWrite(i=>P(i,e,t))}async renewLocalExperimentOwner(e){return this.localWrite(t=>j(t,e))}async releaseLocalExperimentOwner(e){return this.localWrite(t=>t.run("DELETE FROM local_experiment_owner WHERE singleton=1 AND owner_id=?",[e]))}async saveLocalExperiment(e){let t=f.parse(e.definition);return this.localWrite(i=>w(i,t.teamId,e.operationId,"save",e.intentHash,()=>{let n=i.get("SELECT MAX(revision) AS revision FROM local_experiment_definitions WHERE team_id=? AND id=?",[t.teamId,t.id]);if(n?.revision&&N(i,t.teamId,t.id).definition.ownerActorId!==t.ownerActorId)throw new c("local_resource_denied","This local resource belongs to another account.",404);if((n?.revision??0)!==e.expectedRevision||t.revision!==e.expectedRevision+1)throw new c("local_definition_revision_conflict","The Experiment changed. Reload its saved revision before editing.");return v(i,t,e.package),t}))}async readLocalExperiment(e,t,i){return this.localWrite(n=>N(n,e,t,i))}async recoverLocalExperimentOperation(e,t,i,n){return this.localWrite(a=>{let o=a.get("SELECT kind,intent_hash,receipt FROM local_experiment_operations WHERE team_id=? AND operation_id=?",[e,t]);if(!o)return null;if(o.kind!==i||o.intent_hash!==n)throw new c("local_operation_conflict","This operation already owns different immutable inputs.");return JSON.parse(o.receipt)})}async listLocalExperiments(e){return this.localWrite(t=>{let i=t.all(`SELECT d.payload FROM local_experiment_definitions d WHERE d.team_id=? AND json_extract(d.payload,'$.ownerActorId')=?
84
+ AND d.revision=(SELECT MAX(revision) FROM local_experiment_definitions v WHERE v.team_id=d.team_id AND v.id=d.id)
85
+ ${e.projectId?"AND d.project_id=?":""} ${e.afterId?"AND d.id>?":""} ORDER BY d.id LIMIT ?`,[e.teamId,e.ownerActorId,...e.projectId?[e.projectId]:[],...e.afterId?[e.afterId]:[],e.limit+1]),n=i.slice(0,e.limit).map(a=>f.parse(JSON.parse(a.payload)));return{items:n,nextCursor:i.length>e.limit?n.at(-1).id:null}})}async listLocalExecutionHistory(e){return this.localWrite(t=>{let i=t.all(`SELECT e.payload AS execution,d.payload AS definition,e.id FROM local_experiment_executions e
86
+ JOIN local_experiment_definitions d ON d.team_id=e.team_id AND d.id=e.definition_id AND d.revision=e.definition_revision
87
+ WHERE e.team_id=? AND json_extract(e.payload,'$.ownerActorId')=?
88
+ ${e.projectId?"AND d.project_id=?":""} ${e.afterId?"AND e.id>?":""} ORDER BY e.id LIMIT ?`,[e.teamId,e.ownerActorId,...e.projectId?[e.projectId]:[],...e.afterId?[e.afterId]:[],e.limit+1]),n=i.slice(0,e.limit).map(a=>({execution:h.parse(JSON.parse(a.execution)),definition:f.parse(JSON.parse(a.definition))}));return{items:n,nextCursor:i.length>e.limit?n.at(-1).execution.id:null}})}async startLocalExperiment(e){return this.localWrite(t=>w(t,e.execution.teamId,e.operationId,"start",e.intentHash,()=>{x(t,e.ownerId);let i=h.parse(e.execution),n=i.definition,a=N(t,i.teamId,n.id,n.revision).definition;if(a.ownerActorId!==i.ownerActorId)throw new c("local_resource_denied","This local resource belongs to another account.",404);if(a.contentHash!==n.contentHash||a.packageHash!==i.packageHash||a.configuration.maximumCostUsd!==i.maximumCostUsd)throw new c("local_definition_pin_conflict","Execution requires its exact retained definition and package.");if(!e.admissions.length||e.admissions.length!==i.counts.pending||new Set(e.admissions.map(o=>o.receiptId)).size!==e.admissions.length)throw new c("local_population_conflict","Execution admissions must cover the exact unique population.");return t.run("INSERT INTO local_experiment_executions(team_id,id,definition_id,definition_revision,owner_id,payload) VALUES(?,?,?,?,?,?)",[i.teamId,i.id,n.id,n.revision,e.ownerId,JSON.stringify(i)]),e.admissions.forEach((o,r)=>t.run("INSERT INTO local_experiment_cases(team_id,execution_id,receipt_id,ordinal,status,admission) VALUES(?,?,?,?,?,?)",[i.teamId,i.id,o.receiptId,r,"pending",JSON.stringify(o)])),i}))}async admitLocalExperimentRun(e){let t=D(),i=_(n=>w(n,e.execution.teamId,e.execution.operationId,"run",e.intentHash,()=>{x(n,e.ownerId);let a=h.parse(e.execution),o=f.parse(e.definition),r=O.parse(e.snapshot),m=a.definition,g=L(e.package),{contentHash:l,...p}=o,{sourceExperimentId:T,...ne}=r.configuration;if(a.kind!=="target"||o.ownerActorId!==a.ownerActorId||o.teamId!==a.teamId||d(p)!==l||d({...ne,expectedRevision:0})!==d(o.configuration)||o.id!==m.id||o.revision!==m.revision||o.contentHash!==m.contentHash||g.contentHash!==r.packageHash||r.packageHash!==a.packageHash||r.configuration.maximumCostUsd!==a.maximumCostUsd||r.configuration.operationId!==a.operationId||r.configuration.request.teamId!==a.teamId||d(r.model)!==d(o.model)||d(r.graders)!==d(o.graders))throw new c("local_configuration_pin_conflict","The local run requires its exact sealed configuration and owner.");if(!e.admissions.length||e.admissions.length!==a.counts.pending||new Set(e.admissions.map(A=>A.receiptId)).size!==e.admissions.length)throw new c("local_population_conflict","The run admissions must cover the exact unique population.");return v(n,o,e.package),n.run("INSERT INTO local_experiment_executions(team_id,id,definition_id,definition_revision,owner_id,payload) VALUES(?,?,?,?,?,?)",[a.teamId,a.id,m.id,m.revision,e.ownerId,JSON.stringify(a)]),X(n,a,r,e.package),e.admissions.forEach((A,ae)=>n.run("INSERT INTO local_experiment_cases(team_id,execution_id,receipt_id,ordinal,status,admission) VALUES(?,?,?,?,?,?)",[a.teamId,a.id,A.receiptId,ae,"pending",JSON.stringify(A)])),S(n,a.teamId,a.id)}),"apply");return this.localWrite(n=>{let a=n.get("SELECT receipt FROM local_experiment_operations WHERE team_id=? AND operation_id=? AND kind='run'",[e.execution.teamId,e.execution.operationId]);return t&&!a?t.withAdmission(()=>i(n)):i(n)})}async findLocalExperimentRunOperation(e,t){return this.localWrite(i=>{let n=i.get("SELECT receipt FROM local_experiment_operations WHERE team_id=? AND operation_id=? AND kind='run'",[e,t]);if(!n)return null;let a=JSON.parse(n.receipt);return S(i,e,a.id)})}async readLocalExperimentRecord(e,t){return this.localWrite(i=>S(i,e,t))}async readLocalExperimentSnapshot(e,t){return this.localWrite(i=>q(i,u(i,e,t)))}async readExecutionActivity(e){if(!e.actorId.trim()||!e.teamId.trim())throw new c("local_activity_scope_missing","Activity requires a signed-in workspace owner.",403);return this.localWrite(t=>Y(t,{...e,limit:Math.min(100,Math.max(1,e.limit??100))}))}async listLocalExperimentRecords(e){return this.localWrite(t=>{let i=t.all(`SELECT e.id FROM local_experiment_executions e
89
+ LEFT JOIN local_experiment_configurations c ON c.team_id=e.team_id AND c.execution_id=e.id
90
+ JOIN local_experiment_definitions d ON d.team_id=e.team_id AND d.id=e.definition_id AND d.revision=e.definition_revision
91
+ WHERE e.team_id=? AND json_extract(e.payload,'$.ownerActorId')=? AND json_extract(e.payload,'$.kind')='target'
92
+ ${e.projectId?"AND COALESCE(json_extract(c.payload,'$.configuration.request.project.id'),json_extract(d.payload,'$.configuration.request.project.id'))=?":""}
93
+ ${e.status?"AND json_extract(e.payload,'$.status')=?":""}
94
+ ${e.datasetHash?"AND COALESCE(json_extract(c.payload,'$.configuration.request.taskset.contentHash'),json_extract(d.payload,'$.configuration.request.taskset.contentHash'))=?":""}
95
+ ${e.search?"AND instr(lower(COALESCE(json_extract(c.payload,'$.configuration.request.name'),json_extract(d.payload,'$.configuration.request.name'))),lower(?))>0":""}
96
+ ${e.afterId?"AND e.id>?":""} ORDER BY e.id LIMIT ?`,[e.teamId,e.ownerActorId,...e.projectId?[e.projectId]:[],...e.status?[e.status]:[],...e.datasetHash?[e.datasetHash]:[],...e.search?[e.search]:[],...e.afterId?[e.afterId]:[],e.limit+1]),n=i.slice(0,e.limit).map(a=>S(t,e.teamId,a.id));return{items:n,nextCursor:i.length>e.limit?n.at(-1).id:null}})}async readLocalExecution(e,t){return this.localWrite(i=>({execution:u(i,e,t),cases:R(i,e,t)}))}async readLocalExecutionCharges(e,t){return this.localWrite(i=>(u(i,e,t),i.all("SELECT request_id,case_id,status,maximum_usd,cost_usd,usage FROM local_experiment_charges WHERE team_id=? AND execution_id=? ORDER BY request_id",[e,t]).map(n=>({requestId:n.request_id,caseId:n.case_id,status:n.status,maximumUsd:n.maximum_usd,costUsd:n.cost_usd,usage:n.usage?JSON.parse(n.usage):null}))))}async appendLocalExperimentEvent(e){return this.localWrite(t=>{this.requireLocalOwner(t,e.teamId,e.id,e.ownerId);let i=JSON.stringify(e.payload),n=Buffer.byteLength(i),a=t.get("SELECT event_count,byte_count FROM local_experiment_trace_budgets WHERE team_id=? AND execution_id=?",[e.teamId,e.id]);if(n>2097152||(a?.event_count??0)>=2e4||(a?.byte_count??0)+n>67108864)throw new c("local_trace_limit_exceeded","The execution exceeded its bounded retained trace budget.",422);if(!t.get("SELECT receipt_id FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.teamId,e.id,e.caseId]))throw new c("local_trace_case_conflict","Trace evidence must belong to an admitted case.");t.run("INSERT INTO local_experiment_events(team_id,execution_id,case_id,type,payload) VALUES(?,?,?,?,?)",[e.teamId,e.id,e.caseId,e.type,i]),t.run("INSERT INTO local_experiment_trace_budgets(team_id,execution_id,event_count,byte_count) VALUES(?,?,1,?) ON CONFLICT(team_id,execution_id) DO UPDATE SET event_count=event_count+1,byte_count=byte_count+excluded.byte_count",[e.teamId,e.id,n])})}async localExperimentTrace(e){return this.localWrite(t=>{if(u(t,e.teamId,e.id),!t.get("SELECT receipt_id FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.teamId,e.id,e.caseId]))throw new c("local_case_not_found","This retained case does not belong to the execution.",404);let n=t.all("SELECT sequence,type,payload FROM local_experiment_events WHERE team_id=? AND execution_id=? AND case_id=? AND sequence>? ORDER BY sequence LIMIT ?",[e.teamId,e.id,e.caseId,e.afterSequence??0,e.limit+1]),a=n.slice(0,e.limit).map(o=>({sequence:o.sequence,type:o.type,payload:JSON.parse(o.payload)}));return{items:a,nextCursor:n.length>e.limit?a.at(-1).sequence:null}})}async localExperimentDiagnosticTrace(e){return this.localWrite(t=>{u(t,e.teamId,e.id);let i=t.all("SELECT sequence,case_id,type,payload FROM local_experiment_events WHERE team_id=? AND execution_id=? AND sequence>? ORDER BY sequence LIMIT 101",[e.teamId,e.id,e.afterSequence??-1]),n=t.get("SELECT count(*) AS count FROM local_experiment_events WHERE team_id=? AND execution_id=?",[e.teamId,e.id]).count,a=new Map(R(t,e.teamId,e.id).map(o=>[o.admission.receiptId,o.admission.taskId]));return{items:i.slice(0,100).map(o=>({...o,taskId:a.get(o.case_id)??null,payload:JSON.parse(o.payload)})),count:n,nextCursor:i.length>100?i[99].sequence:null}})}async startLocalScoringPass(e){return this.localWrite(t=>w(t,e.execution.teamId,e.operationId,"score",e.intentHash,()=>{x(t,e.ownerId);let i=h.parse(e.execution),n=i.sourceExecution;if(i.kind!=="scoring"||!n)throw new c("local_scoring_source_missing","A scoring pass requires an exact original execution.");let a=u(t,i.teamId,n.id);if(a.ownerActorId!==i.ownerActorId)throw new c("local_resource_denied","This local resource belongs to another account.",404);if(a.executionHash!==n.executionHash||a.kind!=="target"||!a.completedAt||!a.cleanupComplete)throw new c("local_scoring_source_unavailable","Retained grading requires a terminal original execution with confirmed cleanup.");if(i.packageHash!==a.packageHash||d(i.definition)!==d(a.definition))throw new c("local_scoring_pin_conflict","The scoring pass changed original execution pins.");let o=R(t,i.teamId,a.id);if(d(e.admissions)!==d(o.map(r=>r.admission)))throw new c("local_scoring_population_conflict","A scoring pass must cover the complete retained original population.");return t.run("INSERT INTO local_experiment_executions(team_id,id,definition_id,definition_revision,owner_id,payload) VALUES(?,?,?,?,?,?)",[i.teamId,i.id,i.definition.id,i.definition.revision,e.ownerId,JSON.stringify(i)]),t.run("INSERT INTO local_experiment_scoring_selections(team_id,execution_id,source_execution_id,package_payload,graders) VALUES(?,?,?,?,?)",[i.teamId,i.id,a.id,JSON.stringify(e.package),JSON.stringify(e.graders)]),e.admissions.forEach((r,m)=>t.run("INSERT INTO local_experiment_cases(team_id,execution_id,receipt_id,ordinal,status,admission) VALUES(?,?,?,?,?,?)",[i.teamId,i.id,r.receiptId,m,"pending",JSON.stringify(r)])),i}))}async readLocalScoringSelection(e,t){return this.localWrite(i=>{u(i,e,t);let n=i.get("SELECT package_payload,graders,source_execution_id FROM local_experiment_scoring_selections WHERE team_id=? AND execution_id=?",[e,t]);if(!n)throw new c("local_scoring_not_found","This execution is not a scoring pass.",404);return{package:JSON.parse(n.package_payload),graders:JSON.parse(n.graders),sourceExecutionId:n.source_execution_id}})}async localJudgeBudgetTransaction(e,t){return this.localWrite(i=>{this.requireLocalOwner(i,e.teamId,e.id,e.ownerId);let n=u(i,e.teamId,e.id);if(e.intent==="dispatch"){this.requireLocalChargeBounds(i,e.teamId,e.id);let l=i.get("SELECT status FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.teamId,e.id,e.caseId]);if(n.status!=="running"||l?.status!=="running")throw new c("local_grading_owner_inactive","Only an admitted running grader may reserve a judge call.")}let a=i.get("SELECT calls FROM local_experiment_judge_budgets WHERE team_id=? AND execution_id=?",[e.teamId,e.id]),o=a?y.array().parse(JSON.parse(a.calls)):[],r=i.get(`SELECT COALESCE(SUM(CASE WHEN status='settled' THEN cost_usd WHEN status IN ('reserved','dispatched','unknown') THEN maximum_usd ELSE 0 END),0) AS spent
97
+ FROM local_experiment_charges WHERE team_id=? AND execution_id=? AND request_id NOT IN (SELECT json_extract(value,'$.id') FROM json_each(?))`,[e.teamId,e.id,JSON.stringify(o)]).spent,m=t({maximumSpendUsd:Math.max(0,n.maximumCostUsd-r),calls:o}),g=y.array().parse(m.calls);for(let l of o){let p=g.find(T=>T.id===l.id);if(!p||p.requestHash!==l.requestHash||p.reservedUsd!==l.reservedUsd||l.status!=="reserved"&&d(l)!==d(p))throw new c("local_judge_receipt_conflict","Retained judge reservations and receipts are immutable.")}i.run("INSERT INTO local_experiment_judge_budgets(team_id,execution_id,calls) VALUES(?,?,?) ON CONFLICT(team_id,execution_id) DO UPDATE SET calls=excluded.calls",[e.teamId,e.id,JSON.stringify(g)]);for(let l of g){let p=l.status==="not_dispatched"?"released":l.response?.costUsd!==null&&l.response?.costUsd!==void 0?"settled":"unknown";i.run("INSERT INTO local_experiment_charges(team_id,execution_id,request_id,case_id,maximum_usd,cost_usd,status,usage) VALUES(?,?,?,?,?,?,?,?) ON CONFLICT(team_id,execution_id,request_id) DO UPDATE SET cost_usd=excluded.cost_usd,status=excluded.status,usage=excluded.usage",[e.teamId,e.id,l.id,e.caseId,l.reservedUsd,l.response?.costUsd??null,p,l.response?JSON.stringify(l.response):null])}return E(i,e.teamId,e.id),m.result})}async listLocalExecutions(e,t,i,n){return this.localWrite(a=>{let o=a.all(`SELECT payload FROM local_experiment_executions WHERE team_id=? AND definition_id=? AND json_extract(payload,'$.kind')='target' ${i?"AND id>?":""} ORDER BY id LIMIT ?`,[e,t,...i?[i]:[],n+1]),r=o.slice(0,n).map(m=>h.parse(JSON.parse(m.payload)));return{items:r,nextCursor:o.length>n?r.at(-1).id:null}})}async listLocalScoringPasses(e,t,i,n){return this.localWrite(a=>{let o=a.all(`SELECT e.payload FROM local_experiment_executions e JOIN local_experiment_scoring_selections s ON s.team_id=e.team_id AND s.execution_id=e.id WHERE e.team_id=? AND s.source_execution_id=? ${i?"AND e.id>?":""} ORDER BY e.id LIMIT ?`,[e,t,...i?[i]:[],n+1]),r=o.slice(0,n).map(m=>h.parse(JSON.parse(m.payload)));return{items:r,nextCursor:o.length>n?r.at(-1).id:null}})}async admitLocalCase(e,t,i,n){return this.localWrite(a=>{this.requireLocalOwner(a,e,t,n);let o=u(a,e,t);if(!["queued","running"].includes(o.status))return!1;let r=a.get("SELECT status FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e,t,i]);return!r||r.status!=="pending"?!1:(a.run("UPDATE local_experiment_cases SET status='running' WHERE team_id=? AND execution_id=? AND receipt_id=?",[e,t,i]),E(a,e,t,{status:"running"}),!0)})}async settleLocalCase(e){return this.localWrite(t=>{if(this.requireLocalOwner(t,e.teamId,e.id,e.ownerId),t.get("SELECT status FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.teamId,e.id,e.receiptId])?.status!=="running")throw new c("local_case_not_owned","Only the admitted case owner may seal retained output.");return t.run("UPDATE local_experiment_cases SET status=?,result=?,error=? WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.status,e.result===null?null:JSON.stringify(e.result),e.error,e.teamId,e.id,e.receiptId]),E(t,e.teamId,e.id)})}async cancelLocalExecution(e,t){return this.localWrite(i=>{let n=u(i,e,t);return["queued","running","cancelling"].includes(n.status)?(i.run("UPDATE local_experiment_cases SET status='cancelled' WHERE team_id=? AND execution_id=? AND status='pending'",[e,t]),E(i,e,t,{status:"cancelling"})):n})}async finishLocalExecution(e,t,i,n=null,a=!0){return this.localWrite(o=>{this.requireLocalOwner(o,e,t,i);let r=E(o,e,t);if(r.counts.running)throw new c("local_cleanup_pending","Wait for active case transport cleanup before sealing execution.");return r.counts.pending&&o.run("UPDATE local_experiment_cases SET status='cancelled' WHERE team_id=? AND execution_id=? AND status='pending'",[e,t]),r=E(o,e,t),E(o,e,t,{status:r.status==="cancelling"&&a?"cancelled":n||r.counts.failed||r.counts.unknown||!a?"failed":"completed",completedAt:new Date().toISOString(),cleanupComplete:a,error:n})})}async recoverLocalExperiments(e){return this.localWrite(t=>{x(t,e);let i=t.all("SELECT team_id,id FROM local_experiment_executions WHERE owner_id<>?",[e]),n=[];for(let a of i){let o=u(t,a.team_id,a.id);["queued","running","cancelling"].includes(o.status)&&(t.run("UPDATE local_experiment_cases SET status=CASE WHEN status='running' THEN 'unknown' ELSE 'cancelled' END,error='local_process_interrupted' WHERE team_id=? AND execution_id=? AND status IN ('pending','running')",[a.team_id,a.id]),t.run("UPDATE local_experiment_charges SET status='unknown' WHERE team_id=? AND execution_id=? AND status IN ('reserved','dispatched')",[a.team_id,a.id]),n.push(E(t,a.team_id,a.id,{status:"interrupted",completedAt:new Date().toISOString(),cleanupComplete:!1,error:"The previous process ended. Admitted calls and uncertain charges were retained; start a new execution explicitly."})))}return n})}async reserveLocalCharge(e){return this.localWrite(t=>{if(this.requireLocalOwner(t,e.teamId,e.id,e.ownerId),this.requireLocalChargeBounds(t,e.teamId,e.id),!Number.isFinite(e.maximumUsd)||e.maximumUsd<=0)throw new c("local_charge_bound_unknown","An enforceable positive model charge ceiling is required.",422);let i=E(t,e.teamId,e.id);if(i.status!=="running")throw new c("local_execution_not_running","The execution no longer accepts model dispatch.");if(t.get("SELECT status FROM local_experiment_cases WHERE team_id=? AND execution_id=? AND receipt_id=?",[e.teamId,e.id,e.caseId])?.status!=="running")throw new c("local_case_not_admitted","Model reservation requires an owned running case.");if(t.get("SELECT request_id FROM local_experiment_charges WHERE team_id=? AND execution_id=? AND request_id=?",[e.teamId,e.id,e.requestId]))throw new c("local_dispatch_already_admitted","This target request was already admitted and cannot be replayed.");if(i.usage.knownCostUsd+i.usage.heldUsd+e.maximumUsd>i.maximumCostUsd+1e-12)throw new c("experiment_budget_exhausted","The local ceiling cannot cover this model's maximum accepted request charge.",422);t.run("INSERT INTO local_experiment_charges(team_id,execution_id,request_id,case_id,maximum_usd,status) VALUES(?,?,?,?,?,'reserved')",[e.teamId,e.id,e.requestId,e.caseId,e.maximumUsd]),E(t,e.teamId,e.id)})}async markLocalChargeDispatched(e,t,i,n){let a=D();return this.localWrite(o=>{if(a?.assertExecution(t),this.requireLocalOwner(o,e,t,n),o.get("SELECT status FROM local_experiment_charges WHERE team_id=? AND execution_id=? AND request_id=?",[e,t,i])?.status!=="reserved")throw new c("local_dispatch_not_reserved","Target dispatch requires a fresh durable reservation.");o.run("UPDATE local_experiment_charges SET status='dispatched' WHERE team_id=? AND execution_id=? AND request_id=?",[e,t,i]),E(o,e,t)})}async settleLocalCharge(e){let t=await this.localWrite(i=>{this.requireLocalOwner(i,e.teamId,e.id,e.ownerId);let n=i.get("SELECT status,maximum_usd,cost_usd,usage FROM local_experiment_charges WHERE team_id=? AND execution_id=? AND request_id=?",[e.teamId,e.id,e.requestId]);if(!n)throw new c("local_charge_not_reserved","The charge does not belong to this execution.");if(e.costUsd!==null&&(!Number.isFinite(e.costUsd)||e.costUsd<0))throw new c("local_charge_invalid","Measured charge must be finite and nonnegative.");let a=e.costUsd!==null&&e.costUsd>n.maximum_usd+1e-12,o=e.confirmedTransportNotInvoked instanceof J&&e.confirmedTransportNotInvoked.executionId===e.id&&e.confirmedTransportNotInvoked.requestId===e.requestId&&e.costUsd===null&&e.usage===null&&n.status==="dispatched",r=e.notDispatched&&n.status==="reserved"||o?"released":e.costUsd===null?"unknown":"settled";if(["released","settled"].includes(n.status)){if(n.status!==r||n.cost_usd!==e.costUsd||(n.usage?d(JSON.parse(n.usage)):null)!==(e.usage?d(e.usage):null))throw new c("local_charge_receipt_conflict","A sealed charge receipt is immutable.");return{execution:E(i,e.teamId,e.id),exceedsBound:a}}return i.run("UPDATE local_experiment_charges SET status=?,cost_usd=?,usage=? WHERE team_id=? AND execution_id=? AND request_id=?",[r,e.costUsd,e.usage===null?null:JSON.stringify(e.usage),e.teamId,e.id,e.requestId]),{execution:E(i,e.teamId,e.id),exceedsBound:a}});if(t.exceedsBound)throw new c("local_charge_outside_bound","Measured charge exceeds its authoritative reservation. Its receipt was retained; no further target dispatch is admitted.");return t.execution}requireLocalChargeBounds(e,t,i){if(e.get("SELECT request_id FROM local_experiment_charges WHERE team_id=? AND execution_id=? AND cost_usd>maximum_usd+0.000000000001 LIMIT 1",[t,i]))throw new c("local_charge_outside_bound","A retained provider receipt exceeded its authoritative reservation. Further target and judge dispatch is blocked.")}requireLocalOwner(e,t,i,n){x(e,n);let a=e.get("SELECT owner_id FROM local_experiment_executions WHERE team_id=? AND id=?",[t,i]);if(!a||a.owner_id!==n)throw new c("local_execution_owner_conflict","This process does not own the execution.")}};export{ie as SqliteLocalExperimentStore};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as B}from"./chunk-IO5DZUKL.js";import{a as E}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{j as v,k as y}from"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import{d as k}from"./chunk-DRLP7GIU.js";import{wa as M}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{H as u}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{M as R,da as g}from"./chunk-4PUOWSDE.js";import{Aa as s}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as d}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";var T=class extends E{static{p(this,"SqliteModelBatchReviewStore")}async findModelBatchReview(t,r){return this.modelBatchReviewTransaction(t,r)}async beginModelBatchReview(t,r,o){let e=await this.modelBatchReviewTransaction(t,r,o);if(!e)throw new Error("Model batch review was not created.");return e}async modelBatchReviewTransaction(t,r,o){let e=k.parse(r);await this.ready;let l=this.writeQueue.then(async()=>{let a=this.db;if(!a)throw new Error("Model review store is closed.");a.exec("BEGIN IMMEDIATE");let w=!0,h=B(a,t,()=>{if(!w)throw new Error("Model review transaction is closed.")});try{let i=a.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[e.modelId,t]);if(!i)throw new s("model_not_found",404);let n=u.parse(JSON.parse(i.payload)),m=await v(h,e);if(m||!o)return a.exec("COMMIT"),m;if(n.revision!==e.expectedModelRevision||!n.trainingSetup.tasksetRef||!R(n.trainingSetup.tasksetRef,e.tasksetRef))throw new s("model_revision_conflict",409);let f=a.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND profile_id = ?",[e.tasksetRef.id,e.tasksetRef.revision,t]),c=f?M.parse(JSON.parse(f.payload)):null;if(!c||c.contentHash!==e.tasksetRef.contentHash||d(c.metadata.learning)!==d(g(o.taskset)))throw new s("model_review_package_mismatch",409);let _=await y(h,{scope:t,request:e,package:o,now:new Date().toISOString()});return a.exec("COMMIT"),_}catch(i){throw a.exec("ROLLBACK"),i}finally{w=!1}});return this.writeQueue=l.then(()=>{},()=>{}),l}};export{T as SqliteModelBatchReviewStore};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as C,b as Te}from"./chunk-K3LS5SK7.js";import{a as Q,d as ve}from"./chunk-CWAQOFLP.js";import{d as we,f as Ie,g as ye}from"./chunk-B7XJBP4U.js";import{a as he,b as F,c as J,d as ge,e as ke,f as Me}from"./chunk-YQBL5P6R.js";import"./chunk-XDFXKRTI.js";import{a as me,d as B,e as b,g as fe}from"./chunk-H6EUFJJK.js";import{b as Se,c as Pe,d as W}from"./chunk-FVK4W27G.js";import{b as pe}from"./chunk-YONDU5TN.js";import{a as ue}from"./chunk-KCJVFLBB.js";import"./chunk-CJDGLPNX.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-GD3RCUDH.js";import"./chunk-FCXDPVGJ.js";import"./chunk-UTIELP6F.js";import"./chunk-5TPYBXWM.js";import"./chunk-FYWQWKVS.js";import"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-543QHE3D.js";import"./chunk-LI56PPCN.js";import"./chunk-GI7LTJV3.js";import"./chunk-6LFTQBXP.js";import"./chunk-XGY4OQLC.js";import"./chunk-VPAEFG7X.js";import"./chunk-SFR32TMJ.js";import"./chunk-AXYAEWWA.js";import{B as le,d as de,e as ce}from"./chunk-QOUOU7FE.js";import"./chunk-WJSJXK2N.js";import"./chunk-TS5HNRZB.js";import{Ca as x,Da as ie,M as ee,O as L,Oa as ne,R as te,U as re,oa as ae,wa as oe,za as se}from"./chunk-5ZNE43XC.js";import"./chunk-HIQPGYVH.js";import{A as v,H as Y,N as Z,i as k,q as N,w as X}from"./chunk-263WS3TB.js";import"./chunk-SD2XDZQW.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-6FA3GG5B.js";import{K as g,L as R,N as G,R as V,lb as K}from"./chunk-XHU4BZQY.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as I}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";import qe from"node:path";import{createHash as xe}from"node:crypto";function j(o){let{request:a,resolved:r}=b(o.request,o.package),{starter:t,...n}=r,e=a.rewardBindingRef&&!R(a.rewardBindingRef,g(r.rewardBinding));if(e&&(!o.rewardSelection||!R(a.rewardBindingRef,g(o.rewardSelection.rewardBinding))))throw new Error("The selected starter Reward is unavailable for package preparation.");let i=re({owner:{scopeId:a.profileId,modelId:a.modelId},source:n,...e?o.rewardSelection:{rewardBinding:n.rewardBinding,rewards:n.rewards,assets:n.assets}}),{taskset:s,taskDefinition:p,rewardBinding:l,rewards:d,assets:h}=i;if(o.source.profileId!==a.profileId||o.source.sourceHash!==t.contentHash)throw new Error("Starter source must belong to this Profile and pin the catalog package.");let u=i.execution!==void 0,y=s.environment.kind==="text"&&s.environment.entrypoint==="openpond.text.v1"&&!s.environment.stateful&&(!s.environmentRelease&&!s.verifierSetRelease||i.executionResources!==void 0)&&!s.capabilities.length&&!s.tools.length;if(!["sft","grpo"].includes(a.method)||p.harness||!y&&!u||s.tasks.some(c=>c.artifactRefs.length)||s.graders.some(c=>c.kind==="model_judge"&&(!c.model||c.calibrationStatus!=="passed")))throw new Error("This starter requires an additional training or environment adapter before preparation.");let w=new Set(o.approvedTrainingTaskIds);if(w.size!==o.approvedTrainingTaskIds.length)throw new Error("Starter training approvals must be unique.");for(let c of w){let P=s.tasks.find(H=>H.id===c);if(!P||P.split!=="train")throw new Error(`Starter approval must reference a training task: ${c}.`);if(a.method==="sft"&&P.expectedOutput===null)throw new Error(`SFT starter approval requires a reviewed target: ${c}.`)}if(a.method==="grpo"&&s.tasks.some(c=>c.split==="train"&&!w.has(c.id)))throw new Error("GRPO starter preparation requires approval of every training task.");for(let c of o.fixtures){if(!s.tasks.some(P=>P.id===c.taskId))throw new Error(`Starter fixture references an unknown task: ${c.taskId}.`);u&&!c.infrastructureError&&ee.parse(c.metadata.toolScript)}let E=s.id,f=se({profileId:a.profileId,id:`${E}-draft`,name:t.name,now:o.createdAt}),S=[];for(let c of s.graders){if(c.kind!=="custom_verifier")continue;let P=h.find(D=>D.id===c.verifierRef.id);if(!P)throw new Error(`Starter verifier asset is missing: ${c.id}.`);let H=c.verifierRef.path;S.some(D=>D.path===H)||S.push({path:H,role:"verifier",content:V(P,c.verifierRef)})}let _=ae.parse({...f,objective:p.instructions,metrics:s.metrics??f.metrics,sourceRefs:[o.source],policy:s.policy,environment:{...f.environment,kind:u?"agent":"chat",entrypoint:s.environment.entrypoint,stateful:s.environment.stateful,toolNames:s.tools.map(c=>c.name),deterministicSeeds:s.environment.deterministicSeeds,defaultTimeoutMs:s.environment.defaultTimeoutMs,networkPolicy:s.environment.networkPolicy,metadata:{portableEnvironment:s.environment,portableTools:s.tools,...i.executionResources?{portableExecutionResources:i.executionResources}:i.execution?{portableExecutionResources:{environment:i.execution.environment,verifierSet:i.execution.verifierSet}}:{}}},output:{mode:"structured_json",jsonSchema:p.outputSchema,renderer:null},capabilities:{...f.capabilities,taskKind:u?"single_agent":"chat",requiresTools:u,requiresState:u,supportedSignals:a.method==="grpo"?["reward"]:["demonstration"],compatibleMethods:[a.method],rewardKinds:[...new Set(s.graders.map(c=>c.kind==="human"?"human":c.kind==="model_judge"?"model_judge":"deterministic"))],requiresPrivilegedGrading:!0,environmentPlacements:["local","remote"]},tasks:s.tasks.map(({artifactRefs:c,...P})=>({...P,schemaVersion:"openpond.taskData.v1",sourceRefs:[o.source.id],metadata:{exampleOrigin:"curated_starter",starter:g(t),portableTaskRecord:{...P,artifactRefs:[]}}})),graders:ie(l,d,h),graderFixtures:o.fixtures,learningSignals:{...f.learningSignals,rewards:a.method==="grpo"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"reward",id:`starter-reward-${c.id}`,taskId:c.id,task:p.instructions,rules:[{id:l.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],otherwisePoints:0,executable:!0,approved:!0,confidence:1,sourceRefs:[o.source.id],artifactRef:l.id,metadata:{starter:g(t),rewardBinding:g(l),approvalOrigin:"catalog_publication"}})):[],demonstrations:a.method==="sft"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"demonstration",id:`starter-target-${c.id}`,taskId:c.id,sourceRefs:[o.source.id],artifactRef:s.id,approved:!0,confidence:1,prompt:null,response:JSON.stringify(c.expectedOutput),metadata:{starter:g(t),approvalOrigin:"catalog_publication"}})):[]},metadata:{starter:g(t),starterTasksetRelease:g(s),taskDefinition:g(p),rewardBinding:g(l),rewardExecution:{binding:l,rewards:d},portableCapabilities:s.capabilities,derivedPortableMetadata:s.metadata,modelTasksetDerivation:s.metadata.modelTasksetDerivation}}),M=le({draft:_,now:o.createdAt,tasksetId:E,sourcePackageHash:s.contentHash});return M.metrics=s.metrics,s.metadata.tasksetOutputContract===void 0?delete M.metadata.tasksetOutputContract:M.metadata.tasksetOutputContract=s.metadata.tasksetOutputContract,M.contentHash=x(M),{draft:_,taskset:M,generatedFiles:S,resources:i}}m(j,"prepareModelStarterTaskset");function O(o,a){let r=B(a),t=o.get("SELECT request_hash, payload FROM model_starter_creation_operations WHERE profile_id = ? AND operation_id = ?",[r.profileId,r.operationId]);if(!t)return null;if(t.request_hash!==Re(r))throw new Error("Starter creation operation was already used with different configuration.");return v.parse(JSON.parse(t.payload))}m(O,"findModelStarterCreation");async function Ee(o,a){let r=B(a.request);if(r.learning)throw new Error("Create this Model in a hosted workspace to enable continual learning.");let t=O(o,r);if(t)return t;let{taskset:n,resources:e}=j(a),i=fe(a.package),s=await Y({id:r.modelId,profileId:r.profileId,name:r.name,objective:i.taskDefinition.instructions,defaultBaseModel:r.startingModel,defaultDestinationId:null,trainingSetup:me({package:e,setup:X.parse({tasksetRef:g(n),rewardBindingRef:g(e.rewardBinding),baseModel:r.startingModel,method:r.method,managedRolloutPlacement:"remote"})})},0);o.exec("BEGIN IMMEDIATE");try{let p=O(o,r);if(p)return o.exec("COMMIT"),p;if(o.get("SELECT id FROM tasksets WHERE id = ?",[n.id])||o.get("SELECT id FROM model_projects WHERE id = ?",[r.modelId]))throw new Error("Starter creation requires a new Model and Taskset identity.");let l=[...e.executionResources??e.execution?[{kind:"asset",resource:te(e.executionResources??e.execution)}]:[],...i.execution?[{kind:"asset",resource:L(i.execution)}]:[],...i.assets.map(u=>({kind:"asset",resource:u})),...i.rewards.map(u=>({kind:"reward",resource:u})),{kind:"binding",resource:i.rewardBinding},{kind:"definition",resource:i.taskDefinition},{kind:"package",resource:i.taskset},...e.taskset.contentHash===i.taskset.contentHash?[]:[{kind:"definition",resource:e.taskDefinition},{kind:"package",resource:e.taskset},...e.execution?[{kind:"asset",resource:L(e.execution)}]:[]]];for(let{kind:u,resource:y}of l)he(o,r.profileId,u,y);let d=JSON.stringify(n);o.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[n.id,n.profileId,n.status,d,n.createdAt,n.updatedAt]),o.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[n.id,n.revision,n.contentHash,n.profileId,n.status,d,n.createdAt,n.updatedAt]);let h=ke(o,s);return o.run("INSERT INTO model_starter_creation_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[r.profileId,r.operationId,Re(r),JSON.stringify(h)]),o.exec("COMMIT"),h}catch(p){throw o.exec("ROLLBACK"),p}}m(Ee,"commitModelStarterCreation");function Re(o){return xe("sha256").update(k(o)).digest("hex")}m(Re,"requestHash");function q(o,a,r,t,n){let e=v.parse(r);o.exec("BEGIN IMMEDIATE");try{let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[e.id]),s=i?v.parse(JSON.parse(i.payload)):null;s&&s.profileId!==e.profileId&&T("Model ownership changed during hosted synchronization.");let p;if(t)k(s)!==k(a)&&T("Model changed while its hosted configuration was loading. Refresh before applying it."),p=e;else{(!s||!a||a.id!==e.id||a.profileId!==e.profileId)&&T("Model is no longer available for hosted synchronization."),s.hosted?.teamId!==a.hosted?.teamId&&s.hosted?.teamId!==e.hosted?.teamId&&T("Model hosting team changed during synchronization.");let l=e.hosted,d=s.hosted,h=d;if(l){d?.apiOrigin&&d.apiOrigin!==l.apiOrigin&&T("Model hosting API changed during synchronization.");let u=d?.apiOrigin===l.apiOrigin&&d?.teamId===l.teamId&&d.projectId===l.projectId;u&&d.revision===l.revision&&d.etag!==l.etag&&T("Hosted Model receipts disagree about the same revision."),h={...u&&d.revision>l.revision?d:l,tasksets:u?je(d.tasksets,l.tasksets,w=>`${w.localTasksetId}:${w.releaseHash}`,w=>w.syncedAt):l.tasksets}}p=v.parse({...s,hosted:h,tasksetSyncs:je(s.tasksetSyncs,e.tasksetSyncs,u=>u.localTasksetId,u=>u.lastAttemptAt)})}return n?.(),o.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
2
+ import{a as C,b as Te}from"./chunk-SDHG6CKU.js";import{a as Q,d as ve}from"./chunk-GYYJ47GX.js";import{d as we,f as Ie,g as ye}from"./chunk-WCNPGKST.js";import{a as he,b as F,c as J,d as ge,e as ke,f as Me}from"./chunk-HKVFU3B3.js";import"./chunk-DWF3FCY4.js";import{a as me,d as B,e as b,g as fe}from"./chunk-YDZBX4XQ.js";import{b as Se,c as Pe,d as W}from"./chunk-AFH462DO.js";import{b as pe}from"./chunk-CIZI6Z7D.js";import{a as ue}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import{b as de,c as ce,z as le}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Ca as x,Da as ie,Ia as ne,M as ee,O as L,R as te,U as re,oa as ae,wa as oe,za as se}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{D as X,H as v,O as Y,U as Z,j as k,x as N}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as g,M as R,O as G,S as V,mb as K}from"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as I}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";import qe from"node:path";import{createHash as xe}from"node:crypto";function j(o){let{request:a,resolved:r}=b(o.request,o.package),{starter:t,...n}=r,e=a.rewardBindingRef&&!R(a.rewardBindingRef,g(r.rewardBinding));if(e&&(!o.rewardSelection||!R(a.rewardBindingRef,g(o.rewardSelection.rewardBinding))))throw new Error("The selected starter Reward is unavailable for package preparation.");let i=re({owner:{scopeId:a.profileId,modelId:a.modelId},source:n,...e?o.rewardSelection:{rewardBinding:n.rewardBinding,rewards:n.rewards,assets:n.assets}}),{taskset:s,taskDefinition:p,rewardBinding:l,rewards:d,assets:h}=i;if(o.source.profileId!==a.profileId||o.source.sourceHash!==t.contentHash)throw new Error("Starter source must belong to this Profile and pin the catalog package.");let u=i.execution!==void 0,y=s.environment.kind==="text"&&s.environment.entrypoint==="openpond.text.v1"&&!s.environment.stateful&&(!s.environmentRelease&&!s.verifierSetRelease||i.executionResources!==void 0)&&!s.capabilities.length&&!s.tools.length;if(!["sft","grpo"].includes(a.method)||p.harness||!y&&!u||s.tasks.some(c=>c.artifactRefs.length)||s.graders.some(c=>c.kind==="model_judge"&&(!c.model||c.calibrationStatus!=="passed")))throw new Error("This starter requires an additional training or environment adapter before preparation.");let w=new Set(o.approvedTrainingTaskIds);if(w.size!==o.approvedTrainingTaskIds.length)throw new Error("Starter training approvals must be unique.");for(let c of w){let P=s.tasks.find(H=>H.id===c);if(!P||P.split!=="train")throw new Error(`Starter approval must reference a training task: ${c}.`);if(a.method==="sft"&&P.expectedOutput===null)throw new Error(`SFT starter approval requires a reviewed target: ${c}.`)}if(a.method==="grpo"&&s.tasks.some(c=>c.split==="train"&&!w.has(c.id)))throw new Error("GRPO starter preparation requires approval of every training task.");for(let c of o.fixtures){if(!s.tasks.some(P=>P.id===c.taskId))throw new Error(`Starter fixture references an unknown task: ${c.taskId}.`);u&&!c.infrastructureError&&ee.parse(c.metadata.toolScript)}let E=s.id,f=se({profileId:a.profileId,id:`${E}-draft`,name:t.name,now:o.createdAt}),S=[];for(let c of s.graders){if(c.kind!=="custom_verifier")continue;let P=h.find(D=>D.id===c.verifierRef.id);if(!P)throw new Error(`Starter verifier asset is missing: ${c.id}.`);let H=c.verifierRef.path;S.some(D=>D.path===H)||S.push({path:H,role:"verifier",content:V(P,c.verifierRef)})}let _=ae.parse({...f,objective:p.instructions,metrics:s.metrics??f.metrics,sourceRefs:[o.source],policy:s.policy,environment:{...f.environment,kind:u?"agent":"chat",entrypoint:s.environment.entrypoint,stateful:s.environment.stateful,toolNames:s.tools.map(c=>c.name),deterministicSeeds:s.environment.deterministicSeeds,defaultTimeoutMs:s.environment.defaultTimeoutMs,networkPolicy:s.environment.networkPolicy,metadata:{portableEnvironment:s.environment,portableTools:s.tools,...i.executionResources?{portableExecutionResources:i.executionResources}:i.execution?{portableExecutionResources:{environment:i.execution.environment,verifierSet:i.execution.verifierSet}}:{}}},output:{mode:"structured_json",jsonSchema:p.outputSchema,renderer:null},capabilities:{...f.capabilities,taskKind:u?"single_agent":"chat",requiresTools:u,requiresState:u,supportedSignals:a.method==="grpo"?["reward"]:["demonstration"],compatibleMethods:[a.method],rewardKinds:[...new Set(s.graders.map(c=>c.kind==="human"?"human":c.kind==="model_judge"?"model_judge":"deterministic"))],requiresPrivilegedGrading:!0,environmentPlacements:["local","remote"]},tasks:s.tasks.map(({artifactRefs:c,...P})=>({...P,schemaVersion:"openpond.taskData.v1",sourceRefs:[o.source.id],metadata:{exampleOrigin:"curated_starter",starter:g(t),portableTaskRecord:{...P,artifactRefs:[]}}})),graders:ie(l,d,h),graderFixtures:o.fixtures,learningSignals:{...f.learningSignals,rewards:a.method==="grpo"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"reward",id:`starter-reward-${c.id}`,taskId:c.id,task:p.instructions,rules:[{id:l.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],otherwisePoints:0,executable:!0,approved:!0,confidence:1,sourceRefs:[o.source.id],artifactRef:l.id,metadata:{starter:g(t),rewardBinding:g(l),approvalOrigin:"catalog_publication"}})):[],demonstrations:a.method==="sft"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"demonstration",id:`starter-target-${c.id}`,taskId:c.id,sourceRefs:[o.source.id],artifactRef:s.id,approved:!0,confidence:1,prompt:null,response:JSON.stringify(c.expectedOutput),metadata:{starter:g(t),approvalOrigin:"catalog_publication"}})):[]},metadata:{starter:g(t),starterTasksetRelease:g(s),taskDefinition:g(p),rewardBinding:g(l),rewardExecution:{binding:l,rewards:d},portableCapabilities:s.capabilities,derivedPortableMetadata:s.metadata,modelTasksetDerivation:s.metadata.modelTasksetDerivation}}),M=le({draft:_,now:o.createdAt,tasksetId:E,sourcePackageHash:s.contentHash});return M.metrics=s.metrics,s.metadata.tasksetOutputContract===void 0?delete M.metadata.tasksetOutputContract:M.metadata.tasksetOutputContract=s.metadata.tasksetOutputContract,M.contentHash=x(M),{draft:_,taskset:M,generatedFiles:S,resources:i}}m(j,"prepareModelStarterTaskset");function O(o,a){let r=B(a),t=o.get("SELECT request_hash, payload FROM model_starter_creation_operations WHERE profile_id = ? AND operation_id = ?",[r.profileId,r.operationId]);if(!t)return null;if(t.request_hash!==Re(r))throw new Error("Starter creation operation was already used with different configuration.");return v.parse(JSON.parse(t.payload))}m(O,"findModelStarterCreation");async function Ee(o,a){let r=B(a.request);if(r.learning)throw new Error("Create this Model in a hosted workspace to enable continual learning.");let t=O(o,r);if(t)return t;let{taskset:n,resources:e}=j(a),i=fe(a.package),s=await Y({id:r.modelId,profileId:r.profileId,name:r.name,objective:i.taskDefinition.instructions,defaultBaseModel:r.startingModel,defaultDestinationId:null,trainingSetup:me({package:e,setup:X.parse({tasksetRef:g(n),rewardBindingRef:g(e.rewardBinding),baseModel:r.startingModel,method:r.method,managedRolloutPlacement:"remote"})})},0);o.exec("BEGIN IMMEDIATE");try{let p=O(o,r);if(p)return o.exec("COMMIT"),p;if(o.get("SELECT id FROM tasksets WHERE id = ?",[n.id])||o.get("SELECT id FROM model_projects WHERE id = ?",[r.modelId]))throw new Error("Starter creation requires a new Model and Taskset identity.");let l=[...e.executionResources??e.execution?[{kind:"asset",resource:te(e.executionResources??e.execution)}]:[],...i.execution?[{kind:"asset",resource:L(i.execution)}]:[],...i.assets.map(u=>({kind:"asset",resource:u})),...i.rewards.map(u=>({kind:"reward",resource:u})),{kind:"binding",resource:i.rewardBinding},{kind:"definition",resource:i.taskDefinition},{kind:"package",resource:i.taskset},...e.taskset.contentHash===i.taskset.contentHash?[]:[{kind:"definition",resource:e.taskDefinition},{kind:"package",resource:e.taskset},...e.execution?[{kind:"asset",resource:L(e.execution)}]:[]]];for(let{kind:u,resource:y}of l)he(o,r.profileId,u,y);let d=JSON.stringify(n);o.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[n.id,n.profileId,n.status,d,n.createdAt,n.updatedAt]),o.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[n.id,n.revision,n.contentHash,n.profileId,n.status,d,n.createdAt,n.updatedAt]);let h=ke(o,s);return o.run("INSERT INTO model_starter_creation_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[r.profileId,r.operationId,Re(r),JSON.stringify(h)]),o.exec("COMMIT"),h}catch(p){throw o.exec("ROLLBACK"),p}}m(Ee,"commitModelStarterCreation");function Re(o){return xe("sha256").update(k(o)).digest("hex")}m(Re,"requestHash");function q(o,a,r,t,n){let e=v.parse(r);o.exec("BEGIN IMMEDIATE");try{let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[e.id]),s=i?v.parse(JSON.parse(i.payload)):null;s&&s.profileId!==e.profileId&&T("Model ownership changed during hosted synchronization.");let p;if(t)k(s)!==k(a)&&T("Model changed while its hosted configuration was loading. Refresh before applying it."),p=e;else{(!s||!a||a.id!==e.id||a.profileId!==e.profileId)&&T("Model is no longer available for hosted synchronization."),s.hosted?.teamId!==a.hosted?.teamId&&s.hosted?.teamId!==e.hosted?.teamId&&T("Model hosting team changed during synchronization.");let l=e.hosted,d=s.hosted,h=d;if(l){d?.apiOrigin&&d.apiOrigin!==l.apiOrigin&&T("Model hosting API changed during synchronization.");let u=d?.apiOrigin===l.apiOrigin&&d?.teamId===l.teamId&&d.projectId===l.projectId;u&&d.revision===l.revision&&d.etag!==l.etag&&T("Hosted Model receipts disagree about the same revision."),h={...u&&d.revision>l.revision?d:l,tasksets:u?je(d.tasksets,l.tasksets,w=>`${w.localTasksetId}:${w.releaseHash}`,w=>w.syncedAt):l.tasksets}}p=v.parse({...s,hosted:h,tasksetSyncs:je(s.tasksetSyncs,e.tasksetSyncs,u=>u.localTasksetId,u=>u.lastAttemptAt)})}return n?.(),o.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
3
3
  ON CONFLICT(id) DO UPDATE SET payload = excluded.payload, updated_at = excluded.updated_at`,[p.id,p.profileId,JSON.stringify(p),p.createdAt,p.updatedAt]),o.exec("COMMIT"),p}catch(i){throw o.exec("ROLLBACK"),i}}m(q,"commitModelProjectHosting");function je(o,a,r,t){let n=new Map(o.map(e=>[r(e),e]));for(let e of a){let i=n.get(r(e));(!i||Date.parse(t(e))>=Date.parse(t(i)))&&n.set(r(e),e)}return[...n.values()]}m(je,"mergeLatest");function T(o){throw new Z(409,{schemaVersion:"openpond.modelProjectApiError.v2",code:"model_hosting_conflict",message:o,retryable:!1,requestId:null,details:{}})}m(T,"conflict");function z(o,a){let{request:r,resolved:t}=b(a.request,a.package),n=r.rewardBindingRef;if(!n||R(n,g(t.rewardBinding)))return a;function e(l,d){let h=o.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[r.profileId,l,d.id,d.revision]);if(!h)throw new Error(`The selected starter ${l} is unavailable in this Profile.`);let u=K[l].parse(JSON.parse(h.payload));if(G(u),d.contentHash&&d.contentHash!==u.contentHash)throw new Error("The selected starter Reward differs from its immutable reference.");return u}m(e,"read");let i=e("binding",n),s=[...new Map(i.sources.map(l=>[k(l.reward),e("reward",l.reward)])).values()],p=new Map(t.assets.map(l=>[l.id,l]));for(let l of s){let d=l.implementation;for(let h of[...l.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]])p.has(h.id)||p.set(h.id,e("asset",{id:h.id,revision:1}))}return{...a,rewardSelection:{rewardBinding:i,rewards:s,assets:[...p.values()]}}}m(z,"resolveModelStarterSelection");import be from"node:path";async function $(o,a,r){let t=r.project.trainingSetup.tasksetRef;if(!t)return;let n=o.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[t.id,t.revision]);if(!n)return;let e=oe.parse(JSON.parse(n.payload));if(e.profileId!==r.project.profileId||e.contentHash!==t.contentHash)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),s=i?v.parse(JSON.parse(i.payload)):null;if(s&&(s.profileId!==r.project.profileId||s.revision!==r.expectedRevision))return;let p=s?.hosted?.tasksets.find(f=>f.localTasksetId===e.id&&f.localTasksetHash===e.contentHash),l=typeof e.metadata.importedPackageHash=="string"?e.metadata.importedPackageHash:p?.packageHash;if(!l){if(e.metadata.learning!==void 0||e.metadata.taskDefinition!==void 0||e.metadata.rewardBinding!==void 0)return;let f=r.project.trainingSetup,S=f.baseModel??r.project.defaultBaseModel,_=f.method??(e.authoringProvenance.buildIntent==="verifiable_reward"?"grpo":null);if(!f.rewardBindingRef&&(_!=="grpo"||f.recipe||!S?.revision||!S.tokenizerRevision||!S.chatTemplateHash))return;if(x(e)!==t.contentHash)throw new Error("Selected Taskset differs from its immutable content hash.");let M=ne({taskset:e,adapterId:we(e)});return Te({storeDir:a,taskset:e,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:M.tasksetRelease,environment:M.environmentRelease,verifierSet:M.verifierSetRelease}})}let d=await Pe(a,l);if(d.taskset.id!==(p?.releaseId??t.id)||d.taskset.revision!==(p?.releaseRevision??t.revision))throw new Error("Cached package differs from its selected Taskset revision.");let{files:h,contentHash:u,...y}=d,w=Ie(d,typeof e.metadata.importedPackageHash=="string"),E=await ye({root:be.join(a,"training","tasksets",C(e)),content:y,sources:h.filter(f=>!w.has(f.asset.id)).map(f=>({asset:f.asset,sourcePath:e.tasks.flatMap(S=>S.assets??[]).find(S=>S.id===f.asset.id)?.artifactRef??f.asset.path})),fileOrder:h.map(f=>f.asset.id)});if(E.contentHash!==d.contentHash)throw new Error("Imported package bytes changed before the Reward edit.");return E}m($,"loadModelTasksetPackage");var{package:It,evaluationPackage:yt,...Ce}=de.shape,A=I.object({apiOrigin:I.string().url().refine(o=>new URL(o).origin===o),teamId:I.string().min(1),project:v,localTaskset:N,localEvaluation:N.optional(),evaluationPackageHash:I.string().regex(/^[a-f0-9]{64}$/).optional(),packageHash:I.string().regex(/^[a-f0-9]{64}$/),request:I.object(Ce).strict()}).strict().refine(o=>!!o.localEvaluation==!!o.evaluationPackageHash,"Evaluation bytes and local identity must be captured together.");function U(o,a){let r=o.get("SELECT payload FROM model_project_package_operations WHERE profile_id = ? AND model_id = ? AND state = 'pending'",[a.profileId,a.modelId]),t=r?A.parse(JSON.parse(r.payload)):null;if(t&&(t.apiOrigin!==a.apiOrigin||t.teamId!==a.teamId))throw new Error("Finish the pending package publication in its original API and workspace before changing hosting.");return t}m(U,"pendingModelPackageOperation");function Oe(o,a){let r=A.parse(a);o.exec("BEGIN IMMEDIATE");try{let t=U(o,{profileId:r.project.profileId,modelId:r.project.id,apiOrigin:r.apiOrigin,teamId:r.teamId});if(t)return o.exec("COMMIT"),t;let n=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),e=n?v.parse(JSON.parse(n.payload)):null;if(k(e)!==k(r.project))throw new Error("Model changed while its package was being prepared. Retry the push.");let i=o.get("SELECT payload, state FROM model_project_package_operations WHERE operation_id = ?",[r.request.operationId]);if(i){let s=A.parse(JSON.parse(i.payload));if(k({...s,project:r.project})!==k(r))throw new Error("Package operation identity was reused with different publication content.");if(i.state==="committed")return o.exec("COMMIT"),s;o.run("UPDATE model_project_package_operations SET state = 'pending', payload = ? WHERE operation_id = ? AND state = 'rejected'",[JSON.stringify(r),r.request.operationId])}else o.run("INSERT INTO model_project_package_operations (operation_id, profile_id, model_id, api_origin, team_id, state, payload, created_at) VALUES (?, ?, ?, ?, ?, 'pending', ?, ?)",[r.request.operationId,r.project.profileId,r.project.id,r.apiOrigin,r.teamId,JSON.stringify(r),new Date().toISOString()]);return o.exec("COMMIT"),r}catch(t){throw o.exec("ROLLBACK"),t}}m(Oe,"prepareModelPackageOperation");function _e(o,a,r){let t=ce.parse(r),n=o.get("SELECT payload, receipt FROM model_project_package_operations WHERE operation_id = ?",[a]);if(!n)throw new Error("Package push has no durable local intent.");let e=A.parse(JSON.parse(n.payload));if(n.receipt&&k(JSON.parse(n.receipt))!==k(t))throw new Error("Package push retry returned a different receipt.");if(t.operationId!==a||t.teamId!==e.teamId||t.packageHash!==e.packageHash||t.modelProjectId!==e.request.modelProjectId)throw new Error("Package push receipt differs from its local intent.");if(e.evaluationPackageHash&&(!t.evaluation||t.evaluation.packageHash!==e.evaluationPackageHash||k(t.evaluation.taskset)!==k(e.request.modelConfiguration?.trainingSetup.evaluationTasksetRef)))throw new Error("Evaluation package receipt differs from its local intent.");let i=e.project,s=t.project;if(e.request.selection==="select"&&!s)throw new Error("Selected package receipt is missing Model configuration.");if(!s&&!i.hosted)throw new Error("Historical package receipt has no existing hosted Model.");let p=new Date().toISOString(),l=v.parse({...i,hosted:{schemaVersion:"openpond.hostedModelProjectLink.v1",apiOrigin:e.apiOrigin,teamId:e.teamId,projectId:s?.id??i.hosted.projectId,portableProjectId:i.id,revision:s?.revision??i.hosted.revision,etag:t.projectEtag,syncedSourceRevision:e.request.selection==="select"?i.revision:i.hosted.syncedSourceRevision,syncedAt:p,tasksets:[...(i.hosted?.tasksets??[]).filter(d=>d.releaseHash!==t.taskset.contentHash&&d.releaseHash!==t.evaluation?.taskset.contentHash),{localTasksetId:e.localTaskset.id,localTasksetHash:e.localTaskset.contentHash,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,packageHash:t.packageHash,hostedTasksetId:t.hostedTasksetId,syncedAt:p},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,localTasksetHash:e.localEvaluation.contentHash,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,packageHash:t.evaluation.packageHash,hostedTasksetId:t.evaluation.hostedTasksetId,syncedAt:p}]:[]]},tasksetSyncs:[...i.tasksetSyncs.filter(d=>d.localTasksetId!==e.localTaskset.id&&d.localTasksetId!==e.localEvaluation?.id),{localTasksetId:e.localTaskset.id,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,state:"synced",hostedTasksetId:t.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,state:"synced",hostedTasksetId:t.evaluation.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null}]:[]]});return q(o,i,l,!1,()=>{o.run("UPDATE model_project_package_operations SET state = 'committed', receipt = ? WHERE operation_id = ?",[JSON.stringify(t),a])})}m(_e,"completeModelPackageOperation");var He=class extends ue{static{m(this,"SqliteModelConfigurationStore")}async pendingModelPackagePush(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Package push store is closed.");return U(this.db,a)}async prepareModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return Oe(this.db,a)});return this.writeQueue=r.then(()=>{},()=>{}),r}async completeModelPackagePush(a,r){await this.ready;let t=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return _e(this.db,a,r)});return this.writeQueue=t.then(()=>{},()=>{}),t}async rejectModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");this.db.run("UPDATE model_project_package_operations SET state = 'rejected' WHERE operation_id = ? AND state = 'pending'",[a])});return this.writeQueue=r.then(()=>{},()=>{}),r}async findModelProjectConfigurationSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return J(this.db,a)}async saveModelProjectConfiguration(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model save failed because the local store is closed.");let t=J(this.db,a);if(t)return t;let n=await $(this.db,this.home,a),e=F(this.db,a,!0,n);if(e?.imported)await W({home:this.home,...e.imported});else if(e){let i=qe.join(this.home,"training","tasksets",C(e.source));await Q(this.home,e,e.directoryId,{source:{directory:i,packageHash:await pe(i)},verify:m(s=>ve(s,e.taskset),"verify")}),this.db.run("UPDATE model_project_taskset_preparations SET state = 'materialized' WHERE profile_id = ? AND operation_id = ?",[a.project.profileId,a.operationId])}return ge(this.db,a,e,n?.modelResources?{...n.modelResources,taskset:n.taskset,executionResources:{environment:n.environment,verifierSet:n.verifierSet}}:n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async previewModelProjectTasksetSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return F(this.db,a,!1,await $(this.db,this.home,a))?.taskset??null}async findModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter lookup failed because the local store is closed.");return O(this.db,a)}async saveModelStarterCreation(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Starter creation failed because the local store is closed.");let t=O(this.db,a.request);if(t)return t;let n=z(this.db,a),e=j(n);return await Q(this.home,e,e.taskset.id),Ee(this.db,n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async prepareModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter check failed because the local store is closed.");return j(z(this.db,a))}async saveModelProjectHosting(a,r,t=!1,n=[]){await this.ready;let e=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model synchronization failed because the local store is closed.");if(n.length&&!t)throw new Error("Package import requires an atomic Model replacement.");for(let i of n){if(i.taskset.profileId!==r.profileId)throw new Error("Imported package belongs to another Profile.");i.reuseExisting?await Se(this.home,i.package):await W({home:this.home,...i})}return q(this.db,a,r,t,()=>{for(let i of n)Me(this.db,i)})});return this.writeQueue=e.then(()=>{},()=>{}),e}};export{He as SqliteModelConfigurationStore};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import"./chunk-XHACK2KR.js";import{c as D,e as O,f as W}from"./chunk-HKVFU3B3.js";import{a as _}from"./chunk-DWF3FCY4.js";import"./chunk-YDZBX4XQ.js";import{d as C}from"./chunk-AFH462DO.js";import"./chunk-CIZI6Z7D.js";import"./chunk-U7X5ZLAL.js";import{e as B}from"./chunk-SO4GMSNP.js";import{a as z}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{f as q,h as A}from"./chunk-JVMSN7LH.js";import{z as L}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Fa as u,ga as b,ja as H,wa as x}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{I as T,J as I,O as y}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as w,Q as E,S}from"./chunk-4PUOWSDE.js";import{Ra as R,Wa as M}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as c}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as s}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";var F=s.string().trim().min(1).max(500),P=s.string().regex(/^[a-f0-9]{64}$/),f=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparationInput.v1"),source:s.object({ownerId:F,datasetId:F,revision:s.number().int().positive(),workspaceHash:P,packageHash:P}).strict(),project:T,rewardBinding:M,rewards:s.array(R).min(1).max(100),assets:s.array(E).max(100)}).strict(),N=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparation.v1"),request:f,package:b,taskset:x,saveRequest:I,contentHash:P}).strict();async function Q(p){let e=f.parse(p.request),r=H(p.source);if(r.contentHash!==e.source.packageHash)throw new Error("Dataset package changed since preparation was requested.");if(e.project.trainingSetup.tasksetRef||e.project.trainingSetup.tasksetRelease||e.project.trainingSetup.evaluationTasksetRef||e.project.trainingSetup.rewardBindingRef||e.project.trainingSetup.harnessRelease)throw new Error("Preparation selects its Taskset and Reward from the pinned source; omit preselected Taskset, Reward and Harness references.");if(!e.project.trainingSetup.recipe||!e.project.trainingSetup.baseModel)throw new Error("Preparation requires an explicit pinned base model and complete recipe.");let a=e.project.trainingSetup.baseModel,o=e.project.trainingSetup.recipe,i=o.baseModel;if(!a.revision||!a.tokenizerRevision||!a.chatTemplateHash||!i||i.id!==a.modelId||i.revision!==a.revision||i.tokenizerRevision!==a.tokenizerRevision||i.chatTemplateHash!==a.chatTemplateHash||o.method!==e.project.trainingSetup.method)throw new Error("Project and recipe must select the same pinned base model and training method.");if(!r.taskset.tasks.some(t=>t.split==="train")||!r.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval"))throw new Error("Preparation requires existing training and held-out validation tasks; it never changes splits.");let n=new Set(e.rewardBinding.sources.map(t=>c(t.reward)));if(new Set(e.rewards.map(t=>c(w(t)))).size!==e.rewards.length||e.rewards.some(t=>!n.has(c(w(t)))))throw new Error("Preparation Reward closure contains unexpected or duplicate releases.");let l=e.rewards.flatMap(t=>[...t.assets,..."verifierRef"in t.implementation?[t.implementation.verifierRef]:[],..."rubricRef"in t.implementation?[t.implementation.rubricRef]:[],..."inputContract"in t.implementation?[t.implementation.inputContract]:[]]),G=new Set(l.map(t=>t.id));if(new Set(e.assets.map(t=>t.id)).size!==e.assets.length||e.assets.some(t=>!G.has(t.id)))throw new Error("Preparation Reward closure contains unexpected or duplicate assets.");for(let t of l){let d=e.assets.find(K=>K.id===t.id);if(!d||t.visibility!=="verifier")throw new Error("Preparation requires its exact private verifier asset closure.");S(d,t)}for(let t of["training","evaluation"])if(!e.rewardBinding.sources.some(d=>d.role===t&&d.weight>0))throw new Error(`Preparation requires a positively weighted ${t} Reward source.`);let k=A({owner:{scopeId:e.project.profileId,modelId:e.project.id},source:r,rewardBinding:e.rewardBinding,rewards:e.rewards,assets:e.assets}),g=k.modelResources.assets.filter(t=>e.assets.some(d=>d.id===t.id));if(new Set(g.map(t=>t.asset.path)).size!==g.length||g.some(t=>t.asset.visibility!=="verifier"))throw new Error("Preparation requires distinct private verifier paths with verifier visibility.");let m=u({package:k,profileId:e.project.profileId,name:p.name,createdAt:p.createdAt});m.taskset=_(m.taskset,p.reviewedTaskset,r);let j=w(m.taskset),J=await y({...e.project,trainingSetup:{...e.project.trainingSetup,tasksetRef:j,evaluationTasksetRef:m.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval")?j:null,rewardBindingRef:w(e.rewardBinding)}},0),v={schemaVersion:"openpond.localModelProjectPreparation.v1",request:e,package:k,taskset:m.taskset,saveRequest:J};return N.parse({...v,contentHash:c(v)})}h(Q,"prepareLocalModelProject");function V(p){let e=N.parse(p),{contentHash:r,...a}=e;if(c(a)!==r)throw new Error("Project preparation receipt content hash changed.");return e}h(V,"parseLocalModelProjectPreparation");var $=class extends z{static{h(this,"SqliteModelProjectPreparationStore")}async compile(e){let r=this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]),a=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",[e.source.datasetId,e.source.revision]);if(!a||!r||r.id!==e.source.ownerId)throw new Error("Dataset is unavailable on the selected local owner.");let o=B(this.database,a.payload);if(o.ownerId!==r.id||o.workspace.contentHash!==e.source.workspaceHash)throw new Error("Dataset owner or workspace changed since preparation was requested.");let i=q({workspace:o.workspace,preparation:null,adapterId:"openpond-desktop-taskset-authoring-v1",now:o.workspace.draft.updatedAt}),n=L({draft:{...o.workspace.draft,profileId:e.project.profileId},now:o.workspace.draft.updatedAt});return Q({request:e,source:i,reviewedTaskset:n,createdAt:o.workspace.draft.updatedAt,name:o.workspace.draft.name})}async prepareLocalModelProject(e){let r=f.parse(e);await this.ready;let a=this.writeQueue.then(async()=>{if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.project.id]))throw new Error("Model Project already exists; preparation only creates a distinct Model.");return this.compile(r)});return this.writeQueue=a.then(()=>{},()=>{}),a}async applyLocalModelProjectPreparation(e){let r=V(e);await this.ready;let a=this.writeQueue.then(async()=>{let o=await this.compile(r.request);if(c(o)!==c(r))throw new Error("Project preparation differs from the exact source, Reward closure or recipe. Prepare and review it again.");let i=D(this.database,r.saveRequest);if(i)return{project:i,taskset:r.taskset,packageHash:r.package.contentHash,preparationHash:r.contentHash};if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.request.project.id]))throw new Error("Model Project already exists with a different preparation.");let n=u({package:r.package,profileId:r.request.project.profileId,name:r.taskset.name,createdAt:r.taskset.createdAt});n.taskset=o.taskset,await C({home:this.home,...n}),this.database.exec("BEGIN IMMEDIATE");try{W(this.database,n);let l=O(this.database,r.saveRequest,null,r.package);return this.database.exec("COMMIT"),{project:l,taskset:n.taskset,packageHash:n.package.contentHash,preparationHash:r.contentHash}}catch(l){throw this.database.exec("ROLLBACK"),l}});return this.writeQueue=a.then(()=>{},()=>{}),a}};export{$ as SqliteModelProjectPreparationStore};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as h}from"./chunk-KCJVFLBB.js";import{Zk as n}from"./chunk-VEBW7NKD.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-DRLP7GIU.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{j as d}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";var p=`CREATE TABLE IF NOT EXISTS model_modification_recordings (
3
+ account_scope_hash TEXT NOT NULL, team_id TEXT NOT NULL, actor_id TEXT NOT NULL,
4
+ id TEXT NOT NULL, operation_id TEXT NOT NULL, command_hash TEXT NOT NULL, project_id TEXT,
5
+ metadata TEXT NOT NULL, document TEXT NOT NULL,
6
+ PRIMARY KEY(account_scope_hash,id), UNIQUE(account_scope_hash,operation_id)
7
+ ); CREATE INDEX IF NOT EXISTS modification_recording_scope_project ON model_modification_recordings(account_scope_hash,project_id,id);`,_=class extends h{static{m(this,"SqliteModificationRecordingStore")}initialized=!1;async access(t){await this.ready;let a=this.writeQueue.then(()=>{let i=this.database;this.initialized||(i.exec(p),this.initialized=!0),i.exec("BEGIN IMMEDIATE");try{let o=t(i);return i.exec("COMMIT"),o}catch(o){throw i.exec("ROLLBACK"),o}});return this.writeQueue=a.then(()=>{},()=>{}),a}async retainModificationRecording(t,a){let i=await n(a,t.teamId,t.actorId),o=i.recording;if(o.accountScopeHash!==t.accountScopeHash)throw new Error("modification_recording_scope_mismatch");let e=await this.access(s=>{let r=s.get("SELECT metadata,document,command_hash FROM model_modification_recordings WHERE account_scope_hash=? AND operation_id=?",[t.accountScopeHash,o.operationId]);if(r){if(r.command_hash!==o.commandHash)throw new Error("modification_recording_operation_conflict");return{recording:JSON.parse(r.metadata),document:JSON.parse(r.document)}}return s.run("INSERT INTO model_modification_recordings(account_scope_hash,team_id,actor_id,id,operation_id,command_hash,project_id,metadata,document) VALUES(?,?,?,?,?,?,?,?,?)",[t.accountScopeHash,t.teamId,t.actorId,o.id,o.operationId,o.commandHash,o.projectId,d(o),d(i.document)]),i}),c=await n(e,t.teamId,t.actorId);if(c.recording.accountScopeHash!==t.accountScopeHash||c.recording.commandHash!==o.commandHash||c.recording.id!==o.id)throw new Error("modification_recording_scope_corrupt");return c}async readModificationRecording(t,a){let i=await this.access(e=>e.get("SELECT metadata,document,command_hash FROM model_modification_recordings WHERE account_scope_hash=? AND team_id=? AND actor_id=? AND id=?",[t.accountScopeHash,t.teamId,t.actorId,a]));if(!i)return null;let o=await n({recording:JSON.parse(i.metadata),document:JSON.parse(i.document)},t.teamId,t.actorId);if(o.recording.accountScopeHash!==t.accountScopeHash||o.recording.id!==a||o.recording.commandHash!==i.command_hash)throw new Error("modification_recording_scope_corrupt");return o}async listModificationRecordings(t,a){return this.access(i=>{let o=i.all(`SELECT metadata FROM model_modification_recordings WHERE account_scope_hash=? AND team_id=? AND actor_id=?
8
+ ${a.projectId?"AND project_id=?":""} ${a.search?"AND instr(lower(json_extract(metadata,'$.name')),lower(?))>0":""}
9
+ ${a.afterId?"AND id>?":""} ORDER BY id LIMIT ?`,[t.accountScopeHash,t.teamId,t.actorId,...a.projectId?[a.projectId]:[],...a.search?[a.search]:[],...a.afterId?[a.afterId]:[],(a.limit??30)+1]);return{items:o.slice(0,a.limit??30).map(e=>JSON.parse(e.metadata)),hasMore:o.length>(a.limit??30)}})}};export{_ as SqliteModificationRecordingStore};